Skip to content

[ExecuTorch][WebGPU] Add update_cache tests (native numeric + export)#20204

Merged
JulianCloudNTH merged 2 commits into
gh/JulianCloudNTH/16/origfrom
gh/JulianCloudNTH/17/orig
Jun 10, 2026
Merged

[ExecuTorch][WebGPU] Add update_cache tests (native numeric + export)#20204
JulianCloudNTH merged 2 commits into
gh/JulianCloudNTH/16/origfrom
gh/JulianCloudNTH/17/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: #20084 by @JulianCloudNTH
^ 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/JulianCloudNTH/17/base
ghstack PR head: https://github.com/pytorch/executorch/tree/gh/JulianCloudNTH/17/head
Merge bot PR base: https://github.com/pytorch/executorch/tree/gh/JulianCloudNTH/16/orig
Merge bot PR head: https://github.com/pytorch/executorch/tree/gh/JulianCloudNTH/17/orig

@diff-train-skip-merge

Pull Request resolved: #20084

Tests for `llama.update_cache.default`, stacked on the op diff below. `test/ops/sdpa/test_update_cache.py` lowers the op through `VulkanPartitioner` (asserting it delegates to VulkanBackend) and exports per-case `.pte`s; `test/native/test_update_cache.cpp` runs them on-GPU and checks an integer-exact scatter golden against the returned cache. Coverage mirrors the Vulkan KV-cache test (`VulkanSDPATest`): single-shot writes at varied shapes/offsets, plus a multi-step advancing-input_pos replay that threads the returned cache across steps over the same GQA param sets (incl. llama3 head_dim=128). Comparing the cache directly is stronger than Vulkan, which checks it only indirectly via the SDPA output. Authored with assistance from Claude.
ghstack-source-id: 391979582
@exported-using-ghexport

Differential Revision: [D107547307](https://our.internmc.facebook.com/intern/diff/D107547307/)
@pytorch-bot

pytorch-bot Bot commented Jun 10, 2026

Copy link
Copy Markdown

🔗 Helpful Links

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

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

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 Jun 10, 2026
@JulianCloudNTH JulianCloudNTH self-requested a review June 10, 2026 21:26
…ymint

Pull Request resolved: #20085

Adds the dynamic-scalar (SymInt) mechanism to the WebGPU graph as a standalone enabler, ahead of the SDPA op that consumes it. Mirrors the Vulkan delegate's SymInt = live uniform-buffer design: a `ValueType::SymInt` backed by a 16-byte `Uniform|CopyDst` buffer, `set_symint`/`read_symint`/`symint_buffer` accessors with dirty-tracking, a `SymIntSource` + `add_symint_source`/`update_symints_from_inputs` host-read path, and an `add_resize_hook`/`propagate_resize`/`dispatch_at` recompute plumbing. `WebGPUBackend::execute` calls `propagate_resize` after refreshing the SymInts from the runtime inputs. The `et_vk.select_as_symint` op handler records `out SymInt = x[index]` along a dim at build time.

This diff has no in-graph consumer yet — the SDPA op (stacked above) reads the SymInt value via `read_symint()` for dynamic `input_pos`. Building it as its own diff keeps the enabler separate from the op, matching the update_cache → mechanism → SDPA layering.

Authored with assistance from Claude.
ghstack-source-id: 391979584
@exported-using-ghexport

Differential Revision: [D107584280](https://our.internmc.facebook.com/intern/diff/D107584280/)
@JulianCloudNTH JulianCloudNTH merged commit 78293be into gh/JulianCloudNTH/16/orig Jun 10, 2026
36 checks passed
@JulianCloudNTH JulianCloudNTH deleted the gh/JulianCloudNTH/17/orig branch June 10, 2026 21:30
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