Skip to content

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

Open
hariharans29 wants to merge 5 commits into
mainfrom
hari/webgpu-release-validation-disabled
Open

[WebGPU] Proposal: Default non-debug validation mode set to disabled#28679
hariharans29 wants to merge 5 commits into
mainfrom
hari/webgpu-release-validation-disabled

Conversation

@hariharans29
Copy link
Copy Markdown
Member

@hariharans29 hariharans29 commented May 26, 2026

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)

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

@github-actions github-actions Bot left a comment

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>
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

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>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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
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