pytorch/test/edge
Mengwei Liu 0721a394b6 [executorch][kernel reg] Allow kernel manual registration (#110086)
Summary:
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.

Test Plan:
Rely on the unit test:

```
buck2 test fbcode//executorch/runtime/kernel/test:test_kernel_manual_registration
```

Reviewed By: cccclai

Differential Revision: D49439673

Pull Request resolved: https://github.com/pytorch/pytorch/pull/110086
Approved by: https://github.com/cccclai
2023-09-27 16:04:20 +00:00
..
templates [executorch][kernel reg] Allow kernel manual registration (#110086) 2023-09-27 16:04:20 +00:00
CMakeLists.txt
custom_ops.cpp
custom_ops.yaml [Specialized Kernel] Update yaml syntax to use kernel instead of dispatch (#104070) 2023-06-27 09:53:20 +00:00
Evalue.h
event_tracer_hooks.h Add support for event_tracer in codegen layer (#109990) 2023-09-27 09:09:03 +00:00
event_tracer.h Add support for event_tracer in codegen layer (#109990) 2023-09-27 09:09:03 +00:00
kernel_runtime_context.h Add support for event_tracer in codegen layer (#109990) 2023-09-27 09:09:03 +00:00
operator_registry.cpp [Specialized Kernel] Propagate Specialized Kernel Support through ComputeCodegenUnboxedKernels (#103113) 2023-06-14 10:18:16 +00:00
operator_registry.h [torchgen] Rename executorch's RuntimeContext to KernelRuntimeContext (#104892) 2023-07-14 21:15:50 +00:00
selected_operators.yaml [Reland][ET] Select used et_kernel_metadata only (#104005) 2023-06-23 14:38:45 +00:00
test_main.cpp
test_operator_registration.cpp [torchgen] Rename executorch's RuntimeContext to KernelRuntimeContext (#104892) 2023-07-14 21:15:50 +00:00