Skip to content

Commit 857101d

Browse files
Arm backend: Create negative operator_support check unsupported u55 ops (#8682)
Since there will be more unsupported ops for u55 it makes more sense to create a new negative check for ops which are always unsupported on u55. bitwise_support.py is removed with this patch as it's redundent with the new negative check. Signed-off-by: Sebastian Larsson <[email protected]>
1 parent d94b9f3 commit 857101d

File tree

3 files changed

+31
-36
lines changed

3 files changed

+31
-36
lines changed

backends/arm/operator_support/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
# pyre-unsafe
77

88
from . import ( # noqa
9-
bitwise_support,
109
convolution_support,
1110
pool_2d_support,
1211
reduce_sum_support,

backends/arm/operator_support/bitwise_support.py

Lines changed: 0 additions & 33 deletions
This file was deleted.

backends/arm/operator_support/tosa_supported_operators.py

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
from typing import final, Optional, Sequence, Type
1212

1313
import torch
14-
1514
import torch.fx as fx
15+
1616
from executorch.backends.arm._passes.arm_pass_utils import get_first_fake_tensor
1717
from executorch.backends.arm._passes.fuse_quantized_activation_pass import (
1818
FuseQuantizedActivationPass,
1919
)
20-
from executorch.backends.arm.tosa_specification import TosaSpecification
20+
from executorch.backends.arm.tosa_specification import Tosa_0_80, TosaSpecification
2121
from executorch.exir.dialects._ops import ops as exir_ops
2222
from torch.fx.passes.operator_support import any_chain, chain, OperatorSupportBase
2323
from torch.fx.passes.utils.source_matcher_utils import get_source_partitions
@@ -90,6 +90,7 @@ def tosa_support_factory(
9090
if not tosa_spec.support_float():
9191
negative_checks.append(NeedsDecompositionCheck())
9292
negative_checks.append(CheckProperQuantization())
93+
negative_checks.append(EthosU55NotSupported(tosa_spec))
9394
return chain(
9495
any_chain(
9596
BaseTOSASupportList(),
@@ -111,6 +112,9 @@ def is_node_supported(
111112
supported = node.op == "call_function" and node.target in [
112113
exir_ops.edge.aten.abs.default,
113114
exir_ops.edge.aten.add.Tensor,
115+
exir_ops.edge.aten.bitwise_and.Tensor,
116+
exir_ops.edge.aten.bitwise_or.Tensor,
117+
exir_ops.edge.aten.bitwise_xor.Tensor,
114118
exir_ops.edge.aten.expand_copy.default,
115119
exir_ops.edge.aten.cat.default,
116120
exir_ops.edge.aten.clamp.default,
@@ -170,6 +174,31 @@ def is_node_supported(
170174
return supported
171175

172176

177+
class EthosU55NotSupported(OperatorSupportBase):
178+
"""
179+
Certain operators are not supported on U55. These are listed in `unsupported` in
180+
is_node_supported().
181+
"""
182+
183+
def __init__(self, tosa_spec: TosaSpecification):
184+
self.tosa_spec = tosa_spec
185+
186+
def is_node_supported(
187+
self, submodules: typing.Mapping[str, torch.nn.Module], node: fx.Node
188+
) -> bool:
189+
if isinstance(self.tosa_spec, Tosa_0_80) and self.tosa_spec.is_U55_subset:
190+
unsupported_ops = [
191+
exir_ops.edge.aten.bitwise_and.Tensor,
192+
exir_ops.edge.aten.bitwise_or.Tensor,
193+
exir_ops.edge.aten.bitwise_xor.Tensor,
194+
]
195+
196+
if node.target in unsupported_ops:
197+
return False
198+
199+
return True
200+
201+
173202
class NeedsDecompositionCheck(OperatorSupportBase):
174203
"""
175204
Targeted operators need to be decomposed prior to quantization in order to get a pair of q-dq-nodes surrounding

0 commit comments

Comments
 (0)