SIGN IN SIGN UP

Add custom ops registration to examples

Summary:
## Context
I plan to add 2 (or 3) examples for different custom ops registration mechanisms. User should be able to use any of these options to use their custom ops. A proper README.md will be added.

## Solution
For the first option, we support the traditional PyTorch op registration python API. This requires users to write python implementations of both functional op and out variant op, like demonstrated in this diff. Note that those ops are only being registered into PyTorch JIT runtime for EXIR to consume. We also use buck2 target macro `executorch_generated_lib` to register custom ops to Executorch runtime.

For the second option, we want to leverage the C++ kernel user wrote for Executorch runtime, treat it as a valid PyTorch op kernel and register it into PyTorch JIT runtime. This way we don't have to write any python kernel. This can be done through CMake build, by pulling in PyTorch C++ dependency, then enabling ATen mode. This will be done once CMake diff D47927863 is landed.

The third option will be the same as the first but on CMake build system.

Note that CMake and Buck2 will then have different capabilities because pulling PyTorch C++ lib in Buck2 can't reuse the existing BUCK files.

Reviewed By: cccclai

Differential Revision: D48054313

fbshipit-source-id: 15fe77a4a69f3260b8fe09d7ce51b2f1e92cce68
M
Mengwei Liu committed
9870e11b074c5aeb3c26529ff6c2d340c977c90d
Parent: 789f4ce
Committed by Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com> on 8/4/2023, 11:30:21 PM