Skip to content

Add aten_lib to executorch_llama #10307

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

Merged
merged 1 commit into from
Apr 20, 2025
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions devtools/bundled_program/bundled_program.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ using ::executorch::runtime::EValue;
using ::executorch::runtime::Result;

namespace executorch {
namespace bundled_program {
namespace BUNDLED_PROGRAM_NAMESPACE {

namespace {

Expand Down Expand Up @@ -433,5 +433,5 @@ bool is_bundled_program(void* file_data, ET_UNUSED size_t file_data_len) {
file_data);
}

} // namespace bundled_program
} // namespace BUNDLED_PROGRAM_NAMESPACE
} // namespace executorch
20 changes: 13 additions & 7 deletions devtools/bundled_program/bundled_program.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@

#include <executorch/runtime/core/memory_allocator.h>
#include <executorch/runtime/executor/method.h>
#ifdef USE_ATEN_LIB
#define BUNDLED_PROGRAM_NAMESPACE bundled_program::aten
#else // !USE_ATEN_LIB
#define BUNDLED_PROGRAM_NAMESPACE bundled_program
#endif // USE_ATEN_LIB

namespace executorch {
namespace bundled_program {
namespace BUNDLED_PROGRAM_NAMESPACE {

/**
* An opaque pointer to a serialized bundled program.
Expand Down Expand Up @@ -94,7 +99,7 @@ ET_DEPRECATED inline bool is_bundled_program(void* file_data) {
return is_bundled_program(file_data, 128);
}

} // namespace bundled_program
} // namespace BUNDLED_PROGRAM_NAMESPACE
} // namespace executorch

namespace torch {
Expand All @@ -103,13 +108,13 @@ namespace bundled_program {
// TODO(T197294990): Remove these deprecated aliases once all users have moved
// to the new `::executorch` namespaces.
using serialized_bundled_program =
::executorch::bundled_program::SerializedBundledProgram;
::executorch::BUNDLED_PROGRAM_NAMESPACE::SerializedBundledProgram;

ET_NODISCARD inline ::executorch::runtime::Error LoadBundledInput(
Method& method,
serialized_bundled_program* bundled_program_ptr,
size_t testset_idx) {
return ::executorch::bundled_program::load_bundled_input(
return ::executorch::BUNDLED_PROGRAM_NAMESPACE::load_bundled_input(
method, bundled_program_ptr, testset_idx);
}

Expand All @@ -120,7 +125,7 @@ VerifyResultWithBundledExpectedOutput(
size_t testset_idx,
double rtol = 1e-5,
double atol = 1e-8) {
return ::executorch::bundled_program::verify_method_outputs(
return ::executorch::BUNDLED_PROGRAM_NAMESPACE::verify_method_outputs(
method, bundled_program_ptr, testset_idx, rtol, atol);
}

Expand All @@ -129,13 +134,14 @@ ET_NODISCARD inline ::executorch::runtime::Error GetProgramData(
size_t file_data_len,
const void** out_program_data,
size_t* out_program_data_len) {
return ::executorch::bundled_program::get_program_data(
return ::executorch::BUNDLED_PROGRAM_NAMESPACE::get_program_data(
file_data, file_data_len, out_program_data, out_program_data_len);
}

inline bool IsBundledProgram(void* file_data) {
// 128 is enough data to contain the identifier in the flatbuffer header.
return ::executorch::bundled_program::is_bundled_program(file_data, 128);
return ::executorch::BUNDLED_PROGRAM_NAMESPACE::is_bundled_program(
file_data, 128);
}
} // namespace bundled_program
} // namespace executor
Expand Down
8 changes: 4 additions & 4 deletions extension/pybindings/pybindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void et_pal_emit_log_message(
}

namespace py = pybind11;
using executorch::bundled_program::verify_method_outputs;
using executorch::BUNDLED_PROGRAM_NAMESPACE::verify_method_outputs;
using ::executorch::ET_RUNTIME_NAMESPACE::BackendInterface;
using ::executorch::ET_RUNTIME_NAMESPACE::get_backend_class;
using ::executorch::ET_RUNTIME_NAMESPACE::get_backend_name;
Expand Down Expand Up @@ -826,7 +826,7 @@ struct PyModule final {
const std::string method_name,
size_t testset_idx) {
const void* bundled_program_ptr = m.get_bundled_program_ptr();
Error status = executorch::bundled_program::load_bundled_input(
Error status = executorch::BUNDLED_PROGRAM_NAMESPACE::load_bundled_input(
module_->get_method(method_name), bundled_program_ptr, testset_idx);
THROW_IF_ERROR(
status,
Expand All @@ -842,14 +842,14 @@ struct PyModule final {
double atol = 1e-8) {
const void* bundled_program_ptr = m.get_bundled_program_ptr();
auto& method = module_->get_method(method_name);
Error status = executorch::bundled_program::load_bundled_input(
Error status = executorch::BUNDLED_PROGRAM_NAMESPACE::load_bundled_input(
method, bundled_program_ptr, testset_idx);
THROW_IF_ERROR(
status,
"load_bundled_input failed with status 0x%" PRIx32,
static_cast<uint32_t>(status));
py::list outputs = plan_execute(method_name);
status = executorch::bundled_program::verify_method_outputs(
status = executorch::BUNDLED_PROGRAM_NAMESPACE::verify_method_outputs(
method, bundled_program_ptr, testset_idx, rtol, atol);
THROW_IF_ERROR(
status,
Expand Down
4 changes: 2 additions & 2 deletions shim_et/xplat/executorch/extension/pybindings/pybindings.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ PORTABLE_MODULE_DEPS = [
] + get_all_cpu_backend_targets()

ATEN_MODULE_DEPS = [
"//executorch/runtime/kernel:operator_registry",
"//executorch/runtime/kernel:operator_registry_aten",
"//executorch/runtime/executor:program_aten",
"//executorch/runtime/core/exec_aten:lib",
"//executorch/runtime/core/exec_aten:lib_aten",
"//executorch/devtools/bundled_program/schema:bundled_program_schema_fbs",
"//executorch/extension/data_loader:buffer_data_loader",
"//executorch/extension/data_loader:mmap_data_loader",
Expand Down
Loading