From 23da52c5d8704fd9e118561ca2d5626f9cfce139 Mon Sep 17 00:00:00 2001 From: Zingo Andersen Date: Thu, 25 Sep 2025 11:55:41 +0200 Subject: [PATCH 1/2] 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 Change-Id: I4a265e5fed84f1f3fa4a0088ec797c09cc416ee6 --- .github/workflows/test-backend-arm.yml | 2 +- backends/test/suite/flow.py | 13 +++++- backends/test/suite/flows/arm.py | 56 +++++++++++++++++++++----- 3 files changed, 58 insertions(+), 13 deletions(-) diff --git a/.github/workflows/test-backend-arm.yml b/.github/workflows/test-backend-arm.yml index bee74fee172..5bddba22f06 100644 --- a/.github/workflows/test-backend-arm.yml +++ b/.github/workflows/test-backend-arm.yml @@ -23,7 +23,7 @@ jobs: uses: ./.github/workflows/_test_backend.yml with: backend: arm - flows: '["arm_tosa"]' + flows: '["arm_tosa_fp", "arm_tosa_int"]' ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} timeout: 120 run-linux: true diff --git a/backends/test/suite/flow.py b/backends/test/suite/flow.py index 05fc760683d..ab9ade8d63e 100644 --- a/backends/test/suite/flow.py +++ b/backends/test/suite/flow.py @@ -1,3 +1,8 @@ +# Copyright 2025 Arm Limited and/or its affiliates. +# +# This source code is licensed under the BSD-style license found in the +# LICENSE file in the root directory of this source tree. + import logging from dataclasses import dataclass, field @@ -122,10 +127,14 @@ def all_flows() -> dict[str, TestFlow]: logger.info(f"Skipping QNN flow registration: {e}") try: - from executorch.backends.test.suite.flows.arm import ARM_TOSA_FLOW + from executorch.backends.test.suite.flows.arm import ( + ARM_TOSA_FP_FLOW, + ARM_TOSA_INT_FLOW, + ) flows += [ - ARM_TOSA_FLOW, + ARM_TOSA_FP_FLOW, + ARM_TOSA_INT_FLOW, ] except Exception as e: logger.info(f"Skipping ARM flow registration: {e}") diff --git a/backends/test/suite/flows/arm.py b/backends/test/suite/flows/arm.py index baa2df79de9..f6b3a3aea38 100644 --- a/backends/test/suite/flows/arm.py +++ b/backends/test/suite/flows/arm.py @@ -1,24 +1,60 @@ +# Copyright 2025 Arm Limited and/or its affiliates. +# +# This source code is licensed under the BSD-style license found in the +# LICENSE file in the root directory of this source tree. + + +from executorch.backends.arm.quantizer import ( + get_symmetric_quantization_config, + TOSAQuantizer, +) from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.arm_tester import ArmTester from executorch.backends.test.suite.flow import TestFlow +from executorch.backends.xnnpack.test.tester.tester import Quantize -def _create_arm_tester_tosa_fp(*args, **kwargs) -> ArmTester: - kwargs["compile_spec"] = common.get_tosa_compile_spec(tosa_spec="TOSA-1.0+FP") +def _create_tosa_flow( + name, + compile_spec, + quantize: bool = False, + symmetric_io_quantization: bool = False, + per_channel_quantization: bool = True, +) -> TestFlow: - return ArmTester( - *args, - **kwargs, - ) + def _create_arm_tester(*args, **kwargs) -> ArmTester: + kwargs["compile_spec"] = compile_spec + + return ArmTester( + *args, + **kwargs, + ) + # Create and configure quantizer to use in the flow + def create_quantize_stage() -> Quantize: + quantizer = TOSAQuantizer(compile_spec) + quantization_config = get_symmetric_quantization_config( + is_per_channel=per_channel_quantization + ) + if symmetric_io_quantization: + quantizer.set_io(quantization_config) + return Quantize(quantizer, quantization_config) -def _create_tosa_flow() -> TestFlow: return TestFlow( - "arm_tosa", + name, backend="arm", - tester_factory=_create_arm_tester_tosa_fp, + tester_factory=_create_arm_tester, supports_serialize=False, + quantize=quantize, + quantize_stage_factory=create_quantize_stage if quantize else None, ) -ARM_TOSA_FLOW = _create_tosa_flow() +ARM_TOSA_FP_FLOW = _create_tosa_flow( + "arm_tosa_fp", common.get_tosa_compile_spec(tosa_spec="TOSA-1.0+FP") +) +ARM_TOSA_INT_FLOW = _create_tosa_flow( + "arm_tosa_int", + common.get_tosa_compile_spec(tosa_spec="TOSA-1.0+INT"), + quantize=True, +) From 7ff0cb7c16a7ceadebb2a7bcf6ae63df84f0a93e Mon Sep 17 00:00:00 2001 From: Zingo Andersen Date: Mon, 29 Sep 2025 13:14:43 +0200 Subject: [PATCH 2/2] Arm backend: Backend test Ethos-U55/Ethos-U85 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 Signed-off-by: Zingo Andersen Change-Id: Icbbbf8a5e796071482a8ad0de290fbaef61e0b04 --- .ci/scripts/test_backend.sh | 7 +++++++ .github/workflows/test-backend-arm.yml | 2 +- backends/test/suite/flow.py | 4 ++++ backends/test/suite/flows/arm.py | 12 ++++++++++++ 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/.ci/scripts/test_backend.sh b/.ci/scripts/test_backend.sh index df98fb43372..ba5df5c3fe3 100755 --- a/.ci/scripts/test_backend.sh +++ b/.ci/scripts/test_backend.sh @@ -1,6 +1,7 @@ #!/usr/bin/env bash # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. +# Copyright 2025 Arm Limited and/or its affiliates. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. @@ -58,6 +59,12 @@ fi if [[ "$FLOW" == *arm* ]]; then # Setup ARM deps. .ci/scripts/setup-arm-baremetal-tools.sh + + if [[ "$FLOW" == *ethos_u* ]]; then + # Prepare a test runner binary that can run on the Corstone-3x0 FVPs + backends/arm/scripts/build_executorch.sh + backends/arm/test/setup_testing.sh + fi fi if [[ $IS_MACOS -eq 1 ]]; then diff --git a/.github/workflows/test-backend-arm.yml b/.github/workflows/test-backend-arm.yml index 5bddba22f06..428e3fd1239 100644 --- a/.github/workflows/test-backend-arm.yml +++ b/.github/workflows/test-backend-arm.yml @@ -23,7 +23,7 @@ jobs: uses: ./.github/workflows/_test_backend.yml with: backend: arm - flows: '["arm_tosa_fp", "arm_tosa_int"]' + flows: '["arm_tosa_fp", "arm_tosa_int", "arm_ethos_u55", "arm_ethos_u85"]' ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} timeout: 120 run-linux: true diff --git a/backends/test/suite/flow.py b/backends/test/suite/flow.py index ab9ade8d63e..29394951bd7 100644 --- a/backends/test/suite/flow.py +++ b/backends/test/suite/flow.py @@ -128,6 +128,8 @@ def all_flows() -> dict[str, TestFlow]: try: from executorch.backends.test.suite.flows.arm import ( + ARM_ETHOS_U55_FLOW, + ARM_ETHOS_U85_FLOW, ARM_TOSA_FP_FLOW, ARM_TOSA_INT_FLOW, ) @@ -135,6 +137,8 @@ def all_flows() -> dict[str, TestFlow]: flows += [ ARM_TOSA_FP_FLOW, ARM_TOSA_INT_FLOW, + ARM_ETHOS_U55_FLOW, + ARM_ETHOS_U85_FLOW, ] except Exception as e: logger.info(f"Skipping ARM flow registration: {e}") diff --git a/backends/test/suite/flows/arm.py b/backends/test/suite/flows/arm.py index f6b3a3aea38..34a6346fb1f 100644 --- a/backends/test/suite/flows/arm.py +++ b/backends/test/suite/flows/arm.py @@ -58,3 +58,15 @@ def create_quantize_stage() -> Quantize: common.get_tosa_compile_spec(tosa_spec="TOSA-1.0+INT"), quantize=True, ) + +ARM_ETHOS_U55_FLOW = _create_tosa_flow( + "arm_ethos_u55", + common.get_u55_compile_spec(), + quantize=True, +) + +ARM_ETHOS_U85_FLOW = _create_tosa_flow( + "arm_ethos_u85", + common.get_u85_compile_spec(), + quantize=True, +)