Skip to content
Closed
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
8 changes: 6 additions & 2 deletions backends/apple/mps/test/test_mps_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,9 @@ def lower_module_and_test_output(
)

executorch_program = delegated_program.to_executorch(
config=ExecutorchBackendConfig(extract_constant_segment=False)
config=ExecutorchBackendConfig(
extract_delegate_segments=False, extract_constant_segment=False
)
)
else:
delegated_program = to_backend(
Expand All @@ -264,7 +266,9 @@ def lower_module_and_test_output(
_skip_dim_order=True, # TODO(T182928844): Delegate dim order op to backend.
),
).to_executorch(
config=ExecutorchBackendConfig(extract_constant_segment=False)
config=ExecutorchBackendConfig(
extract_delegate_segments=False, extract_constant_segment=False
)
)

if bundled_program:
Expand Down
4 changes: 3 additions & 1 deletion backends/arm/test/arm_tosa_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,9 @@ def tosa_run_test(op, profile=TosaProfile.MI): # noqa: C901

model_edge = model_edge.to_backend(ArmPartitioner(compile_spec))
exec_prog = model_edge.to_executorch(
config=ExecutorchBackendConfig(extract_constant_segment=False)
config=ExecutorchBackendConfig(
extract_delegate_segments=False, extract_constant_segment=False
)
)

# Save ground truth results to file
Expand Down
3 changes: 2 additions & 1 deletion backends/qualcomm/tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ def lower_module_and_test_output(
)
exec_prog = delegated_program.to_executorch(
exir.ExecutorchBackendConfig(
extract_delegate_segments=False,
# For shared buffer, user must pass the memory address
# which is allocated by RPC memory to executor runner.
# Therefore, won't want to pre-allocate
Expand All @@ -195,7 +196,7 @@ def lower_module_and_test_output(
memory_planning_algo="greedy",
alloc_graph_input=not self.shared_buffer,
alloc_graph_output=not self.shared_buffer,
)
),
)
)

Expand Down
10 changes: 8 additions & 2 deletions examples/apple/mps/scripts/mps_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,9 @@ def get_model_config(args):
logging.info(f"Lowered graph:\n{edge.exported_program().graph}")

executorch_program = edge.to_executorch(
config=ExecutorchBackendConfig(extract_constant_segment=False)
config=ExecutorchBackendConfig(
extract_delegate_segments=False, extract_constant_segment=False
)
)
else:
lowered_module = to_backend(
Expand All @@ -192,7 +194,11 @@ def get_model_config(args):
lowered_module,
example_inputs,
edge_compile_config=exir.EdgeCompileConfig(_check_ir_validity=False),
).to_executorch(config=ExecutorchBackendConfig(extract_constant_segment=False))
).to_executorch(
config=ExecutorchBackendConfig(
extract_delegate_segments=False, extract_constant_segment=False
)
)

model_name = f"{args.model_name}_mps"

Expand Down
4 changes: 3 additions & 1 deletion examples/arm/aot_arm_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,9 @@ def forward(self, x):
logging.debug(f"Lowered graph:\n{edge.exported_program().graph}")

exec_prog = edge.to_executorch(
config=ExecutorchBackendConfig(extract_constant_segment=False)
config=ExecutorchBackendConfig(
extract_delegate_segments=False, extract_constant_segment=False
)
)

model_name = f"{args.model_name}" + (
Expand Down
4 changes: 3 additions & 1 deletion examples/qualcomm/scripts/export_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@
)

executorch_program = delegated_program.to_executorch(
config=ExecutorchBackendConfig(extract_constant_segment=False)
config=ExecutorchBackendConfig(
extract_delegate_segments=False, extract_constant_segment=False
)
)

if args.generate_etrecord:
Expand Down
4 changes: 3 additions & 1 deletion examples/xnnpack/aot_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@
logging.info(f"Lowered graph:\n{edge.exported_program().graph}")

exec_prog = edge.to_executorch(
config=ExecutorchBackendConfig(extract_constant_segment=False)
config=ExecutorchBackendConfig(
extract_delegate_segments=False, extract_constant_segment=False
)
)

if args.etrecord is not None:
Expand Down
4 changes: 3 additions & 1 deletion examples/xnnpack/quantization/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,9 @@ def main() -> None:

start = time.perf_counter()
prog = edge_m.to_executorch(
config=ExecutorchBackendConfig(extract_constant_segment=False)
config=ExecutorchBackendConfig(
extract_delegate_segments=False, extract_constant_segment=False
)
)
save_pte_program(prog, f"{args.model_name}_quantized")
end = time.perf_counter()
Expand Down
2 changes: 1 addition & 1 deletion exir/capture/_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class ExecutorchBackendConfig:
# Whether to move delegate data blobs from the Program into separate
# segments, rather than encoding those blobs in the flatbuffer data.
# This makes it possible to free those blobs at runtime.
extract_delegate_segments: bool = False
extract_delegate_segments: bool = True

# Whether to extract constants from the Program into separate segments,
# rather than encoding those constants in the flatbuffer data.
Expand Down
20 changes: 12 additions & 8 deletions exir/program/test/test_program.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,19 +293,15 @@ def test_edge_to_backend_replaces_subgraph(self):
# two delegate blobs for forward and foo
self.assertEqual(
len(
delegate_manager.to_executorch(
ExecutorchBackendConfig(extract_delegate_segments=True)
)
delegate_manager.to_executorch(ExecutorchBackendConfig())
._emitter_output.program.execution_plan[0]
.delegates
),
1,
)
self.assertEqual(
len(
delegate_manager.to_executorch(
ExecutorchBackendConfig(extract_delegate_segments=True)
)
delegate_manager.to_executorch(ExecutorchBackendConfig())
._emitter_output.program.execution_plan[1]
.delegates
),
Expand Down Expand Up @@ -349,15 +345,23 @@ def test_edge_to_backend_selective(self):
# one delegate blob for forward
self.assertEqual(
len(
delegate_manager.to_executorch(ExecutorchBackendConfig())
delegate_manager.to_executorch(
ExecutorchBackendConfig(
extract_delegate_segments=False,
)
)
._emitter_output.program.execution_plan[0] # foo
.delegates
),
0,
)
self.assertEqual(
len(
delegate_manager.to_executorch(ExecutorchBackendConfig())
delegate_manager.to_executorch(
ExecutorchBackendConfig(
extract_delegate_segments=False,
)
)
._emitter_output.program.execution_plan[1] # forward
.delegates
),
Expand Down
2 changes: 1 addition & 1 deletion exir/tests/test_memory_planning.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ def test_multiple_pools(
memory_planning_pass=CustomPoolMemoryPlanningPass(
memory_planning_algo=algo,
alignment=1,
)
),
)
)
graph_module = edge_program.exported_program().graph_module
Expand Down