Skip to content

[ET-VK] Insert prepack nodes for constant primary inputs of prepacking ops#17863

Merged
SS-JIA merged 1 commit into
gh/SS-JIA/458/origfrom
gh/SS-JIA/459/orig
Mar 5, 2026
Merged

[ET-VK] Insert prepack nodes for constant primary inputs of prepacking ops#17863
SS-JIA merged 1 commit into
gh/SS-JIA/458/origfrom
gh/SS-JIA/459/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: #17850 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/459/base
ghstack PR head: https://github.com/pytorch/executorch/tree/gh/SS-JIA/459/head
Merge bot PR base: https://github.com/pytorch/executorch/tree/gh/SS-JIA/458/orig
Merge bot PR head: https://github.com/pytorch/executorch/tree/gh/SS-JIA/459/orig
Differential Revision: D95217949
@diff-train-skip-merge

…g ops

The insert_prepack_nodes pass was skipping prepack node insertion for all
constant tensor args of ops with supports_prepacking=True. However, these ops
only handle prepacking for weight/bias tensors internally; the primary input
tensor is still expected to be a GPU tensor. If the primary input happens to be
a constant tensor (serialized as TensorRef), the op throws an exception at
runtime.

Fix this by detecting the primary input index directly in insert_prepack_nodes.
Most prepacking ops have the primary input at arg 0, but embedding uses arg 1
since its signature is embedding(weight, indices, ...). The pass now checks
whether a constant tensor is used as the primary input of a prepacking op, and
if so, still inserts a prepack node for it.

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

ghstack-source-id: 347411473
Pull Request resolved: #17850
@pytorchbot pytorchbot requested a review from SS-JIA as a code owner March 4, 2026 23:44
@pytorch-bot

pytorch-bot Bot commented Mar 4, 2026

Copy link
Copy Markdown

🔗 Helpful Links

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

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

⏳ No Failures, 104 Pending

As of commit 5217b17 with merge base 1a75394 (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 Mar 4, 2026
@SS-JIA SS-JIA merged commit e63306d into gh/SS-JIA/458/orig Mar 5, 2026
206 of 217 checks passed
@SS-JIA SS-JIA deleted the gh/SS-JIA/459/orig branch March 5, 2026 00:28
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