Skip to content

Arm backend: Add dim mapping helpers#20222

Merged
AdrianLundell merged 3 commits into
pytorch:mainfrom
AdrianLundell:change-1271418
Jun 12, 2026
Merged

Arm backend: Add dim mapping helpers#20222
AdrianLundell merged 3 commits into
pytorch:mainfrom
AdrianLundell:change-1271418

Conversation

@AdrianLundell

@AdrianLundell AdrianLundell commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Dim args such as sum(dim=1) needs to be transformed when swapping place with operators which change
shape, i.e. permutes and views.

ViewMap and PermuteMap handles and validates these transforms for reduction dims and permute dims.

cc @digantdesai @freddan80 @per @zingo @oscarandersson8218 @mansnils @Sebastian-Larsson @robell @rascani

Dim args such as sum(dim=1) needs to be transformed
when swapping place with operators which change
shape, i.e. permutes and views.

ViewMap and PermuteMap handles and validates these
transforms for reduction dims and permute dims.

Signed-off-by: Adrian Lundell <adrian.lundell@arm.com>
Change-Id: I634f4494df37294d4ac3397f8457bedfd20f5830
Copilot AI review requested due to automatic review settings June 11, 2026 17:09
@AdrianLundell AdrianLundell added partner: arm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Arm release notes: none Do not include this in the release notes labels Jun 11, 2026
@pytorch-bot

pytorch-bot Bot commented Jun 11, 2026

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/20222

Note: Links to docs will display an error until the docs builds have been completed.

❌ 2 New Failures, 22 Pending, 1 Unrelated Failure, 2 Unclassified Failures

As of commit cb08a9e with merge base 7d365ec (image):

NEW FAILURES - The following jobs have failed:

UNCLASSIFIED FAILURES - DrCI could not classify the following jobs because the workflow did not run on the merge base. The failures may be pre-existing on trunk or introduced by this PR:

FLAKY - The following job failed but was likely due to flakiness present on trunk:

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 Jun 11, 2026
@github-actions github-actions Bot added ciflow/trunk module: arm Issues related to arm backend labels Jun 11, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces dimension-mapping helpers for the Arm backend to transform reduction/permutation dimension arguments correctly when commuting shape-changing ops (notably view and permute). It also adds a dedicated test suite covering mapping behavior, including symbolic dims.

Changes:

  • Add ViewMap to map reduction/permutation dims across view (via grouped prime-factor tracking, with limited SymInt support).
  • Add PermuteMap to map dims across permute.
  • Add extensive unit tests (including randomized/bruteforce checks and SymInt cases) for the new mapping helpers.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
backends/arm/_passes/dim_maps.py Implements ViewMap/PermuteMap utilities for mapping dims across view/permute.
backends/arm/test/passes/test_dim_maps.py Adds tests validating mapping behavior vs. identities and bruteforce enumeration, including SymInt coverage.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread backends/arm/_passes/dim_maps.py Outdated
Comment thread backends/arm/_passes/dim_maps.py Outdated
Comment thread backends/arm/_passes/dim_maps.py
Comment thread backends/arm/_passes/dim_maps.py Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

Comment thread backends/arm/_passes/dim_maps.py
Comment thread backends/arm/_passes/dim_maps.py
Comment thread backends/arm/_passes/dim_maps.py
Comment thread backends/arm/_passes/dim_maps.py
Comment thread backends/arm/_passes/dim_maps.py
Signed-off-by: Adrian Lundell <adrian.lundell@arm.com>
Change-Id: I8d9c4344890fb0ef59fef68c4b51803bc6d58fc9
@AdrianLundell

Copy link
Copy Markdown
Collaborator Author

Arm fails is the unrelated fp8 issue from main.

@AdrianLundell AdrianLundell merged commit 80a9550 into pytorch:main Jun 12, 2026
482 of 490 checks passed
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 partner: arm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Arm 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