Skip to content

RFC: Create high level CMake targets #12138

@larryliu0820

Description

@larryliu0820

🚀 The feature, motivation and pitch

Currently it's hard to let a C++ project to depend on ExecuTorch and we should fix it by providing fixed number of user facing targets.

Context

Take this Zephyr application for example, it is hard to figure out what CMake targets to use, because there are too many of them.

Some context on the initial design: we started off ExecuTorch aiming to be customizable and reduce binary size of the core runtime as much as possible. This results in a fragmentation of libraries, we expect applications to choose and pick these libraries to build their final binary. As we are getting close to GA, we want to hide more implementation details, and group these libraries into user facing categories to avoid confusion.

The full list of the libraries that belong to EXECUTORCH_LIBRARIES can be found here.

Proposal

We create these user facing libraries:

  • executorch_core
    • Existing target, provides definition of the core runtime Method, Program, flatbuffer lib etc. Make sure we have the basic model deserialization and execution functionality.
  • kernels
    • Depends on user provided CMake options, provide a (dtype) selective build powered kernel library. By default this library contains optimized kernels and fallback to portable kernels.
  • backends
    • An aggregation of all the backends user specified, through a CMake option.
  • extensions
    • A combination of libextension_modules, libextension_data_loader, libextension_tensor etc. This is also configurable by checking CMake options.

For all of the existing targets, we want to add a _ prefix to the target name, to indicate that they are internal only and probably shouldn't be linked directly.

Alternatives

No response

Additional context

No response

RFC (Optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions