Skip to content

Commit 1a4cf51

Browse files
authored
Remove usages of extract_constant_segment=True
Differential Revision: D61995885 Pull Request resolved: #5082
1 parent 2806554 commit 1a4cf51

File tree

5 files changed

+6
-15
lines changed

5 files changed

+6
-15
lines changed

examples/mediatek/model_export_scripts/llama.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,6 @@ def export_to_et_ir(
369369
alloc_graph_input=False,
370370
alloc_graph_output=False,
371371
),
372-
extract_constant_segment=True,
373372
extract_delegate_segments=True,
374373
)
375374
)

examples/portable/scripts/export.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def main() -> None:
6262
*MODEL_NAME_TO_MODEL[args.model_name]
6363
)
6464

65-
backend_config = ExecutorchBackendConfig(extract_constant_segment=True)
65+
backend_config = ExecutorchBackendConfig()
6666
if args.segment_alignment is not None:
6767
backend_config.segment_alignment = int(args.segment_alignment, 16)
6868
if (

exir/_serialize/_program.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ def serialize_pte_binary(
347347
*,
348348
mutable_data: Optional[List[Buffer]] = None,
349349
extract_delegate_segments: bool = False,
350-
extract_constant_segment: bool = False,
350+
extract_constant_segment: bool = True,
351351
segment_alignment: int = 128,
352352
constant_tensor_alignment: Optional[int] = None,
353353
delegate_alignment: Optional[int] = None,

exir/_serialize/test/test_program.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ def constant_segment_with_tensor_alignment(
169169
pte_data = bytes(
170170
serialize_pte_binary(
171171
program,
172-
extract_constant_segment=True,
173172
segment_alignment=SEGMENT_ALIGNMENT,
174173
constant_tensor_alignment=constant_tensor_alignment,
175174
)
@@ -427,16 +426,12 @@ def test_round_trip_large_buffer_sizes(self) -> None:
427426

428427
def test_round_trip_no_segments_and_no_header(self) -> None:
429428
"""Tests that a Program serialized with extract_delegate_segments=True
430-
or extract_constant_segment=True, when there are no segments, does not
431-
contain an extended header, constant segment, or delegate segments. Confirm
432-
that a Program remains the same after serializing and deserializing.
429+
when there are no segments does not contain an extended header,
430+
constant segment, or delegate segments. Confirm that a Program remains
431+
the same after serializing and deserializing.
433432
"""
434433
program = get_test_program()
435-
pte_data = bytes(
436-
serialize_pte_binary(
437-
program, extract_delegate_segments=True, extract_constant_segment=True
438-
)
439-
)
434+
pte_data = bytes(serialize_pte_binary(program, extract_delegate_segments=True))
440435
self.assertGreater(len(pte_data), 16)
441436

442437
# File magic should be present at the expected offset.
@@ -637,7 +632,6 @@ def test_constant_segment_tensor_alignment_non_power_of_2_fails(self) -> None:
637632
with self.assertRaises(ValueError):
638633
serialize_pte_binary(
639634
program,
640-
extract_constant_segment=True,
641635
segment_alignment=SEGMENT_ALIGNMENT,
642636
constant_tensor_alignment=constant_tensor_alignment,
643637
)
@@ -662,7 +656,6 @@ def test_constant_segment_and_delegate_segment(self) -> None:
662656
serialize_pte_binary(
663657
program,
664658
extract_delegate_segments=True,
665-
extract_constant_segment=True,
666659
segment_alignment=SEGMENT_ALIGNMENT,
667660
constant_tensor_alignment=CONSTANT_TENSOR_ALIGNMENT,
668661
)

extension/llm/export/builder.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,6 @@ def to_executorch(self) -> "LLMEdgeManager":
261261
assert self.edge_manager, "Need to run export_to_edge() first"
262262
self.export_program = self.edge_manager.to_executorch(
263263
ExecutorchBackendConfig(
264-
extract_constant_segment=True,
265264
extract_delegate_segments=True,
266265
passes=[
267266
QuantFusionPass(),

0 commit comments

Comments
 (0)