Skip to content

Commit 01ec43e

Browse files
Update base for 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]
1 parent d0268aa commit 01ec43e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

extension/module/module.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,16 @@
2424

2525
namespace executorch {
2626
namespace extension {
27-
namespace ET_MODULE_NAMESPACE {
2827

2928
using ET_RUNTIME_NAMESPACE::Method;
3029
using ET_RUNTIME_NAMESPACE::MethodMeta;
3130
using ET_RUNTIME_NAMESPACE::NamedDataMap;
3231
using ET_RUNTIME_NAMESPACE::Program;
3332

33+
class ExecuTorchJni;
34+
35+
namespace ET_MODULE_NAMESPACE {
36+
3437
/**
3538
* A facade class for loading programs and executing methods within them.
3639
*/
@@ -510,7 +513,7 @@ class Module {
510513
const std::string& method_name);
511514
std::unordered_map<std::string, MethodHolder> methods_;
512515

513-
friend class ExecuTorchJni;
516+
friend class executorch::extension::ExecuTorchJni;
514517
};
515518

516519
} // namespace ET_MODULE_NAMESPACE
@@ -528,6 +531,6 @@ using ::executorch::extension::ET_MODULE_NAMESPACE::Module;
528531
namespace executorch {
529532
namespace extension {
530533
// backward compatible namespace alias
531-
using namespace ::executorch::extension::ET_MODULE_NAMESPACE;
534+
using ::executorch::extension::ET_MODULE_NAMESPACE::Module;
532535
} // namespace extension
533536
} // namespace executorch

0 commit comments

Comments
 (0)