Repository navigation
[WebGPU EP] adds state update capacity support for GatedDeltaNet - #32767
Prathik Rao (prathikr) merged 8 commits into
Conversation
There was a problem hiding this comment.
Copilot review overview
π‘ Changes recommended
The generated contrib-operator documentation must be updated before approval.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Open (2)
What changed in this PR
Adds WebGPU compact recurrent-state update support for GatedDeltaNet, matching the CUDA contract for speculative decoding.
Changes:
- Captures decay, key, and delta transitions in WGSL.
- Adds capacity validation, output handling, and WebGPU tests.
- Updates the operator schema source.
| File | Review |
|---|---|
onnxruntime/βtest/βcontrib_ops/βgated_delta_net_op_test.cc |
Adds compact-update reference logic and WebGPU tests. |
onnxruntime/βcore/βgraph/βcontrib_ops/βbert_defs.cc |
Critical: Regenerate docs/ContribOperators.md to reflect the schema change and prevent documentation validation failure. |
onnxruntime/βcontrib_ops/βwebgpu/βbert/βgated_delta_net.wgsl.template |
Implements transition capture shader logic. |
onnxruntime/βcontrib_ops/βwebgpu/βbert/βgated_delta_net.h |
Adds capture program state and clearing declarations. |
onnxruntime/βcontrib_ops/βwebgpu/βbert/βgated_delta_net.cc |
Wires capture execution. Nit: Restrict full-buffer clearing to the inactive path. |
π‘ Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Baiju Meswani (baijumeswani)
left a comment
There was a problem hiding this comment.
Thanks for adding the WebGPU compact-state capture path. The kernel logic looks aligned with the CUDA layout and capture semantics. I left a few inline comments about test coverage and the remaining GenAI integration needed before this can be considered end-to-end DFlash2 support. I would also wait for the full CI matrix to finish.
Baiju Meswani (baijumeswani)
left a comment
There was a problem hiding this comment.
Thanks for addressing the earlier comments. The production kernel changes look good by inspection, but the updated test has one remaining coverage issue. I would fix this and wait for the WebGPU CI jobs to finish before approval.


WebGPU GatedDeltaNet Compact State Updates
Changes
This PR adds compact state-update capture to the native WebGPU
com.microsoft.GatedDeltaNetkernel, which previously rejectedstate_update_capacity > 0.state_update_capacityand the required[batch]capture_countinput.state_updateoutput and includes its buffers in WebGPU bindingaccounting.
shader. These factors replay
S = decay * S + outer(key, delta).transitions.
state_update_active=0by clearing the entire output; uncaptured entries remainunspecified when capture is active.
WebGPU compact-state support.
Test Coverage
Tests now compare only the captured decay/key/delta ranges instead of assuming uncaptured storage is
zero. The inactive test still verifies that the complete output is zero-filled.
Coverage includes ragged capacity-7 cases with zero, partial, and full capture counts, plus an FP16
Qwen-like case (
Hq=2,Hv=6,head_size_qk=head_size_v=128). The larger case exercises theFP16 aliases, value tiling, shared-key head mapping, and binding-packing path used by GenAI.
DFlash2 Prerequisite
This PR adds the ORT kernel prerequisite; it does not enable end-to-end WebGPU DFlash2 by itself.
GenAI also needs:
state_update_capacity(#2453,#2585); and
including WebGPU
ReplayStateUpdates(#2606).Before advertising WebGPU DFlash2 support, an end-to-end GenAI run should cover full, partial, and
zero draft acceptance, match non-speculative output/state, and confirm that neither target execution
nor replay silently falls back from WebGPU.