Skip to content

Commit

Permalink
Update default segment alignment to 128
Browse files Browse the repository at this point in the history
Differential Revision: D61104820

Pull Request resolved: pytorch#4994
  • Loading branch information
lucylq authored Aug 30, 2024
1 parent f99e25f commit 369f804
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion exir/_serialize/_program.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ def serialize_pte_binary(
mutable_data: Optional[List[Buffer]] = None,
extract_delegate_segments: bool = False,
extract_constant_segment: bool = False,
segment_alignment: int = 4096,
segment_alignment: int = 128,
constant_tensor_alignment: Optional[int] = None,
delegate_alignment: Optional[int] = None,
) -> Cord:
Expand Down
4 changes: 3 additions & 1 deletion exir/_serialize/test/test_program.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

# pyre-unsafe

import copy
import difflib
import json
Expand Down Expand Up @@ -36,7 +38,7 @@
)
from executorch.exir.tests.common import get_test_program

SEGMENT_ALIGNMENT: int = 4096
SEGMENT_ALIGNMENT: int = 128

CONSTANT_TENSOR_ALIGNMENT: int = 16

Expand Down
2 changes: 1 addition & 1 deletion exir/capture/_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class ExecutorchBackendConfig:

# When extracting segments, the starting offset of each segment will be
# aligned to this value (in bytes). Must be a power of two.
segment_alignment: int = 4096
segment_alignment: int = 128

# If provided, the minimum alignment of tensor buffers in the program. Must
# be a power of 2. If not provided, uses the value in the schema file.
Expand Down
2 changes: 1 addition & 1 deletion exir/lowered_backend_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def original_module(self) -> ExportedProgram:
def buffer(
self,
extract_delegate_segments: bool = False,
segment_alignment: int = 4096,
segment_alignment: int = 128,
constant_tensor_alignment: Optional[int] = None,
delegate_alignment: Optional[int] = None,
memory_planning: MemoryPlanningPass = None, # pyre-fixme[9]
Expand Down

0 comments on commit 369f804

Please sign in to comment.