Arm backend: Add dim mapping helpers#20222
Conversation
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
🔗 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 FailuresAs of commit cb08a9e with merge base 7d365ec ( 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. |
There was a problem hiding this comment.
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
ViewMapto map reduction/permutation dims acrossview(via grouped prime-factor tracking, with limited SymInt support). - Add
PermuteMapto map dims acrosspermute. - 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.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Adrian Lundell <adrian.lundell@arm.com> Change-Id: I8d9c4344890fb0ef59fef68c4b51803bc6d58fc9
|
Arm fails is the unrelated fp8 issue from main. |
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