Allow kernel manual registration (#491)
Summary: X-link: https://github.com/pytorch/pytorch/pull/110086 Pull Request resolved: https://github.com/pytorch/executorch/pull/491 Exposing a codegen mode for generating a hook for user to register their kernels. If we pass `--manual-registration` flag to `gen_executorch.py`, we will generate the following files: 1. RegisterKernels.h which declares a `register_all_kernels()` API inside `torch::executor` namespace. 2. RegisterKernelsEverything.cpp which implements `register_all_kernels()` by defining an array of generated kernels. This way user can depend on the library declared by `executorch_generated_lib` macro (with `manual_registration=True`) and be able to include `RegisterKernels.h`. Then they can manually call `register_all_kernels()` instead of relying on C++ static initialization mechanism which is not available in some embedded systems. Reviewed By: cccclai Differential Revision: D49439673 fbshipit-source-id: 50ee80e1040e5dd32eb94f08c78f1544811cd08d
M
Mengwei Liu committed
153cf3bf588932e0f20a61ebb1f36c05ac686701
Parent: 8cbfa80
Committed by Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
on 9/27/2023, 3:57:18 PM