Skip to content

[ET-VK][runtime] Fix channels-last buffer index decode above 4D - #25327

Merged
SS-JIA merged 1 commit into
gh/SS-JIA/739/origfrom
gh/SS-JIA/740/orig
Nov 20, 2026
Merged

SS-JIA merged 1 commit into
gh/SS-JIA/739/origfrom
gh/SS-JIA/740/orig

Conversation

@pytorchbot

Copy link
Copy Markdown
Collaborator

This PR was created by the merge bot to help merge the original PR into the main branch.
ghstack PR number: #25306 by @SS-JIA
^ Please use this as the source of truth for the PR details, comments, and reviews
ghstack PR base: https://github.com/pytorch/executorch/tree/gh/SS-JIA/740/base
ghstack PR head: https://github.com/pytorch/executorch/tree/gh/SS-JIA/740/head
Merge bot PR base: https://github.com/pytorch/executorch/tree/gh/SS-JIA/739/orig
Merge bot PR head: https://github.com/pytorch/executorch/tree/gh/SS-JIA/740/orig
Differential Revision: D133233613
@diff-train-skip-merge

Pull Request resolved: #25306

## Rationale

**What**: The channels-last fast path of `linear_idx_to_tensor_idx` now decodes dims 4-7 in their real dim order.

**Why**: It hard-coded the upper dim order as `(6, 5, 4, 7)`, but channels-packed buffers above 4D order those dims `(4, 5, 6, 7)`. When WHCN dims 4 and 5 are both larger than 1, dim 4 was decoded with the wrong stride. Both the scalar and vec4 buffer `permute` shaders use this path. For example, permuting `(2, 3, 2, 2, 5, 6)` by `(0, 1, 4, 2, 5, 3)` into a channels-packed buffer gave wrong outputs.

## Details

- Channels-last decode order (innermost first)
  - **Before**: `(2, 0, 1, 3, 6, 5, 4, 7)`
  - **After**: `(2, 0, 1, 3, 4, 5, 6, 7)`
- `cases.py` adds that 6D permute case with leading dim 2 to the buffer permute highdim suite.

Authored with Claude Code.

Differential Revision: [D133233613](https://our.internmc.facebook.com/intern/diff/D133233613/)
ghstack-source-id: 478906420
@pytorchbot
pytorchbot requested a review from SS-JIA as a code owner November 20, 2026 02:31
@pytorch-bot

pytorch-bot Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

⏳ No Failures, 81 Pending

As of commit eb4fa84 with merge base c29858d (image):
💚 Looks good so far! There are no failures yet. 💚

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 Nov 20, 2026
@SS-JIA
SS-JIA added this pull request to stack #25329 November 20, 2026 02:47
@SS-JIA
SS-JIA merged commit abfcd96 into main Nov 20, 2026
213 of 215 checks passed
@SS-JIA
SS-JIA deleted the gh/SS-JIA/740/orig branch November 20, 2026 02:48

This branch was previously deployed

1 inactive deployment
cadence — eb4fa84f Deployed Nov 20, 2026 by pytorchbot via hifi-op-test / hifi4 #39578
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants