Arm backend: Add test transpose count suite#19022
Open
AdrianLundell wants to merge 1 commit intopytorch:mainfrom
Open
Arm backend: Add test transpose count suite#19022AdrianLundell wants to merge 1 commit intopytorch:mainfrom
AdrianLundell wants to merge 1 commit intopytorch:mainfrom
Conversation
This gives a baseline of how many transposes are inserted in the graph for a number of important decompositions. Also updates test_high_rank_permute_view_invariants to use the same way of counting tranposes instead of a custom solution. Signed-off-by: Adrian Lundell <adrian.lundell@arm.com> Change-Id: I1610c21cf6090c6af38f8ab3cbb6c1042c48d975
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/19022
Note: Links to docs will display an error until the docs builds have been completed.
|
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new Arm-backend test suite to baseline how many TOSA TRANSPOSE ops are inserted for a range of decompositions and memory formats, and aligns an existing high-rank permute/view fuzz test with the same counting mechanism.
Changes:
- Introduce
test_transpose_counts.pywith a broad set of FP transpose-count baselines (including channels-last variants with targeted xfails). - Refactor
test_high_rank_permute_view_invariants.pyto usepipeline.count_tosa_ops()instead of custom.tosaartifact parsing.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| backends/arm/test/misc/test_transpose_counts.py | New transpose-count baseline suite for FP lowering (standard + channels-last cases). |
| backends/arm/test/misc/test_high_rank_permute_view_invariants.py | Switch high-rank permute/view fuzz test to the shared transpose-count mechanism and remove direct TOSA flatbuffer invariant parsing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| case.inputs, | ||
| aten_op=[], | ||
| ) | ||
| pipeline.count_tosa_ops({"TRANSPOSE": case.expected_transposes}) |
| "linear_rank4_channels_last": "DecomposeLinearPass: Tries inserting a view not supported in channels last format", | ||
| "matmul_rank4_channels_last": "ToTosaMemoryFormatPass: Tries inserting view not supported in channels last format", | ||
| "views_channels_last": "Torch.export: View not supported by torch.export in channels last format", | ||
| "cumsum_rank4_dim3_channels_last": "DecomposeCumssumPass: Tries inserting a view not supported in channels last format", |
Comment on lines
+174
to
186
| @common.parametrize("case", _build_high_rank_permute_cases()) | ||
| def test_transpose_invariants_tosa_INT_high_rank_permute_view( | ||
| case: TransposeInvariantCase, | ||
| ) -> None: | ||
| pipeline = TosaPipelineINT[InputT]( | ||
| case.module, | ||
| case.inputs, | ||
| aten_op=[], | ||
| exir_op=[], | ||
| run_on_tosa_ref_model=False, | ||
| custom_path=out_dir, | ||
| tosa_debug_mode=TosaCompileSpec.DebugMode.JSON, | ||
| tosa_extensions=["int16", "int4", "cf"], | ||
| ) | ||
| pipeline.count_tosa_ops({"TRANSPOSE": case.expected_transposes}) | ||
| pipeline.run() |
Comment on lines
+419
to
+423
| "cumsum_rank3_dim0": TransposeCountCase( | ||
| CumsumModule(), | ||
| (torch.randn(2, 3, 4), 1), | ||
| 0, | ||
| ), |
zingo
approved these changes
Apr 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This gives a baseline of how many transposes are inserted in the graph for a number of important decompositions.
Also updates test_high_rank_permute_view_invariants to use the same way of counting transposes instead of a custom solution.
cc @digantdesai @freddan80 @per @zingo @oscarandersson8218 @mansnils @Sebastian-Larsson @robell