Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions backends/arm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ The Arm Backend should be considered a prototype quality at this point, likely s
## Current flows

The ArmBackend has a two stage process,
- Compile to TOSA to rationalise the graph into known hardware support profiles. Currently this is to v0.80.0 TOSA BI with specific concern to a subset which gives support on Ethos-U55, the target of the initial prototype efforts.
- Lower via the ethos-u-vela compilation flow which takes TOSA v0.80.0 as an input and produces a low level commandstream for the hardware which is then passed via the delegate to the ethos-u-core-driver for direct execution.
- Compile to TOSA to rationalise the graph into known hardware support profiles. Currently this is to v0.80 TOSA BI with specific concern to a subset which gives support on Ethos-U55, the target of the initial prototype efforts.
- Lower via the ethos-u-vela compilation flow which takes TOSA v0.80 as an input and produces a low level commandstream for the hardware which is then passed via the delegate to the ethos-u-core-driver for direct execution.

The ArmPartitioner is currenly used to ensure the operations converted are Ethos-U compatible, but will be extended to offer spec-correct TOSA Base inference and TOSA Main Inference generation in future.

Expand Down
2 changes: 1 addition & 1 deletion backends/arm/arm_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def ethosu_compile_spec(
if extra_flags is not None:
self.compiler_flags.append(extra_flags)

base_tosa_version = "TOSA-0.80.0+BI"
base_tosa_version = "TOSA-0.80+BI"
if "u55" in config:
# Add the Ethos-U55 extension marker
base_tosa_version += "+u55"
Expand Down
4 changes: 2 additions & 2 deletions backends/arm/operator_support/right_shift_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ class RightShiftSupported(SupportedTOSAOperatorCheck):
targets = [exir_ops.edge.aten.__rshift__.Scalar]

tosa_specs = [
TosaSpecification.create_from_string("TOSA-0.80.0+BI"),
TosaSpecification.create_from_string("TOSA-0.80.0+MI"),
TosaSpecification.create_from_string("TOSA-0.80+BI"),
TosaSpecification.create_from_string("TOSA-0.80+MI"),
]

def is_node_supported(self, node: fx.Node, tosa_spec: TosaSpecification):
Expand Down
4 changes: 2 additions & 2 deletions backends/arm/operator_support/to_copy_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ class ToCopySupported(SupportedTOSAOperatorCheck):
targets = [exir_ops.edge.aten._to_copy.default]

tosa_specs = [
TosaSpecification.create_from_string("TOSA-0.80.0+BI"),
TosaSpecification.create_from_string("TOSA-0.80.0+MI"),
TosaSpecification.create_from_string("TOSA-0.80+BI"),
TosaSpecification.create_from_string("TOSA-0.80+MI"),
]

SupportedTypeDict = dict[torch.dtype, list[torch.dtype]]
Expand Down
4 changes: 2 additions & 2 deletions backends/arm/operator_support/tosa_supported_operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ def is_node_supported(self, node: fx.Node, tosa_spec: TosaSpecification) -> bool
_tosa_spec_dicts: dict[
TosaSpecification, dict[str, Type[SupportedTOSAOperatorCheck]]
] = {
TosaSpecification.create_from_string("TOSA-0.80.0+BI"): {},
TosaSpecification.create_from_string("TOSA-0.80.0+MI"): {},
TosaSpecification.create_from_string("TOSA-0.80+BI"): {},
TosaSpecification.create_from_string("TOSA-0.80+MI"): {},
}


Expand Down
8 changes: 4 additions & 4 deletions backends/arm/operators/node_visitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ class NodeVisitor:
# When all node_visitors has been refactored to target a specific
# version, this list should be removed.
tosa_specs = [
TosaSpecification.create_from_string("TOSA-0.80.0+BI"),
TosaSpecification.create_from_string("TOSA-0.80.0+MI"),
TosaSpecification.create_from_string("TOSA-0.80+BI"),
TosaSpecification.create_from_string("TOSA-0.80+MI"),
]

def __init__(self, exported_program: ExportedProgram, tosa_spec: TosaSpecification):
Expand All @@ -46,8 +46,8 @@ def define_node(

# container for all node visitors
_node_visitor_dicts = {
TosaSpecification.create_from_string("TOSA-0.80.0+BI"): {},
TosaSpecification.create_from_string("TOSA-0.80.0+MI"): {},
TosaSpecification.create_from_string("TOSA-0.80+BI"): {},
TosaSpecification.create_from_string("TOSA-0.80+MI"): {},
}


Expand Down
8 changes: 4 additions & 4 deletions backends/arm/operators/op_add.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class AddVisitor_080_BI(NodeVisitor):
target = "aten.add.Tensor"

tosa_specs = [
TosaSpecification.create_from_string("TOSA-0.80.0+BI"),
TosaSpecification.create_from_string("TOSA-0.80+BI"),
]

def __init__(self, *args):
Expand All @@ -40,7 +40,7 @@ def define_node(
output: TosaArg,
is_quant_node: bool,
) -> None:
# Specification (0.80.0) states that input and output types
# Specification (0.80) states that input and output types
# should all be the same
assert inputs[0].dtype == inputs[1].dtype == output.dtype
# Handle int8 (quantized) and int32
Expand Down Expand Up @@ -84,7 +84,7 @@ class AddVisitor_080_MI(AddVisitor_080_BI):
# inheriting 'target' from BI class

tosa_specs = [
TosaSpecification.create_from_string("TOSA-0.80.0+MI"),
TosaSpecification.create_from_string("TOSA-0.80+MI"),
]

def __init__(self, *args):
Expand All @@ -98,7 +98,7 @@ def define_node(
output: TosaArg,
is_quant_node: bool,
) -> None:
# Specification (0.80.0) states that input and output types
# Specification (0.80) states that input and output types
# should all be the same
assert inputs[0].dtype == inputs[1].dtype == output.dtype

Expand Down
14 changes: 7 additions & 7 deletions backends/arm/test/misc/test_debug_feats.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def _tosa_MI_pipeline(self, module: torch.nn.Module, dump_file=None):
ArmTester(
module,
example_inputs=module.get_inputs(),
compile_spec=common.get_tosa_compile_spec("TOSA-0.80.0+MI"),
compile_spec=common.get_tosa_compile_spec("TOSA-0.80+MI"),
)
.export()
.to_edge()
Expand All @@ -63,7 +63,7 @@ def _tosa_BI_pipeline(self, module: torch.nn.Module, dump_file=None):
ArmTester(
module,
example_inputs=module.get_inputs(),
compile_spec=common.get_tosa_compile_spec("TOSA-0.80.0+BI"),
compile_spec=common.get_tosa_compile_spec("TOSA-0.80+BI"),
)
.quantize()
.export()
Expand Down Expand Up @@ -111,7 +111,7 @@ def test_numerical_diff_prints(self):
model,
example_inputs=model.get_inputs(),
compile_spec=common.get_tosa_compile_spec(
"TOSA-0.80.0+MI",
"TOSA-0.80+MI",
permute_memory_to_nhwc=True,
custom_path=tempfile.mkdtemp("diff_print_test"),
),
Expand All @@ -138,7 +138,7 @@ def test_dump_ops_and_dtypes():
ArmTester(
model,
example_inputs=model.get_inputs(),
compile_spec=common.get_tosa_compile_spec("TOSA-0.80.0+BI"),
compile_spec=common.get_tosa_compile_spec("TOSA-0.80+BI"),
)
.quantize()
.dump_dtype_distribution()
Expand All @@ -159,7 +159,7 @@ def test_dump_ops_and_dtypes_parseable():
ArmTester(
model,
example_inputs=model.get_inputs(),
compile_spec=common.get_tosa_compile_spec("TOSA-0.80.0+BI"),
compile_spec=common.get_tosa_compile_spec("TOSA-0.80+BI"),
)
.quantize()
.dump_dtype_distribution(print_table=False)
Expand Down Expand Up @@ -187,7 +187,7 @@ def test_collate_tosa_BI_tests(self):
ArmTester(
model,
example_inputs=model.get_inputs(),
compile_spec=common.get_tosa_compile_spec("TOSA-0.80.0+BI"),
compile_spec=common.get_tosa_compile_spec("TOSA-0.80+BI"),
)
.quantize()
.export()
Expand Down Expand Up @@ -216,7 +216,7 @@ def test_dump_tosa_ops(caplog):
ArmTester(
model,
example_inputs=model.get_inputs(),
compile_spec=common.get_tosa_compile_spec("TOSA-0.80.0+BI"),
compile_spec=common.get_tosa_compile_spec("TOSA-0.80+BI"),
)
.quantize()
.export()
Expand Down
4 changes: 2 additions & 2 deletions backends/arm/test/misc/test_dim_order_guards.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def test_tosa_MI_pipeline(self):
ArmTester(
module,
example_inputs=module.get_inputs(),
compile_spec=common.get_tosa_compile_spec("TOSA-0.80.0+MI"),
compile_spec=common.get_tosa_compile_spec("TOSA-0.80+MI"),
)
.export()
.to_edge()
Expand All @@ -48,7 +48,7 @@ def test_tosa_BI_pipeline(self):
ArmTester(
module,
example_inputs=module.get_inputs(),
compile_spec=common.get_tosa_compile_spec("TOSA-0.80.0+BI"),
compile_spec=common.get_tosa_compile_spec("TOSA-0.80+BI"),
)
.quantize()
.export()
Expand Down
8 changes: 4 additions & 4 deletions backends/arm/test/misc/test_lifted_tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def test_partition_lifted_tensor_tosa_MI(self, op, data):
ArmTester(
LiftedTensor(op),
example_inputs=data,
compile_spec=common.get_tosa_compile_spec("TOSA-0.80.0+MI"),
compile_spec=common.get_tosa_compile_spec("TOSA-0.80+MI"),
)
.export()
.to_edge()
Expand All @@ -77,7 +77,7 @@ def test_partition_lifted_tensor_tosa_BI(self, op, data):
ArmTester(
LiftedTensor(op),
example_inputs=data,
compile_spec=common.get_tosa_compile_spec("TOSA-0.80.0+BI"),
compile_spec=common.get_tosa_compile_spec("TOSA-0.80+BI"),
)
.quantize()
.export()
Expand All @@ -95,7 +95,7 @@ def test_partition_lifted_scalar_tensor_tosa_MI(self, op, data, arg1):
ArmTester(
LiftedScalarTensor(op, arg1),
example_inputs=(data),
compile_spec=common.get_tosa_compile_spec("TOSA-0.80.0+MI"),
compile_spec=common.get_tosa_compile_spec("TOSA-0.80+MI"),
)
.export()
.to_edge()
Expand All @@ -110,7 +110,7 @@ def test_partition_lifted_scalar_tensor_tosa_BI(self, op, data, arg1):
ArmTester(
LiftedScalarTensor(op, arg1),
example_inputs=(data),
compile_spec=common.get_tosa_compile_spec("TOSA-0.80.0+BI"),
compile_spec=common.get_tosa_compile_spec("TOSA-0.80+BI"),
)
.quantize()
.export()
Expand Down
22 changes: 11 additions & 11 deletions backends/arm/test/misc/test_tosa_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
from parameterized import parameterized

test_valid_0_80_strings = [
"TOSA-0.80.0+BI",
"TOSA-0.80.0+MI+8k",
"TOSA-0.80.0+BI+u55",
"TOSA-0.80+BI",
"TOSA-0.80+MI+8k",
"TOSA-0.80+BI+u55",
]
test_valid_1_00_strings = [
"TOSA-1.00.0+INT+FP+fft",
Expand All @@ -35,11 +35,11 @@
}

test_invalid_strings = [
"TOSA-0.80.0+bi",
"TOSA-0.80.0",
"TOSA-0.80.0+8k",
"TOSA-0.80.0+BI+MI",
"TOSA-0.80.0+BI+U55",
"TOSA-0.80+bi",
"TOSA-0.80",
"TOSA-0.80+8k",
"TOSA-0.80+BI+MI",
"TOSA-0.80+BI+U55",
"TOSA-1.00.0+fft",
"TOSA-1.00.0+fp+bf16+fft",
"TOSA-1.00.0+INT+INT4+cf",
Expand All @@ -50,13 +50,13 @@
]

test_compile_specs = [
([CompileSpec("tosa_version", "TOSA-0.80.0+BI".encode())],),
([CompileSpec("tosa_version", "TOSA-0.80.0+BI+u55".encode())],),
([CompileSpec("tosa_version", "TOSA-0.80+BI".encode())],),
([CompileSpec("tosa_version", "TOSA-0.80+BI+u55".encode())],),
([CompileSpec("tosa_version", "TOSA-1.00.0+INT".encode())],),
]

test_compile_specs_no_version = [
([CompileSpec("other_key", "TOSA-0.80.0+BI".encode())],),
([CompileSpec("other_key", "TOSA-0.80+BI".encode())],),
([CompileSpec("other_key", "some_value".encode())],),
]

Expand Down
4 changes: 2 additions & 2 deletions backends/arm/test/models/test_mobilenet_v2_arm.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def test_mv2_tosa_MI(self):
self.mv2,
example_inputs=self.model_inputs,
compile_spec=common.get_tosa_compile_spec(
"TOSA-0.80.0+MI", permute_memory_to_nhwc=True
"TOSA-0.80+MI", permute_memory_to_nhwc=True
),
)
.export()
Expand All @@ -70,7 +70,7 @@ def test_mv2_tosa_BI(self):
self.mv2,
example_inputs=self.model_inputs,
compile_spec=common.get_tosa_compile_spec(
"TOSA-0.80.0+BI", permute_memory_to_nhwc=True
"TOSA-0.80+BI", permute_memory_to_nhwc=True
),
)
.quantize()
Expand Down
4 changes: 2 additions & 2 deletions backends/arm/test/ops/test_add.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def _test_add_tosa_MI_pipeline(
ArmTester(
module,
example_inputs=test_data,
compile_spec=common.get_tosa_compile_spec("TOSA-0.80.0+MI"),
compile_spec=common.get_tosa_compile_spec("TOSA-0.80+MI"),
)
.export()
.check_count({"torch.ops.aten.add.Tensor": 1})
Expand All @@ -80,7 +80,7 @@ def _test_add_tosa_BI_pipeline(
ArmTester(
module,
example_inputs=test_data,
compile_spec=common.get_tosa_compile_spec("TOSA-0.80.0+BI"),
compile_spec=common.get_tosa_compile_spec("TOSA-0.80+BI"),
)
.quantize()
.export()
Expand Down
4 changes: 2 additions & 2 deletions backends/arm/test/ops/test_avg_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def _test_avgpool2d_tosa_MI_pipeline(
module,
example_inputs=test_data,
compile_spec=common.get_tosa_compile_spec(
"TOSA-0.80.0+MI", permute_memory_to_nhwc=True
"TOSA-0.80+MI", permute_memory_to_nhwc=True
),
)
.export()
Expand All @@ -79,7 +79,7 @@ def _test_avgpool2d_tosa_BI_pipeline(
module,
example_inputs=test_data,
compile_spec=common.get_tosa_compile_spec(
"TOSA-0.80.0+BI", permute_memory_to_nhwc=True
"TOSA-0.80+BI", permute_memory_to_nhwc=True
),
)
.quantize(Quantize(quantizer, get_symmetric_quantization_config()))
Expand Down
6 changes: 3 additions & 3 deletions backends/arm/test/ops/test_batch_norm.py
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ def _test_batchnorm2d_tosa_MI_pipeline(
ArmTester(
module,
example_inputs=test_data,
compile_spec=common.get_tosa_compile_spec("TOSA-0.80.0+MI"),
compile_spec=common.get_tosa_compile_spec("TOSA-0.80+MI"),
)
.export()
.check_not(["torch.ops.quantized_decomposed"])
Expand Down Expand Up @@ -561,7 +561,7 @@ def _test_batchnorm2d_no_stats_tosa_MI_pipeline(
ArmTester(
module,
example_example_inputs=test_data,
compile_spec=common.get_tosa_compile_spec("TOSA-0.80.0+MI"),
compile_spec=common.get_tosa_compile_spec("TOSA-0.80+MI"),
)
.export()
.check_count({"torch.ops.aten._native_batch_norm_legit.no_stats": 1})
Expand Down Expand Up @@ -590,7 +590,7 @@ def _test_batchnorm2d_tosa_BI_pipeline(
ArmTester(
module,
example_inputs=test_data,
compile_spec=common.get_tosa_compile_spec("TOSA-0.80.0+BI"),
compile_spec=common.get_tosa_compile_spec("TOSA-0.80+BI"),
)
.quantize()
.export()
Expand Down
4 changes: 2 additions & 2 deletions backends/arm/test/ops/test_bmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def _test_bmm_tosa_MI_pipeline(
ArmTester(
module,
example_inputs=test_data,
compile_spec=common.get_tosa_compile_spec("TOSA-0.80.0+MI"),
compile_spec=common.get_tosa_compile_spec("TOSA-0.80+MI"),
)
.export()
.check_not(["torch.ops.quantized_decomposed"])
Expand All @@ -76,7 +76,7 @@ def _test_bmm_tosa_BI_pipeline(
ArmTester(
module,
example_inputs=test_data,
compile_spec=common.get_tosa_compile_spec("TOSA-0.80.0+BI"),
compile_spec=common.get_tosa_compile_spec("TOSA-0.80+BI"),
)
.quantize()
.export()
Expand Down
4 changes: 2 additions & 2 deletions backends/arm/test/ops/test_cat.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def _test_cat_tosa_MI_pipeline(
ArmTester(
module,
example_inputs=test_data,
compile_spec=common.get_tosa_compile_spec("TOSA-0.80.0+MI"),
compile_spec=common.get_tosa_compile_spec("TOSA-0.80+MI"),
)
.export()
.check_count({"torch.ops.aten.cat.default": 1})
Expand All @@ -75,7 +75,7 @@ def _test_cat_tosa_BI_pipeline(
ArmTester(
module,
example_inputs=test_data,
compile_spec=common.get_tosa_compile_spec("TOSA-0.80.0+BI"),
compile_spec=common.get_tosa_compile_spec("TOSA-0.80+BI"),
)
.quantize()
.export()
Expand Down
Loading
Loading