Description
Context
This issue is the first step of #9638. In the discussion, we want to unblock having extension/module
as the single source of implementation, which means that pybindings/pybindings
should use extension/module
rather than its own.
Specifically, the thing we need to unblock is that pybindings/pybindings
needs to load bundled program, and the current BundledProgram
APIs take method module as input (e.g. executorch::bundled_program::load_bundled_input
), where Extension.module
does not expose method class. Therefore we need to introduce new APIs to do the same job without exposing method
, wrap as a form of BundledModule
.
As a first step, we want to introduce a new API in BundledProgram
to get bundled program input out of the program without taking method
.
Proposal
The proposed change includes a utility function to the bundled program.
// in bundled_program.bundled_program.h
/**
* Load testset_idx-th bundled input of method_name into given data_ptr
*/
ET_NODISCARD ::executorch::runtime::Error get_bundled_input(
SerializedBundledProgram* bundled_program_ptr,
char* method_name,
size_t testset_idx,
void* data_ptr,
size_t data_length);
With this API, we are able to unblocked implementation the bundled module wrapper for pybindings.