Skip to content

[ExecuTorch][WebGPU] Preserve Linear and Q4 embedding params across dynamic resize - #21482

Closed
JCNTH wants to merge 1 commit into
gh/JCNTH/202/basefrom
gh/JCNTH/202/head
Closed

[ExecuTorch][WebGPU] Preserve Linear and Q4 embedding params across dynamic resize#21482
JCNTH wants to merge 1 commit into
gh/JCNTH/202/basefrom
gh/JCNTH/202/head

Conversation

@JCNTH

@JCNTH JCNTH commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

Preserve immutable Linear and Q4 embedding shader controls across dynamic resize through typed parameter authorities.

Problem
The Linear resize hook dropped has_bias, and the Q4 embedding resize path could drop is_linear_weight. Both defects produced correct build-time outputs but silently changed semantics after a live shape update.

Solution

  • Before: build and resize populated control words independently, allowing immutable shader state to reset.
  • After: each build/resize pair calls one typed helper while recomputing only live counts and dispatch.

Implementation

  • Linear.cpp — make_linear_params preserves the bias flag across vec4 and tiled routes.
  • EmbeddingQ4gsw.cpp — EmbeddingLayout and make_embedding_params preserve nibble layout across resize.
  • Mirrors Vulkan runtime/graph/ops/impl/Linear.cpp and EmbeddingQ4gsw.cpp, which carry immutable shader controls through dynamic dispatch.

Constraints
WGSL bytes, shader selection, bindings, uniform sizes, queue-write counts, dispatch formulas, and pipeline topology are unchanged. Production handler code is smaller because duplicated field population and scalar captures are removed.

Co-authored-with: Claude Code.

Differential Revision: D113992326

[ghstack-poisoned]
@pytorch-bot

pytorch-bot Bot commented Jul 30, 2026

Copy link
Copy Markdown

🔗 Helpful Links

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

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

⏳ No Failures, 82 Pending

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

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@github-actions

Copy link
Copy Markdown

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