Skip to content

[ET-VK] Modernize permute op with safe indexing and unified dispatch#18510

Open
SS-JIA wants to merge 1 commit intogh/SS-JIA/509/basefrom
gh/SS-JIA/509/head
Open

[ET-VK] Modernize permute op with safe indexing and unified dispatch#18510
SS-JIA wants to merge 1 commit intogh/SS-JIA/509/basefrom
gh/SS-JIA/509/head

Conversation

@SS-JIA
Copy link
Contributor

@SS-JIA SS-JIA commented Mar 25, 2026

Stack from ghstack (oldest at bottom):

  • (to be filled)

Modernize the permute operator to follow current best practices, fixing an
Adreno 740 driver crash caused by dynamic UBO indexing in the texture shader.

Texture shader changes:

  • Replace old indexing_utils.h with indexing.glslh
  • Use TextureMetadata UBOs instead of push constant sizes
  • Use texture_pos_to_tensor4d_idx_simple() and related helpers
  • Replace permute_dims[out_packed_dim] with safe_idx() to avoid
    dynamic indexing of push constant with spec-const-derived index
  • Use TextureElementIndex pattern for the slow path

C++ dispatch changes:

  • Merge add_permute_node() and add_permute_buffer_node() into a single
    unified function using graph.meta_ubo() and conditional logic
  • Remove unused channel_info computation
  • Move WHCNPermuteDims struct into anonymous namespace
  • Guard texture path with VK_CHECK_COND(permute_ndim <= 4)

Differential Revision: D98220451

Modernize the permute operator to follow current best practices, fixing an
Adreno 740 driver crash caused by dynamic UBO indexing in the texture shader.

Texture shader changes:
- Replace old indexing_utils.h with indexing.glslh
- Use TextureMetadata UBOs instead of push constant sizes
- Use texture_pos_to_tensor4d_idx_simple() and related helpers
- Replace permute_dims[out_packed_dim] with safe_idx() to avoid
  dynamic indexing of push constant with spec-const-derived index
- Use TextureElementIndex pattern for the slow path

C++ dispatch changes:
- Merge add_permute_node() and add_permute_buffer_node() into a single
  unified function using graph.meta_ubo() and conditional logic
- Remove unused channel_info computation
- Move WHCNPermuteDims struct into anonymous namespace
- Guard texture path with VK_CHECK_COND(permute_ndim <= 4)

Differential Revision: [D98220451](https://our.internmc.facebook.com/intern/diff/D98220451/)

[ghstack-poisoned]
@pytorch-bot
Copy link

pytorch-bot bot commented Mar 25, 2026

🔗 Helpful Links

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

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

❌ 9 New Failures, 2 Unrelated Failures

As of commit 672416e with merge base 8f1b5ee (image):

NEW FAILURES - The following jobs have failed:

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 Mar 25, 2026
@github-actions
Copy link

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

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.

1 participant