Skip to content

Commit 426b701

Browse files
authored
Arm backend: Backend test TOSA FP, INT and Ethos-U55/U85 (pytorch#14653)
### Summary Create arm_ethos_u55 and arm_ethos_u85 test flows and add them to CI Build a semihosted runner for testing on the Corstone3x0 FVP And split the arm_tosa test job that tested TOSA-1.0+FP into arm_tosa_fp and arm_tosa_int to also test TOSA-1.0+INT ### Test plan This will add new tests for arm_tosa_int arm_ethos_u55 and arm_ethos_u85 cc @digantdesai @freddan80 @per @oscarandersson8218 --------- Signed-off-by: Zingo Andersen <[email protected]>
1 parent b1309e7 commit 426b701

File tree

4 files changed

+81
-13
lines changed

4 files changed

+81
-13
lines changed

.ci/scripts/test_backend.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env bash
22
# Copyright (c) Meta Platforms, Inc. and affiliates.
33
# All rights reserved.
4+
# Copyright 2025 Arm Limited and/or its affiliates.
45
#
56
# This source code is licensed under the BSD-style license found in the
67
# LICENSE file in the root directory of this source tree.
@@ -58,6 +59,12 @@ fi
5859
if [[ "$FLOW" == *arm* ]]; then
5960
# Setup ARM deps.
6061
.ci/scripts/setup-arm-baremetal-tools.sh
62+
63+
if [[ "$FLOW" == *ethos_u* ]]; then
64+
# Prepare a test runner binary that can run on the Corstone-3x0 FVPs
65+
backends/arm/scripts/build_executorch.sh
66+
backends/arm/test/setup_testing.sh
67+
fi
6168
fi
6269

6370
if [[ $IS_MACOS -eq 1 ]]; then

.github/workflows/test-backend-arm.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
uses: ./.github/workflows/_test_backend.yml
2424
with:
2525
backend: arm
26-
flows: '["arm_tosa"]'
26+
flows: '["arm_tosa_fp", "arm_tosa_int", "arm_ethos_u55", "arm_ethos_u85"]'
2727
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
2828
timeout: 120
2929
run-linux: true

backends/test/suite/flow.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# Copyright 2025 Arm Limited and/or its affiliates.
2+
#
3+
# This source code is licensed under the BSD-style license found in the
4+
# LICENSE file in the root directory of this source tree.
5+
16
import logging
27

38
from dataclasses import dataclass, field
@@ -122,10 +127,18 @@ def all_flows() -> dict[str, TestFlow]:
122127
logger.info(f"Skipping QNN flow registration: {e}")
123128

124129
try:
125-
from executorch.backends.test.suite.flows.arm import ARM_TOSA_FLOW
130+
from executorch.backends.test.suite.flows.arm import (
131+
ARM_ETHOS_U55_FLOW,
132+
ARM_ETHOS_U85_FLOW,
133+
ARM_TOSA_FP_FLOW,
134+
ARM_TOSA_INT_FLOW,
135+
)
126136

127137
flows += [
128-
ARM_TOSA_FLOW,
138+
ARM_TOSA_FP_FLOW,
139+
ARM_TOSA_INT_FLOW,
140+
ARM_ETHOS_U55_FLOW,
141+
ARM_ETHOS_U85_FLOW,
129142
]
130143
except Exception as e:
131144
logger.info(f"Skipping ARM flow registration: {e}")

backends/test/suite/flows/arm.py

Lines changed: 58 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,72 @@
1+
# Copyright 2025 Arm Limited and/or its affiliates.
2+
#
3+
# This source code is licensed under the BSD-style license found in the
4+
# LICENSE file in the root directory of this source tree.
5+
6+
7+
from executorch.backends.arm.quantizer import (
8+
get_symmetric_quantization_config,
9+
TOSAQuantizer,
10+
)
111
from executorch.backends.arm.test import common
212
from executorch.backends.arm.test.tester.arm_tester import ArmTester
313
from executorch.backends.test.suite.flow import TestFlow
14+
from executorch.backends.xnnpack.test.tester.tester import Quantize
415

516

6-
def _create_arm_tester_tosa_fp(*args, **kwargs) -> ArmTester:
7-
kwargs["compile_spec"] = common.get_tosa_compile_spec(tosa_spec="TOSA-1.0+FP")
17+
def _create_tosa_flow(
18+
name,
19+
compile_spec,
20+
quantize: bool = False,
21+
symmetric_io_quantization: bool = False,
22+
per_channel_quantization: bool = True,
23+
) -> TestFlow:
824

9-
return ArmTester(
10-
*args,
11-
**kwargs,
12-
)
25+
def _create_arm_tester(*args, **kwargs) -> ArmTester:
26+
kwargs["compile_spec"] = compile_spec
1327

28+
return ArmTester(
29+
*args,
30+
**kwargs,
31+
)
32+
33+
# Create and configure quantizer to use in the flow
34+
def create_quantize_stage() -> Quantize:
35+
quantizer = TOSAQuantizer(compile_spec)
36+
quantization_config = get_symmetric_quantization_config(
37+
is_per_channel=per_channel_quantization
38+
)
39+
if symmetric_io_quantization:
40+
quantizer.set_io(quantization_config)
41+
return Quantize(quantizer, quantization_config)
1442

15-
def _create_tosa_flow() -> TestFlow:
1643
return TestFlow(
17-
"arm_tosa",
44+
name,
1845
backend="arm",
19-
tester_factory=_create_arm_tester_tosa_fp,
46+
tester_factory=_create_arm_tester,
2047
supports_serialize=False,
48+
quantize=quantize,
49+
quantize_stage_factory=create_quantize_stage if quantize else None,
2150
)
2251

2352

24-
ARM_TOSA_FLOW = _create_tosa_flow()
53+
ARM_TOSA_FP_FLOW = _create_tosa_flow(
54+
"arm_tosa_fp", common.get_tosa_compile_spec(tosa_spec="TOSA-1.0+FP")
55+
)
56+
ARM_TOSA_INT_FLOW = _create_tosa_flow(
57+
"arm_tosa_int",
58+
common.get_tosa_compile_spec(tosa_spec="TOSA-1.0+INT"),
59+
quantize=True,
60+
)
61+
62+
ARM_ETHOS_U55_FLOW = _create_tosa_flow(
63+
"arm_ethos_u55",
64+
common.get_u55_compile_spec(),
65+
quantize=True,
66+
)
67+
68+
ARM_ETHOS_U85_FLOW = _create_tosa_flow(
69+
"arm_ethos_u85",
70+
common.get_u85_compile_spec(),
71+
quantize=True,
72+
)

0 commit comments

Comments
 (0)