Skip to content

Commit 5042740

Browse files
authored
Merge branch 'main' into gemma4-mlx-install-path
2 parents 74daf47 + 1992bdd commit 5042740

54 files changed

Lines changed: 1967 additions & 278 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

backends/arm/_passes/arm_pass_manager.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@
150150
from executorch.backends.arm.common.arm_compile_spec import ArmCompileSpec
151151
from executorch.backends.arm.common.pipeline_config import (
152152
ArmPassPipelineConfig,
153-
FuseDuplicateUsersConfig,
154153
SoftmaxDecompositionConfig,
155154
)
156155
from executorch.backends.arm.tosa.specification import (
@@ -238,9 +237,6 @@ def configure_skip_passes(
238237
case SoftmaxDecompositionConfig.STABLE:
239238
skip_set.add(DecomposeMaskedFillPass)
240239

241-
if config.fuse_duplicate_users is FuseDuplicateUsersConfig.DISABLED:
242-
skip_set.add(FuseDuplicateUsersPass)
243-
244240
self._skip_pass_types = tuple(skip_set)
245241
skip_names = [skipped_pass.__name__ for skipped_pass in self._skip_pass_types]
246242
logger.debug(f"Passes in skip list: {skip_names}")
@@ -403,9 +399,6 @@ def _tosa_pipeline(
403399
ConvertToClampPass(),
404400
DecomposeTOSAUnsupportedClampPass(),
405401
DecomposeGroupNormPass(),
406-
DecomposeGruPass(),
407-
DecomposeLstmPass(),
408-
DecomposeRnnPass(),
409402
DecomposeLayerNormPass(),
410403
DecomposeVarPass(),
411404
DecomposeMeanDimPass(exported_program.graph_module, self.tosa_spec),

backends/arm/_passes/decompose_gru_pass.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Copyright (c) Meta Platforms, Inc. and affiliates.
22
# All rights reserved.
3+
# Copyright 2026 Arm Limited and/or its affiliates.
34
#
45
# This source code is licensed under the BSD-style license found in the
56
# LICENSE file in the root directory of this source tree.
@@ -13,7 +14,6 @@
1314
create_node,
1415
get_getitem_users,
1516
)
16-
from executorch.backends.arm._passes.insert_table_ops import InsertTableOpsPass
1717
from executorch.exir.pass_base import ExportPass, PassResult
1818

1919

@@ -34,7 +34,7 @@ class DecomposeGruPass(ArmPass):
3434
3535
"""
3636

37-
_passes_required_after: Set[Type[ExportPass]] = {InsertTableOpsPass}
37+
_passes_required_after: Set[Type[ExportPass]] = set()
3838

3939
_TARGET = torch.ops.aten.gru.input
4040

backends/arm/_passes/decompose_lstm_pass.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Copyright (c) Meta Platforms, Inc. and affiliates.
22
# All rights reserved.
3+
# Copyright 2026 Arm Limited and/or its affiliates.
34
#
45
# This source code is licensed under the BSD-style license found in the
56
# LICENSE file in the root directory of this source tree.
@@ -13,7 +14,6 @@
1314
create_node,
1415
get_getitem_users,
1516
)
16-
from executorch.backends.arm._passes.insert_table_ops import InsertTableOpsPass
1717
from executorch.exir.pass_base import ExportPass, PassResult
1818

1919

@@ -36,7 +36,7 @@ class DecomposeLstmPass(ArmPass):
3636
3737
"""
3838

39-
_passes_required_after: Set[Type[ExportPass]] = {InsertTableOpsPass}
39+
_passes_required_after: Set[Type[ExportPass]] = set()
4040

4141
_TARGET = torch.ops.aten.lstm.input
4242

backends/arm/_passes/decompose_rnn_pass.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Copyright (c) Meta Platforms, Inc. and affiliates.
22
# All rights reserved.
3+
# Copyright 2026 Arm Limited and/or its affiliates.
34
#
45
# This source code is licensed under the BSD-style license found in the
56
# LICENSE file in the root directory of this source tree.
@@ -13,7 +14,6 @@
1314
create_node,
1415
get_getitem_users,
1516
)
16-
from executorch.backends.arm._passes.insert_table_ops import InsertTableOpsPass
1717
from executorch.exir.pass_base import ExportPass, PassResult
1818

1919

@@ -30,7 +30,7 @@ class DecomposeRnnPass(ArmPass):
3030
3131
"""
3232

33-
_passes_required_after: Set[Type[ExportPass]] = {InsertTableOpsPass}
33+
_passes_required_after: Set[Type[ExportPass]] = set()
3434

3535
_TARGETS = {
3636
torch.ops.aten.rnn_tanh.input,

backends/arm/_passes/decompose_sum_pass.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def call_operator(self, op, args, kwargs, meta):
7878
for dim in dims:
7979
input_node = super().call_operator(
8080
sum_op,
81-
(input_node, dim, True),
81+
(input_node, [dim], True),
8282
kwargs,
8383
meta,
8484
updated=True,

backends/arm/common/pipeline_config.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,12 @@ class SoftmaxDecompositionConfig(Enum):
1414
STABLE = auto() # Stable softmax, no masked fill decomposition
1515

1616

17-
class FuseDuplicateUsersConfig(Enum):
18-
ENABLED = auto()
19-
DISABLED = auto()
20-
21-
2217
@dataclass
2318
class ArmPassPipelineConfig:
2419
softmax: SoftmaxDecompositionConfig = SoftmaxDecompositionConfig.MASKED
25-
fuse_duplicate_users: FuseDuplicateUsersConfig = FuseDuplicateUsersConfig.ENABLED
26-
27-
def disable_fuse_duplicate_users(self) -> None:
28-
self.fuse_duplicate_users = FuseDuplicateUsersConfig.DISABLED
2920

3021
def is_default(self) -> bool:
31-
return (
32-
self.softmax is SoftmaxDecompositionConfig.MASKED
33-
and self.fuse_duplicate_users is FuseDuplicateUsersConfig.ENABLED
34-
)
22+
return self.softmax is SoftmaxDecompositionConfig.MASKED
3523

3624
def to_dict(self) -> dict[str, str]:
3725
return {f.name: getattr(self, f.name).name for f in fields(self)}

backends/arm/operators/op_sum.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def define_node(
4343

4444
tensor = inputs[0]
4545
input_shape = list(tensor.shape)
46-
dim = int(inputs[1].number % len(input_shape))
46+
dim = int(inputs[1].special[0] % len(input_shape))
4747

4848
attr = ts.TosaSerializerAttribute()
4949
attr.ReduceSumAttribute(dim)

backends/arm/test/misc/test_compile_spec.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@
55

66
import warnings
77

8-
from executorch.backends.arm.common.pipeline_config import (
9-
FuseDuplicateUsersConfig,
10-
SoftmaxDecompositionConfig,
11-
)
8+
from executorch.backends.arm.common.pipeline_config import SoftmaxDecompositionConfig
129
from executorch.backends.arm.ethosu import EthosUCompileSpec
1310
from executorch.backends.arm.tosa.compile_spec import TosaCompileSpec
1411
from executorch.backends.arm.vgf import VgfCompileSpec
@@ -66,11 +63,11 @@ def test_compile_spec_vgf_no_quant():
6663
EthosUCompileSpec._from_list(spec_list)
6764

6865

69-
def test_compile_spec_vgf_defaults_to_enabled_fuse_duplicate_users():
66+
def test_compile_spec_vgf_uses_default_pipeline_config():
7067
compile_spec = VgfCompileSpec()
7168
pipeline_config = compile_spec._get_pass_pipeline_config()
7269

73-
assert pipeline_config.fuse_duplicate_users == FuseDuplicateUsersConfig.ENABLED
70+
assert pipeline_config.is_default()
7471

7572

7673
def test_compile_spec_tosa_INT():

backends/arm/test/misc/test_pass_pipeline_config.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,13 @@ def test_pipeline_config_override_outside_compile_spec():
2929
override_compile_spec = TosaCompileSpec(
3030
TosaSpecification.create_from_string("TOSA-1.00+INT")
3131
)
32-
override_config = ArmPassPipelineConfig()
33-
override_config.disable_fuse_duplicate_users()
32+
override_config = ArmPassPipelineConfig(softmax=SoftmaxDecompositionConfig.STABLE)
3433
override_compile_spec.set_pass_pipeline_config(override_config)
3534
override_manager = ArmPassManager(override_compile_spec)
3635
skip_passes = override_manager._skip_pass_types
3736

38-
assert FuseDuplicateUsersPass in skip_passes
39-
assert DecomposeSoftmaxPass not in skip_passes
37+
assert FuseDuplicateUsersPass not in skip_passes
38+
assert DecomposeMaskedFillPass in skip_passes
4039

4140

4241
def test_softmax_config_masked_no_target():

backends/arm/test/misc/test_tosa_dialect_avg_pool2d_adaptive.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,27 @@
1919
from torch._subclasses.fake_tensor import FakeTensorMode
2020

2121

22+
def test_avg_pool2d_tosa_non_square_kernel_output_shape():
23+
with TosaLoweringContext(
24+
TosaSpecification.create_from_string("TOSA-1.0+FP")
25+
), FakeTensorMode() as mode:
26+
x = mode.from_tensor(torch.randn((1, 20, 20, 8), dtype=torch.float32))
27+
input_zp = mode.from_tensor(torch.zeros((1,), dtype=torch.float32))
28+
output_zp = mode.from_tensor(torch.zeros((1,), dtype=torch.float32))
29+
30+
output = exir_ops.backend.tosa.AVG_POOL2D.default(
31+
x,
32+
input_zp,
33+
output_zp,
34+
[2, 3],
35+
[2, 1],
36+
[1, 1, 0, 0],
37+
torch.float32,
38+
)
39+
40+
assert tuple(output.shape) == (1, 11, 18, 8)
41+
42+
2243
def test_avg_pool2d_adaptive_tosa_INT():
2344
sample_inputs = [
2445
(

0 commit comments

Comments
 (0)