Skip to content

Commit ae05ed8

Browse files
authored
Remove usages of extract_constant_segment=False
Differential Revision: D61945429 Pull Request resolved: #5074
1 parent 03a8f34 commit ae05ed8

File tree

13 files changed

+19
-50
lines changed

13 files changed

+19
-50
lines changed

backends/apple/mps/test/test_mps_utils.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,7 @@ def lower_module_and_test_output(
239239
)
240240

241241
executorch_program = delegated_program.to_executorch(
242-
config=ExecutorchBackendConfig(
243-
extract_delegate_segments=False, extract_constant_segment=False
244-
)
242+
config=ExecutorchBackendConfig(extract_delegate_segments=False)
245243
)
246244
else:
247245
delegated_program = to_backend(
@@ -258,9 +256,7 @@ def lower_module_and_test_output(
258256
_skip_dim_order=True, # TODO(T182928844): Delegate dim order op to backend.
259257
),
260258
).to_executorch(
261-
config=ExecutorchBackendConfig(
262-
extract_delegate_segments=False, extract_constant_segment=False
263-
)
259+
config=ExecutorchBackendConfig(extract_delegate_segments=False)
264260
)
265261

266262
if bundled_program:

examples/apple/coreml/scripts/export.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,7 @@ def export_lowered_module_to_executorch_program(lowered_module, example_inputs):
104104
lowered_module(*example_inputs)
105105
exec_prog = to_edge(
106106
export(lowered_module, example_inputs), compile_config=_EDGE_COMPILE_CONFIG
107-
).to_executorch(
108-
config=exir.ExecutorchBackendConfig(
109-
extract_constant_segment=False, extract_delegate_segments=True
110-
)
111-
)
107+
).to_executorch(config=exir.ExecutorchBackendConfig(extract_delegate_segments=True))
112108

113109
return exec_prog
114110

@@ -178,9 +174,7 @@ def generate_compile_specs_from_args(args):
178174
)
179175
delegated_program_manager = edge_program_manager.to_backend(partitioner)
180176
exec_program = delegated_program_manager.to_executorch(
181-
config=exir.ExecutorchBackendConfig(
182-
extract_constant_segment=False, extract_delegate_segments=True
183-
)
177+
config=exir.ExecutorchBackendConfig(extract_delegate_segments=True)
184178
)
185179
else:
186180
lowered_module, edge_copy = lower_module_to_coreml(

examples/apple/coreml/scripts/inspector_utils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ def build_sdk_runner_including_coreml(
7979
)
8080

8181
_EDGE_BACKEND_CONFIG = exir.ExecutorchBackendConfig(
82-
extract_constant_segment=False,
8382
extract_delegate_segments=True,
8483
)
8584

examples/apple/mps/scripts/mps_example.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,7 @@ def get_model_config(args):
183183
logging.info(f"Lowered graph:\n{edge.exported_program().graph}")
184184

185185
executorch_program = edge.to_executorch(
186-
config=ExecutorchBackendConfig(
187-
extract_delegate_segments=False, extract_constant_segment=False
188-
)
186+
config=ExecutorchBackendConfig(extract_delegate_segments=False)
189187
)
190188
else:
191189
lowered_module = to_backend(
@@ -195,11 +193,7 @@ def get_model_config(args):
195193
lowered_module,
196194
example_inputs,
197195
edge_compile_config=exir.EdgeCompileConfig(_check_ir_validity=False),
198-
).to_executorch(
199-
config=ExecutorchBackendConfig(
200-
extract_delegate_segments=False, extract_constant_segment=False
201-
)
202-
)
196+
).to_executorch(config=ExecutorchBackendConfig(extract_delegate_segments=False))
203197

204198
model_name = f"{args.model_name}_mps"
205199

examples/arm/aot_arm_compiler.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,7 @@ def forward(self, x):
226226

227227
try:
228228
exec_prog = edge.to_executorch(
229-
config=ExecutorchBackendConfig(
230-
extract_delegate_segments=False, extract_constant_segment=False
231-
)
229+
config=ExecutorchBackendConfig(extract_delegate_segments=False)
232230
)
233231
except RuntimeError as e:
234232
if "Missing out variants" in str(e.args[0]):

examples/models/llava/export_llava.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,6 @@ def export_all(llava_model: LlavaModel):
222222

223223
executorch_program = lowered_and_edge.to_executorch(
224224
ExecutorchBackendConfig(
225-
extract_constant_segment=True,
226225
extract_delegate_segments=True,
227226
passes=[
228227
QuantFusionPass(),

examples/portable/scripts/export_and_delegate.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
BackendWithCompilerDemo,
1616
)
1717
from executorch.exir.backend.test.op_partitioner_demo import AddMulPartitionerDemo
18-
from executorch.exir.capture._config import ExecutorchBackendConfig
19-
2018
from executorch.extension.export_util import export_to_edge
2119

2220
from ...models import MODEL_NAME_TO_MODEL
@@ -94,9 +92,7 @@ def forward(self, *args):
9492

9593
logging.info(f"Lowered graph:\n{composited_edge.exported_program().graph}")
9694

97-
exec_prog = composited_edge.to_executorch(
98-
config=ExecutorchBackendConfig(extract_constant_segment=False)
99-
)
95+
exec_prog = composited_edge.to_executorch()
10096
buffer = exec_prog.buffer
10197

10298
model_name = "composite_model"
@@ -147,9 +143,7 @@ def get_example_inputs(self):
147143
edge = edge.to_backend(AddMulPartitionerDemo())
148144
logging.info(f"Lowered graph:\n{edge.exported_program().graph}")
149145

150-
exec_prog = edge.to_executorch(
151-
config=ExecutorchBackendConfig(extract_constant_segment=False)
152-
)
146+
exec_prog = edge.to_executorch()
153147
buffer = exec_prog.buffer
154148

155149
model_name = "partition_lowered_model"

examples/qualcomm/oss_scripts/llama2/llama.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,6 @@ def lowering_modules(
315315
passes=[
316316
BuildQuantIo(),
317317
],
318-
extract_constant_segment=False,
319318
# For shared buffer, user must pass the memory address
320319
# which is allocated by RPC memory to executor runner.
321320
# Therefore, won't want to pre-allocate

examples/qualcomm/scripts/export_example.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,7 @@
9696
)
9797

9898
executorch_program = delegated_program.to_executorch(
99-
config=ExecutorchBackendConfig(
100-
extract_delegate_segments=False, extract_constant_segment=False
101-
)
99+
config=ExecutorchBackendConfig(extract_delegate_segments=False)
102100
)
103101

104102
if args.generate_etrecord:

examples/qualcomm/utils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,6 @@ def build_executorch_binary(
254254
)
255255

256256
executorch_config = ExecutorchBackendConfig(
257-
extract_constant_segment=False,
258257
# For shared buffer, user must pass the memory address
259258
# which is allocated by RPC memory to executor runner.
260259
# Therefore, won't want to pre-allocate

examples/sdk/scripts/gen_sample_etrecord.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
# This source code is licensed under the BSD-style license found in the
55
# LICENSE file in the root directory of this source tree.
66

7+
# pyre-unsafe
8+
79
# Generate fixture files
810
import argparse
911
import copy
@@ -18,7 +20,6 @@
1820
ExportedProgram,
1921
to_edge,
2022
)
21-
from executorch.exir.capture._config import ExecutorchBackendConfig
2223
from torch.export import export
2324

2425
from ...models import MODEL_NAME_TO_MODEL
@@ -38,9 +39,7 @@ def gen_etrecord(model: torch.nn.Module, inputs: Any, output_path=None):
3839
aten_dialect, compile_config=EdgeCompileConfig(_check_ir_validity=True)
3940
)
4041
edge_program_copy = copy.deepcopy(edge_program)
41-
et_program: ExecutorchProgramManager = edge_program_copy.to_executorch(
42-
config=ExecutorchBackendConfig(extract_constant_segment=False)
43-
)
42+
et_program: ExecutorchProgramManager = edge_program_copy.to_executorch()
4443
generate_etrecord(
4544
(DEFAULT_OUTPUT_PATH if not output_path else output_path),
4645
edge_dialect_program=edge_program,

examples/xnnpack/aot_compiler.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
# This source code is licensed under the BSD-style license found in the
55
# LICENSE file in the root directory of this source tree.
66

7+
# pyre-unsafe
8+
79
# Example script for exporting simple models to flatbuffer
810

911
import argparse
@@ -103,9 +105,7 @@
103105
logging.info(f"Lowered graph:\n{edge.exported_program().graph}")
104106

105107
exec_prog = edge.to_executorch(
106-
config=ExecutorchBackendConfig(
107-
extract_delegate_segments=False, extract_constant_segment=False
108-
)
108+
config=ExecutorchBackendConfig(extract_delegate_segments=False)
109109
)
110110

111111
if args.etrecord is not None:

examples/xnnpack/quantization/example.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
# This source code is licensed under the BSD-style license found in the
55
# LICENSE file in the root directory of this source tree.
66

7+
# pyre-unsafe
8+
79
import argparse
810
import copy
911
import logging
@@ -191,9 +193,7 @@ def main() -> None:
191193

192194
start = time.perf_counter()
193195
prog = edge_m.to_executorch(
194-
config=ExecutorchBackendConfig(
195-
extract_delegate_segments=False, extract_constant_segment=False
196-
)
196+
config=ExecutorchBackendConfig(extract_delegate_segments=False)
197197
)
198198
save_pte_program(prog, f"{args.model_name}_quantized")
199199
end = time.perf_counter()

0 commit comments

Comments
 (0)