Skip to content

Arm backend: Add test transpose count suite#19022

Open
AdrianLundell wants to merge 1 commit intopytorch:mainfrom
AdrianLundell:change-1212004
Open

Arm backend: Add test transpose count suite#19022
AdrianLundell wants to merge 1 commit intopytorch:mainfrom
AdrianLundell:change-1212004

Conversation

@AdrianLundell
Copy link
Copy Markdown
Collaborator

@AdrianLundell AdrianLundell commented Apr 21, 2026

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

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
Copilot AI review requested due to automatic review settings April 21, 2026 14:18
@AdrianLundell AdrianLundell added the module: arm Issues related to arm backend label Apr 21, 2026
@AdrianLundell AdrianLundell added the release notes: none Do not include this in the release notes label Apr 21, 2026
@pytorch-bot
Copy link
Copy Markdown

pytorch-bot Bot commented Apr 21, 2026

🔗 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 Awaiting Approval, 1 Pending, 6 Unrelated Failures

As of commit 98a1a7c with merge base ccaf17e (image):

AWAITING APPROVAL - The following workflow needs approval before CI can run:

BROKEN TRUNK - The following jobs failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 21, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.py with a broad set of FP transpose-count baselines (including channels-last variants with targeted xfails).
  • Refactor test_high_rank_permute_view_invariants.py to use pipeline.count_tosa_ops() instead of custom .tosa artifact 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,
),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. module: arm Issues related to arm backend release notes: none Do not include this in the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants