Skip to content

Commit ce01aa2

Browse files
Update on "[ExecuTorch][#10375] Add extension.BundledModule to Wrap extension.Module with Bundled Program Logic"
#10375 # Context This issue is a step of #9638. In #9638, we want to have `extension.Module` as the single source of implementation in `pybindings`, which means that `pybindings.PyModule` should use `extension.Module` rather than its own `pybindings.Module`. The issue is that `pybindings.PyModule` is dependent on the `method` getter from `pybindings.Module`, which `extension.Module` do not have. Since we don't want to expose `method` getter in `extension.Module`, we have to protect the getter, wrap the functions that is dependent on it and use the protected getter there, ultimately decouple `pybindings` from a `method` getter. # Proposal Now that we have a protected `method` getter, we can introduce a `extension.BundledModule`, a child class inheriting `extension.Module` which wraps up bundled program logic that is dependent on the `method` getter. Differential Revision: [D73564125](https://our.internmc.facebook.com/intern/diff/D73564125/) [ghstack-poisoned]
2 parents 7761ae4 + 4340e02 commit ce01aa2

File tree

3 files changed

+20
-21
lines changed

3 files changed

+20
-21
lines changed

extension/module/bundled_module.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
namespace executorch {
1414
namespace extension {
1515

16-
using executorch::extension::ET_MODULE_NAMESPACE::Module;
17-
1816
/**
1917
* A facade class for loading bundled programs and executing methods within
2018
* them.

extension/module/test/bundled_module_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ class BundledModuleTest : public ::testing::Test {
1919
if (const char* env = std::getenv("RESOURCES_PATH")) {
2020
resources_path = env;
2121
}
22+
pte_path_ = std::getenv("ET_MODULE_PTE_PATH");
2223
bpte_path_ = resources_path + "/bundled_program.bpte";
23-
pte_path_ = resources_path + "/add.pte";
2424
}
2525

2626
static inline std::string bpte_path_;

extension/module/test/targets.bzl

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -44,24 +44,25 @@ def define_common_targets(is_fbcode=False):
4444
)
4545

4646

47-
runtime.cxx_test(
48-
name = "bundled_test" + aten_suffix,
49-
srcs = [
50-
"bundled_module_test.cpp",
51-
],
52-
deps = [
53-
"//executorch/kernels/portable:generated_lib" + aten_suffix,
54-
"//executorch/extension/module:bundled_module" + aten_suffix,
55-
"//executorch/extension/tensor:tensor" + aten_suffix,
56-
],
57-
env = {
58-
"RESOURCES_PATH": "$(location :resources)/resources",
59-
},
60-
platforms = [CXX, ANDROID], # Cannot bundle resources on Apple platform.
61-
compiler_flags = [
62-
"-Wno-error=deprecated-declarations",
63-
],
64-
)
47+
runtime.cxx_test(
48+
name = "bundled_test" + aten_suffix,
49+
srcs = [
50+
"bundled_module_test.cpp",
51+
],
52+
deps = [
53+
"//executorch/kernels/portable:generated_lib" + aten_suffix,
54+
"//executorch/extension/module:bundled_module" + aten_suffix,
55+
"//executorch/extension/tensor:tensor" + aten_suffix,
56+
],
57+
env = {
58+
"RESOURCES_PATH": "$(location :resources)/resources",
59+
"ET_MODULE_PTE_PATH": "$(location fbcode//executorch/test/models:exported_programs[ModuleAdd.pte])",
60+
},
61+
platforms = [CXX, ANDROID], # Cannot bundle resources on Apple platform.
62+
compiler_flags = [
63+
"-Wno-error=deprecated-declarations",
64+
],
65+
)
6566

6667
runtime.filegroup(
6768
name = "resources",

0 commit comments

Comments
 (0)