Arm backend: Add test transpose count suite#19022
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. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below:
|
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", |
| @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() |
| "cumsum_rank3_dim0": TransposeCountCase( | ||
| CumsumModule(), | ||
| (torch.randn(2, 3, 4), 1), | ||
| 0, | ||
| ), |
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