-
Notifications
You must be signed in to change notification settings - Fork 670
[Backend Tester] Add ARM TOSA flow #14190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
bc7349b
223d5d6
ed8a859
774f59f
51137cd
4410ca1
d6d1c31
bdad6bb
5d3597e
6443b44
f30b0bf
db1e176
1d00f65
311e536
26e4aaf
5a156c9
4e35585
cfadc8b
d8bde7d
3cd1021
f4e54ae
c152b3f
e670dfc
6a55adc
9235cfd
569446d
1233680
a6181ef
274a9b4
bd5faf0
4a50cab
a00566c
70ee95b
8f42f77
e72370f
9a8b717
c2e85c0
f3218ac
e72553e
7b79d5a
48ee73d
b5c85f7
88dc7d0
6b9c467
e2e063c
4834225
8581f01
d0afba5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 |
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() |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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", | ||
|
@@ -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. | ||
|
@@ -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. | ||
|
@@ -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: | ||
|
@@ -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: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ARM tester requires a compile spec giving a location to dump the artifact. I'm just skipping this for initial integration, but we can wire this up as a follow-up. I'm not sure how meaningful the binary size for the TOSA flow, as well. Is that something we should report? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah we can ignore binary size for TOSA-only flows |
||
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. | ||
|
Uh oh!
There was an error while loading. Please reload this page.