Skip to content

Commit 78dd8eb

Browse files
committed
Arm backend: Backend test both TOSA FP and TOSA INT
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 Signed-off-by: Zingo Andersen <[email protected]> Change-Id: I4a265e5fed84f1f3fa4a0088ec797c09cc416ee6
1 parent 4622edb commit 78dd8eb

File tree

3 files changed

+58
-13
lines changed

3 files changed

+58
-13
lines changed

.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"]'
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: 11 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
@@ -119,10 +124,14 @@ def all_flows() -> dict[str, TestFlow]:
119124
logger.info(f"Skipping QNN flow registration: {e}")
120125

121126
try:
122-
from executorch.backends.test.suite.flows.arm import ARM_TOSA_FLOW
127+
from executorch.backends.test.suite.flows.arm import (
128+
ARM_TOSA_FP_FLOW,
129+
ARM_TOSA_INT_FLOW,
130+
)
123131

124132
flows += [
125-
ARM_TOSA_FLOW,
133+
ARM_TOSA_FP_FLOW,
134+
ARM_TOSA_INT_FLOW,
126135
]
127136
except Exception as e:
128137
logger.info(f"Skipping ARM flow registration: {e}")

backends/test/suite/flows/arm.py

Lines changed: 46 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,60 @@
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
27+
28+
return ArmTester(
29+
*args,
30+
**kwargs,
31+
)
1332

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+
)

0 commit comments

Comments
 (0)