Skip to content

Commit 1d9c6e8

Browse files
authored
Merge branch 'main' into fix-xlinks
2 parents b769536 + 06f912d commit 1d9c6e8

File tree

5 files changed

+25
-18
lines changed

5 files changed

+25
-18
lines changed

backends/cadence/aot/pass_utils.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ class CadencePassAttribute:
3535
ALL_CADENCE_PASSES: dict[ExportPass, CadencePassAttribute] = {}
3636

3737

38-
def get_cadence_pass_attribute(p: ExportPass) -> CadencePassAttribute:
39-
return ALL_CADENCE_PASSES[p]
38+
def get_cadence_pass_attribute(p: ExportPass) -> Optional[CadencePassAttribute]:
39+
return ALL_CADENCE_PASSES.get(p, None)
4040

4141

4242
# A decorator that registers a pass.
@@ -61,7 +61,8 @@ def create_cadence_pass_filter(
6161
def _filter(p: ExportPass) -> bool:
6262
pass_attribute = get_cadence_pass_attribute(p)
6363
return (
64-
pass_attribute.opt_level is not None
64+
pass_attribute is not None
65+
and pass_attribute.opt_level is not None
6566
and pass_attribute.opt_level <= opt_level
6667
and (not pass_attribute.debug_pass or debug)
6768
)

devtools/bundled_program/bundled_program.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ using ::executorch::runtime::EValue;
3333
using ::executorch::runtime::Result;
3434

3535
namespace executorch {
36-
namespace bundled_program {
36+
namespace BUNDLED_PROGRAM_NAMESPACE {
3737

3838
namespace {
3939

@@ -433,5 +433,5 @@ bool is_bundled_program(void* file_data, ET_UNUSED size_t file_data_len) {
433433
file_data);
434434
}
435435

436-
} // namespace bundled_program
436+
} // namespace BUNDLED_PROGRAM_NAMESPACE
437437
} // namespace executorch

devtools/bundled_program/bundled_program.h

+13-7
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,14 @@
1010

1111
#include <executorch/runtime/core/memory_allocator.h>
1212
#include <executorch/runtime/executor/method.h>
13+
#ifdef USE_ATEN_LIB
14+
#define BUNDLED_PROGRAM_NAMESPACE bundled_program::aten
15+
#else // !USE_ATEN_LIB
16+
#define BUNDLED_PROGRAM_NAMESPACE bundled_program
17+
#endif // USE_ATEN_LIB
1318

1419
namespace executorch {
15-
namespace bundled_program {
20+
namespace BUNDLED_PROGRAM_NAMESPACE {
1621

1722
/**
1823
* An opaque pointer to a serialized bundled program.
@@ -94,7 +99,7 @@ ET_DEPRECATED inline bool is_bundled_program(void* file_data) {
9499
return is_bundled_program(file_data, 128);
95100
}
96101

97-
} // namespace bundled_program
102+
} // namespace BUNDLED_PROGRAM_NAMESPACE
98103
} // namespace executorch
99104

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

108113
ET_NODISCARD inline ::executorch::runtime::Error LoadBundledInput(
109114
Method& method,
110115
serialized_bundled_program* bundled_program_ptr,
111116
size_t testset_idx) {
112-
return ::executorch::bundled_program::load_bundled_input(
117+
return ::executorch::BUNDLED_PROGRAM_NAMESPACE::load_bundled_input(
113118
method, bundled_program_ptr, testset_idx);
114119
}
115120

@@ -120,7 +125,7 @@ VerifyResultWithBundledExpectedOutput(
120125
size_t testset_idx,
121126
double rtol = 1e-5,
122127
double atol = 1e-8) {
123-
return ::executorch::bundled_program::verify_method_outputs(
128+
return ::executorch::BUNDLED_PROGRAM_NAMESPACE::verify_method_outputs(
124129
method, bundled_program_ptr, testset_idx, rtol, atol);
125130
}
126131

@@ -129,13 +134,14 @@ ET_NODISCARD inline ::executorch::runtime::Error GetProgramData(
129134
size_t file_data_len,
130135
const void** out_program_data,
131136
size_t* out_program_data_len) {
132-
return ::executorch::bundled_program::get_program_data(
137+
return ::executorch::BUNDLED_PROGRAM_NAMESPACE::get_program_data(
133138
file_data, file_data_len, out_program_data, out_program_data_len);
134139
}
135140

136141
inline bool IsBundledProgram(void* file_data) {
137142
// 128 is enough data to contain the identifier in the flatbuffer header.
138-
return ::executorch::bundled_program::is_bundled_program(file_data, 128);
143+
return ::executorch::BUNDLED_PROGRAM_NAMESPACE::is_bundled_program(
144+
file_data, 128);
139145
}
140146
} // namespace bundled_program
141147
} // namespace executor

extension/pybindings/pybindings.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ void et_pal_emit_log_message(
8484
}
8585

8686
namespace py = pybind11;
87-
using executorch::bundled_program::verify_method_outputs;
87+
using executorch::BUNDLED_PROGRAM_NAMESPACE::verify_method_outputs;
8888
using ::executorch::ET_RUNTIME_NAMESPACE::BackendInterface;
8989
using ::executorch::ET_RUNTIME_NAMESPACE::get_backend_class;
9090
using ::executorch::ET_RUNTIME_NAMESPACE::get_backend_name;
@@ -826,7 +826,7 @@ struct PyModule final {
826826
const std::string method_name,
827827
size_t testset_idx) {
828828
const void* bundled_program_ptr = m.get_bundled_program_ptr();
829-
Error status = executorch::bundled_program::load_bundled_input(
829+
Error status = executorch::BUNDLED_PROGRAM_NAMESPACE::load_bundled_input(
830830
module_->get_method(method_name), bundled_program_ptr, testset_idx);
831831
THROW_IF_ERROR(
832832
status,
@@ -842,14 +842,14 @@ struct PyModule final {
842842
double atol = 1e-8) {
843843
const void* bundled_program_ptr = m.get_bundled_program_ptr();
844844
auto& method = module_->get_method(method_name);
845-
Error status = executorch::bundled_program::load_bundled_input(
845+
Error status = executorch::BUNDLED_PROGRAM_NAMESPACE::load_bundled_input(
846846
method, bundled_program_ptr, testset_idx);
847847
THROW_IF_ERROR(
848848
status,
849849
"load_bundled_input failed with status 0x%" PRIx32,
850850
static_cast<uint32_t>(status));
851851
py::list outputs = plan_execute(method_name);
852-
status = executorch::bundled_program::verify_method_outputs(
852+
status = executorch::BUNDLED_PROGRAM_NAMESPACE::verify_method_outputs(
853853
method, bundled_program_ptr, testset_idx, rtol, atol);
854854
THROW_IF_ERROR(
855855
status,

shim_et/xplat/executorch/extension/pybindings/pybindings.bzl

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ PORTABLE_MODULE_DEPS = [
2121
] + get_all_cpu_backend_targets()
2222

2323
ATEN_MODULE_DEPS = [
24-
"//executorch/runtime/kernel:operator_registry",
24+
"//executorch/runtime/kernel:operator_registry_aten",
2525
"//executorch/runtime/executor:program_aten",
26-
"//executorch/runtime/core/exec_aten:lib",
26+
"//executorch/runtime/core/exec_aten:lib_aten",
2727
"//executorch/devtools/bundled_program/schema:bundled_program_schema_fbs",
2828
"//executorch/extension/data_loader:buffer_data_loader",
2929
"//executorch/extension/data_loader:mmap_data_loader",

0 commit comments

Comments
 (0)