Skip to content

Optimize WebGPU GatedDeltaNet recurrent execution - #32645

Merged
kunal-vaishnavi merged 38 commits into
mainfrom
copilot/32510-performance-optimizations
Oct 1, 2026
Merged

kunal-vaishnavi merged 38 commits into
mainfrom
copilot/32510-performance-optimizations

Conversation

Copilot AI commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Description

Implements the remaining performance follow-ups from the GatedDeltaNet WebGPU review.

  • Compute gate transformations and exponentiation once per workgroup.
  • Use vectorized vec4 value loads and output stores when head_size_v permits.
  • Correct packed-parameter dispatch sizing to avoid 64× excess workgroups.
  • Retain scalar fallbacks for tails and packed QKV buffers.
  • Add deterministic effective WebGPU storage-limit overrides for path-focused tests.
  • Cover segmented packed QKV and packed parameters end to end, including nonzero K/V view offsets.
  • Clarify packed-buffer view units.

Motivation and Context

Reduce redundant computation, storage accesses, and dispatch overhead in the WebGPU GatedDeltaNet kernel introduced by PR #32510, while adding runtime coverage for the constrained-binding packed path requested during review.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@kunal-vaishnavi
kunal-vaishnavi changed the base branch from main to copilot/implement-gated-delta-net-webgpu September 16, 2026 17:17
@kunal-vaishnavi
kunal-vaishnavi marked this pull request as ready for review September 16, 2026 17:17
Copilot AI balanced review requested due to automatic review settings September 16, 2026 17:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new FP16 test does not reliably exercise vectorized value I/O on baseline WebGPU adapters.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Optimizes the WebGPU GatedDeltaNet recurrent path by reducing redundant gate work and vectorizing value I/O.

Changes:

  • Shares gate computation across each workgroup.
  • Adds vec4 value loads/output stores with scalar fallbacks.
  • Corrects packed-parameter dispatch sizing and adds focused coverage.
File summaries
File Description
onnxruntime/contrib_ops/webgpu/bert/gated_delta_net.cc Selects vectorized I/O and fixes dispatch sizing.
onnxruntime/contrib_ops/webgpu/bert/gated_delta_net.h Tracks vectorized-I/O configuration.
onnxruntime/contrib_ops/webgpu/bert/gated_delta_net.wgsl.template Implements shared gate computation and vec4 I/O.
onnxruntime/core/providers/webgpu/program.h Clarifies packed buffer-view units.
onnxruntime/test/contrib_ops/gated_delta_net_op_test.cc Adds recurrent optimization coverage.
Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 1
  • Review effort level: Balanced

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@kunal-vaishnavi
kunal-vaishnavi force-pushed the copilot/32510-performance-optimizations branch from 3435187 to f133c74 Compare September 16, 2026 17:54
@kunal-vaishnavi
kunal-vaishnavi force-pushed the copilot/32510-performance-optimizations branch 2 times, most recently from 3975a40 to 1174fc7 Compare September 16, 2026 18:27
Copilot AI and others added 3 commits September 17, 2026 22:36
Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
Base automatically changed from copilot/implement-gated-delta-net-webgpu to main September 17, 2026 23:22
@kunal-vaishnavi kunal-vaishnavi assigned Copilot and unassigned Copilot Sep 18, 2026
…ance-optimizations

# Conflicts:
#	docs/ContribOperators.md
#	onnxruntime/contrib_ops/webgpu/bert/gated_delta_net.cc
#	onnxruntime/contrib_ops/webgpu/bert/gated_delta_net.h
#	onnxruntime/contrib_ops/webgpu/bert/gated_delta_net.wgsl.template
#	onnxruntime/core/graph/contrib_ops/bert_defs.cc
#	onnxruntime/core/providers/webgpu/program.h
#	onnxruntime/core/providers/webgpu/program_cache_key.cc
#	onnxruntime/core/providers/webgpu/shader_helper.cc
#	onnxruntime/core/providers/webgpu/shader_helper.h
#	onnxruntime/core/providers/webgpu/shader_variable.cc
#	onnxruntime/core/providers/webgpu/shader_variable.h
#	onnxruntime/test/contrib_ops/gated_delta_net_op_test.cc

Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
…ance-optimizations

# Conflicts:
#	onnxruntime/core/providers/webgpu/webgpu_context.h

Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
…ance-optimizations

Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
Copilot AI and others added 2 commits October 1, 2026 02:08
…ance-optimizations

Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
@kunal-vaishnavi
kunal-vaishnavi merged commit d90bd6b into main Oct 1, 2026
96 checks passed
@kunal-vaishnavi
kunal-vaishnavi deleted the copilot/32510-performance-optimizations branch October 1, 2026 05:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

⌂ 换网址