[ExecuTorch][WebGPU] Add apply_rotary_emb_interleaved op#21185
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/21185
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ❌ 77 New FailuresAs of commit ea182f2 with merge base 266e0dc ( NEW FAILURES - The following jobs have failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This PR needs a
|
psiddh
left a comment
There was a problem hiding this comment.
Approving full WebGPU stack
Stack from ghstack (oldest at bottom):
Problem: The WebGPU delegate is missing the pair-interleaved rotary embedding that the Vulkan delegate exposes as
et_vk.apply_rotary_emb_interleaved(used by EdgeTAM). Without it these graphs fall back to CPU or fail to delegate.Solution: Port the Vulkan
apply_rotary_emb_interleaved.glslto WGSL + a C++ handler, mirroring its math exactly. The last dim is[r, i]pairs andfreqsis matching[cos, sin]pairs of shape[seq, width]; each output element applies the standard 2x2 rotation from its pair partner. Single dispatch, 2D-folded flat index to lift the 65535 1D-dispatch cap.Implementation:
RotaryEmbeddingInterleaved.cppregisterset_vk.apply_rotary_emb_interleaved.default(args[x, freqs, out]), guards rank-3[B, N, C]/ even width / fp32 /freqs == [seq, width]/numel <= u32/ non-null buffers, and installs a resize hook that recomputesseq/numel+ dispatch counts for dynamic shapes.apply_rotary_emb_interleaved.wgslreads the[cos, sin]pair at the even-aligned column and writes the rotated element.Differential Revision: D112257634