Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
bc7349b
Update
GregoryComer Sep 5, 2025
223d5d6
Update
GregoryComer Sep 5, 2025
ed8a859
Update
GregoryComer Sep 5, 2025
774f59f
Update
GregoryComer Sep 5, 2025
51137cd
Update
GregoryComer Sep 5, 2025
4410ca1
Update
GregoryComer Sep 5, 2025
d6d1c31
Update
GregoryComer Sep 5, 2025
bdad6bb
Update
GregoryComer Sep 5, 2025
5d3597e
Update
GregoryComer Sep 5, 2025
6443b44
Update
GregoryComer Sep 5, 2025
f30b0bf
Update
GregoryComer Sep 5, 2025
db1e176
Update
GregoryComer Sep 10, 2025
1d00f65
Update
GregoryComer Sep 10, 2025
311e536
Update
GregoryComer Sep 10, 2025
26e4aaf
Update
GregoryComer Sep 10, 2025
5a156c9
Update
GregoryComer Sep 11, 2025
4e35585
Update
GregoryComer Sep 11, 2025
cfadc8b
Update
GregoryComer Sep 11, 2025
d8bde7d
Update
GregoryComer Sep 11, 2025
3cd1021
Update
GregoryComer Sep 11, 2025
cbe59e8
Update
GregoryComer Sep 11, 2025
f4e54ae
Update
GregoryComer Sep 11, 2025
c152b3f
Update
GregoryComer Sep 11, 2025
e670dfc
Update
GregoryComer Sep 11, 2025
6a55adc
Update
GregoryComer Sep 11, 2025
9235cfd
Update
GregoryComer Sep 11, 2025
569446d
Update
GregoryComer Sep 11, 2025
1233680
Update
GregoryComer Sep 11, 2025
d434f83
Update
GregoryComer Sep 11, 2025
a6181ef
Update
GregoryComer Sep 11, 2025
274a9b4
Update
GregoryComer Sep 11, 2025
bd5faf0
Update
GregoryComer Sep 11, 2025
4a50cab
Update
GregoryComer Sep 11, 2025
a00566c
Update
GregoryComer Sep 11, 2025
70ee95b
Update
GregoryComer Sep 11, 2025
8f42f77
Update
GregoryComer Sep 11, 2025
3b58d0f
Update
GregoryComer Sep 11, 2025
e72370f
Update
GregoryComer Sep 13, 2025
9a8b717
Update
GregoryComer Sep 13, 2025
c2e85c0
Update
GregoryComer Sep 13, 2025
f3218ac
Update
GregoryComer Sep 13, 2025
e72553e
Update
GregoryComer Sep 13, 2025
7b79d5a
Update
GregoryComer Sep 13, 2025
48ee73d
Update
GregoryComer Sep 13, 2025
0fedd15
Update
GregoryComer Sep 13, 2025
b5c85f7
Update
GregoryComer Sep 16, 2025
88dc7d0
Update
GregoryComer Sep 16, 2025
6b9c467
Update
GregoryComer Sep 16, 2025
e2e063c
Update
GregoryComer Sep 16, 2025
4834225
Update
GregoryComer Sep 16, 2025
cccedfe
Update
GregoryComer Sep 16, 2025
8581f01
Update
GregoryComer Sep 16, 2025
d0afba5
Update
GregoryComer Sep 16, 2025
cb729cc
Update
GregoryComer Sep 16, 2025
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
7 changes: 6 additions & 1 deletion .ci/scripts/test_backend_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,17 @@ if [[ "$FLOW" == *qnn* ]]; then
fi

if [[ "$FLOW" == *vulkan* ]]; then
# Setup swiftshader and Vulkan SDK which are required to build the Vulkan delegate
# Setup swiftshader and Vulkan SDK which are required to build the Vulkan delegate.
source .ci/scripts/setup-vulkan-linux-deps.sh

EXTRA_BUILD_ARGS+=" -DEXECUTORCH_BUILD_VULKAN=ON"
fi

if [[ "$FLOW" == *arm* ]]; then
# Setup ARM deps.
.ci/scripts/setup-arm-baremetal-tools.sh
fi

# We need the runner to test the built library.
PYTHON_EXECUTABLE=python CMAKE_ARGS="$EXTRA_BUILD_ARGS" .ci/scripts/setup-linux.sh --build-tool cmake --build-mode Release --editable true

Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/_test_backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ on:
required: false
type: boolean
default: false
runner-linux:
description: 'Runner type for Linux jobs'
required: false
type: string
default: linux.4xlarge.memory

jobs:
test-backend-linux:
Expand All @@ -44,7 +49,7 @@ jobs:
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
with:
ref: ${{ inputs.ref }}
runner: linux.4xlarge.memory
runner: ${{ inputs.runner-linux }}
docker-image: ci-image:executorch-ubuntu-22.04-clang12
submodules: recursive
timeout: ${{ inputs.timeout }}
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/test-backend-arm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Test ARM Backend

on:
schedule:
- cron: 0 2 * * *
push:
tags:
- ciflow/nightly/*
pull_request:
paths:
- .github/workflows/test-backend-arm.yml
- .github/workflows/_test_backend.yml
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}--${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}
cancel-in-progress: true

jobs:
test-arm:
uses: ./.github/workflows/_test_backend.yml
with:
backend: arm
flows: '["arm_tosa"]'
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
timeout: 120
run-linux: true
1 change: 1 addition & 0 deletions .github/workflows/test-backend-qnn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ jobs:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
timeout: 120
run-linux: true
runner-linux: linux.8xlarge.memory
16 changes: 14 additions & 2 deletions backends/arm/test/tester/arm_tester.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@

from executorch.backends.arm.vgf import VgfCompileSpec, VgfPartitioner

from executorch.backends.test.harness.error_statistics import ErrorStatistics
from executorch.backends.test.harness.stages import Stage, StageType
from executorch.backends.xnnpack.test.tester import Tester
from executorch.devtools.backend_debug import get_delegation_info
Expand Down Expand Up @@ -333,6 +334,7 @@ def to_edge_transform_and_lower(
transform_passes: Optional[
Union[Sequence[PassType], Dict[str, Sequence[PassType]]]
] = None,
generate_etrecord: bool = False,
):
if transform_passes is not None:
raise RuntimeError(
Expand Down Expand Up @@ -367,7 +369,9 @@ def to_edge_transform_and_lower(
to_edge_and_lower_stage.partitioners = partitioners
if edge_compile_config is not None:
to_edge_and_lower_stage.edge_compile_conf = edge_compile_config
return super().to_edge_transform_and_lower(to_edge_and_lower_stage)
return super().to_edge_transform_and_lower(
to_edge_and_lower_stage, generate_etrecord=generate_etrecord
)

def to_executorch(self, to_executorch_stage: Optional[ToExecutorch] | None = None):
if to_executorch_stage is None:
Expand Down Expand Up @@ -402,6 +406,7 @@ def run_method_and_compare_outputs(
qtol=0,
error_callbacks=None,
run_eager_mode=False,
statistics_callback: Callable[[ErrorStatistics], None] | None = None,
):
"""
Compares the run_artifact output of 'stage' with the output of a reference stage.
Expand Down Expand Up @@ -657,10 +662,17 @@ def _compare_outputs(
rtol=1e-03,
qtol=0,
error_callbacks=None,
statistics_callback: Callable[[ErrorStatistics], None] | None = None,
):
try:
super()._compare_outputs(
reference_output, stage_output, quantization_scale, atol, rtol, qtol
reference_output,
stage_output,
quantization_scale,
atol,
rtol,
qtol,
statistics_callback=statistics_callback,
)
except AssertionError as e:
if error_callbacks is None:
Expand Down
12 changes: 12 additions & 0 deletions backends/test/suite/flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ class TestFlow:
skip_patterns: list[str] = field(default_factory=lambda: [])
""" Tests with names containing any substrings in this list are skipped. """

supports_serialize: bool = True
""" True if the test flow supports the Serialize stage. """

def should_skip_test(self, test_name: str) -> bool:
return any(pattern in test_name for pattern in self.skip_patterns)

Expand Down Expand Up @@ -115,4 +118,13 @@ def all_flows() -> dict[str, TestFlow]:
except Exception as e:
logger.info(f"Skipping QNN flow registration: {e}")

try:
from executorch.backends.test.suite.flows.arm import ARM_TOSA_FLOW

flows += [
ARM_TOSA_FLOW,
]
except Exception as e:
logger.info(f"Skipping ARM flow registration: {e}")

return {f.name: f for f in flows if f is not None}
24 changes: 24 additions & 0 deletions backends/test/suite/flows/arm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
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


def _create_arm_tester_tosa_fp(*args, **kwargs) -> ArmTester:
kwargs["compile_spec"] = common.get_tosa_compile_spec(tosa_spec="TOSA-1.0+FP")

return ArmTester(
*args,
**kwargs,
)


def _create_tosa_flow() -> TestFlow:
return TestFlow(
"arm_tosa",
backend="arm",
tester_factory=_create_arm_tester_tosa_fp,
supports_serialize=False,
)


ARM_TOSA_FLOW = _create_tosa_flow()
29 changes: 26 additions & 3 deletions backends/test/suite/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
UNSUPPORTED_PORTABLE_OPS = {
"aten::_embedding_bag",
"aten::_adaptive_avg_pool2d",
"aten::adaptive_max_pool2d",
"aten::median",
"aten::median.dim",
"aten::round.decimals",
Expand All @@ -34,6 +35,7 @@
TestResult,
)
from executorch.exir import EdgeProgramManager
from executorch.exir.dialects._ops import ops as exir_ops


# A list of all runnable test suites and the corresponding python package.
Expand All @@ -43,6 +45,24 @@
}


def _graph_has_unsupported_patterns(program: torch.export.ExportedProgram) -> bool:
# Returns true if the model contains patterns that will fail when running on the ET
# portable kernel library.

# Check for 3d convolutions. All convs (1d, 2d, 3d) use the same op, so we need to look at
# the input meta to determine the rank.
for node in program.graph.nodes:
if (
node.op == "call_function"
and node.target == exir_ops.edge.aten.convolution.default
):
in_rank = node.args[0].meta["val"].dim()
if in_rank != 4:
return True

return False


def _get_test_seed(test_base_name: str) -> int:
# Set the seed based on the test base name to give consistent inputs between backends. Add the
# run seed to allow for reproducible results, but still allow for run-to-run variation.
Expand Down Expand Up @@ -162,7 +182,7 @@ def build_result(
# Check if any undelegated ops are in the unsupported ops set.
has_unsupported_ops = any(
op in UNSUPPORTED_PORTABLE_OPS for op in undelegated_op_counts.keys()
)
) or _graph_has_unsupported_patterns(edge_manager._etrecord.edge_dialect_program)

# Skip the test if there are unsupported portable ops remaining.
if has_unsupported_ops:
Expand All @@ -171,8 +191,11 @@ def build_result(
# Only run the runtime portion if something was delegated (or the flow doesn't delegate)
if is_delegated or not flow.is_delegated:
try:
tester.to_executorch().serialize()
extra_stats["pte_size_bytes"] = len(tester.get_artifact())
tester.to_executorch()

if flow.supports_serialize:
tester.serialize()
extra_stats["pte_size_bytes"] = len(tester.get_artifact())
except Exception as e:
# We could introduce a result value for this, but I'm not sure it's necessary.
# We can do this if we ever see to_executorch() or serialize() fail due a backend issue.
Expand Down
Loading