Skip to content

[WebGPU] Default non-debug validation mode set to disabled - #28679

Merged
hariharans29 merged 7 commits into
mainfrom
hari/webgpu-release-validation-disabled
Jun 3, 2026
Merged

[WebGPU] Default non-debug validation mode set to disabled#28679
hariharans29 merged 7 commits into
mainfrom
hari/webgpu-release-validation-disabled

Conversation

@hariharans29

@hariharans29 hariharans29 commented May 26, 2026

Copy link
Copy Markdown
Member

Summary

This PR updates WebGPU release behavior to improve default runtime performance while preserving explicit user control over validation.

In non-debug builds, the provider enables Dawn's skip_validation toggle by default only when validationMode is not explicitly configured or when explicitly configured to a mode weaker than strict validation. If validationMode is explicitly set to a stricter validation level (> disabled), that setting is honored and skip_validation is not forced.

Debug build behavior is unchanged.

Motivation

Release users generally prioritize performance, while advanced users need predictable diagnostic control when they explicitly request a stronger validation mode.

This change provides a release-friendly default without removing configurability or forcing performance penalties when users explicitly enable validation for debugging.

Behavior Matrix

Build Type validationMode Explicitly Set Behavior
Debug No No behavior change
Debug Yes Respect explicit validationMode
Release No Enable skip_validation by default
Release Yes (validationMode ≤ disabled) Enable skip_validation
Release Yes (validationMode > disabled) Respect explicit validationMode; do not force skip_validation

Implementation

  • Track whether validationMode was explicitly provided during provider option parsing.
  • Plumb explicitness into WebGpuContext initialization.
  • In non-debug builds: apply skip_validation default only when validationMode is absent or weaker than strict validation; otherwise honor explicit choice.

Why this approach

  • Improves release-path defaults for performance-sensitive scenarios.
  • Preserves explicit override semantics for diagnostics/troubleshooting.
  • Respects user intent: if they explicitly enable strong validation, that choice is honored.
  • Keeps the change narrowly scoped and low risk.

Related PRs

  • PR to use direct dispatch instead of indirect dispatch in the FA kernels to work-around the Dawn inefficiency with basic valiation mode - This is no longer needed
  • PR fix to create the dummy ORT session with user provided device knobs is still needed for other knobs (validation mode is just one such knob)

Motivation and Context

Perf improvement on Vulkan backend for Qwen3-1.7B model on a Windows machine with RTX 5060Ti card

image

The default state for validationMode to disabled greatly helps deocde TPS on Vulkan as it helps reduce the indirect dispatch inefficiency on Vulkan. There is a very small marginal improvement on D3D12 as well although not as marked as the inefficiency with indirect dispatch on D3D12 backend is greatly helped by D3D12's aggressive sub-allocator pooling (something Vulkan backend lacks).

NOTE: The "Branch" perf improvement numbers also includes the fusion in #28484 but the fusion's decode TPS gains is under 10%. The rest are contributed by the validationMode default.

@hariharans29
hariharans29 force-pushed the hari/webgpu-release-validation-disabled branch from 77c6517 to af805ba Compare May 26, 2026 21:13

@github-actions github-actions Bot 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.

You can commit the suggested changes from lintrunner.

Comment thread onnxruntime/core/providers/webgpu/webgpu_context.h Outdated
hariharans29 and others added 2 commits May 26, 2026 14:18
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

@github-actions github-actions Bot 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.

You can commit the suggested changes from lintrunner.

Comment thread onnxruntime/core/providers/webgpu/webgpu_context.h Outdated
hariharans29 and others added 2 commits May 26, 2026 14:35
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

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.

Pull request overview

Changes the default WebGPU release-build behavior to enable Dawn's skip_validation toggle when the user has not explicitly set validationMode, improving release performance while preserving explicit overrides.

Changes:

  • Track whether validationMode was explicitly provided via a new validation_mode_explicitly_set flag in WebGpuContextConfig.
  • Plumb the flag through WebGpuContext's constructor and store it as a member.
  • In GetEnabledDeviceToggles, in non-debug builds, force skip_validation on when the user did not explicitly set validationMode; otherwise honor the explicit ValidationMode selection.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
onnxruntime/core/providers/webgpu/webgpu_provider_factory.cc Sets validation_mode_explicitly_set = true when kValidationMode is present in config options.
onnxruntime/core/providers/webgpu/webgpu_context.h Adds the validation_mode_explicitly_set field to WebGpuContextConfig and new constructor parameter/member in WebGpuContext.
onnxruntime/core/providers/webgpu/webgpu_context.cc Implements release-mode default to include skip_validation toggle unless validationMode was explicitly set; forwards new field when constructing the context.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@guschmue guschmue added the ep:WebGPU ort-web webgpu provider label May 28, 2026
@hariharans29
hariharans29 requested a review from Copilot May 28, 2026 23:07
@hariharans29 hariharans29 changed the title [WebGPU] Proposal: Default non-debug validation mode set to disabled [WebGPU] Default non-debug validation mode set to disabled May 28, 2026

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.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@hariharans29
hariharans29 requested review from guschmue and qjia7 May 28, 2026 23:09
@hariharans29
hariharans29 merged commit e25750d into main Jun 3, 2026
87 checks passed
@hariharans29
hariharans29 deleted the hari/webgpu-release-validation-disabled branch June 3, 2026 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ep:WebGPU ort-web webgpu provider

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants