Manual kernel registration to include library names in API
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5k
- Forks
- 1.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 581
Description
🚀 The feature, motivation and pitch
This request came from @shoumikhin.
For developers on Xcode, they wanted to be able to pick and use kernels_optimized, kernels_quantized and kernels_custom libraries in their application.
The caveat is that since they all use static initialization kernel registration mechanism, all of these libraries requires --force_load linker flag here:
This causes churns for app developers because they will have to add these linker flags manually and it's not an out of the box experience.
To fix this, we wanted to allow user to pass in a library name to codegen and generate a register_<lib_name>_kernels API.
Currently we trigger selective build using this API:
https://github.com/pytorch/executorch/blob/main/tools/cmake/Codegen.cmake#L63C10-L63C39
We want to add a new argument LIB_NAME and pass the value all the way down into the python script here:
https://github.com/pytorch/executorch/blob/main/tools/cmake/Codegen.cmake#L95
Then inside the python script, add an optional argument to take the lib name and optionally generate register_<lib_name>_kernels API.
Alternatives
No response
Additional context
No response
RFC (Optional)
No response
cc @JacobSzwejbka @lucylq
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with tools/cmake/Codegen.cmake at the selective-build API and LIB_NAME handoff, then follow the linked Python codegen script. Check how kernel registration is currently generated and define the optional library-name path. Done means callers can pass LIB_NAME and receive a register_<lib_name>_kernels API for libraries such as kernels_optimized, kernels_quantized, and kernels_custom.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, python
- Domain
- build-system, mobile-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100