Skip to content

[ExecuTorch] Separate extension.Module Namespaces from Aten and non-Aten #10576

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: gh/zhenyan-zhang-meta/7/base
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions extension/module/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@

#include <executorch/runtime/executor/program.h>

#ifdef USE_ATEN_LIB
#define ET_MODULE_NAMESPACE module::aten
#else // !USE_ATEN_LIB
#define ET_MODULE_NAMESPACE module
#endif // USE_ATEN_LIB

namespace executorch {
namespace extension {

Expand All @@ -24,6 +30,10 @@ using ET_RUNTIME_NAMESPACE::MethodMeta;
using ET_RUNTIME_NAMESPACE::NamedDataMap;
using ET_RUNTIME_NAMESPACE::Program;

class ExecuTorchJni;

namespace ET_MODULE_NAMESPACE {

/**
* A facade class for loading programs and executing methods within them.
*/
Expand Down Expand Up @@ -503,16 +513,24 @@ class Module {
const std::string& method_name);
std::unordered_map<std::string, MethodHolder> methods_;

friend class ExecuTorchJni;
friend class executorch::extension::ExecuTorchJni;
};

} // namespace ET_MODULE_NAMESPACE
} // namespace extension
} // namespace executorch

namespace torch {
namespace executor {
// TODO(T197294990): Remove these deprecated aliases once all users have moved
// to the new `::executorch` namespaces.
using ::executorch::extension::Module;
using ::executorch::extension::ET_MODULE_NAMESPACE::Module;
} // namespace executor
} // namespace torch

namespace executorch {
namespace extension {
// backward compatible namespace alias
using ::executorch::extension::ET_MODULE_NAMESPACE::Module;
} // namespace extension
} // namespace executorch