[WebGPU] Add robustness provider option - #31971
Open
Jiajia Qin (qjia7) wants to merge 2 commits into
Open
Conversation
Jiajia Qin (qjia7)
marked this pull request as draft
August 11, 2026 02:40
Jiajia Qin (qjia7)
force-pushed
the
webgpu-enable-robustness-option
branch
from
August 11, 2026 02:57
d8bd11b to
53ba453
Compare
Jiajia Qin (qjia7)
marked this pull request as ready for review
August 11, 2026 03:33
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a new WebGPU execution provider option, enableRobustness, to control Dawn robust buffer access when ONNX Runtime creates the WebGPU device (native/Node.js scenarios). It wires the option through the WebGPU context configuration, makes behavior explicit for the shared-device lifecycle, and adds native tests to validate defaults, explicit settings, and conflict handling.
Changes:
- Added
ep.webgpuexecutionprovider.enableRobustnessconfig key with Debug/Release defaults and explicit parsing/validation. - Updated WebGPU device toggle selection so robust buffer access is controlled via Dawn’s
disable_robustnesstoggle (enabled or explicitly disabled). - Exposed
enableRobustnessin the Node.js binding option parsing and in the shared JS TypeScript type surface; added native unit tests covering key scenarios.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| onnxruntime/test/providers/webgpu/webgpu_context_test.cc | Adds unit tests verifying robustness toggles, defaults, invalid values, compile-only behavior, conflict warnings, and external-device ignore behavior. |
| onnxruntime/core/providers/webgpu/webgpu_provider_options.h | Defines the new config key and "0"/"1" value constants for robustness. |
| onnxruntime/core/providers/webgpu/webgpu_provider_factory.cc | Parses enableRobustness from config options, validates values, and logs the resolved setting. |
| onnxruntime/core/providers/webgpu/webgpu_context.h | Adds robustness fields to WebGpuContextConfig with build-specific defaults and exposes Instance() for test/support usage. |
| onnxruntime/core/providers/webgpu/webgpu_context.cc | Stores robustness setting on initialization, emits warnings for conflicts/external devices, and applies robustness via enabled/disabled Dawn toggles. |
| js/node/src/session_options_helper.cc | Accepts enableRobustness as a boolean for the WebGPU EP in Node.js and maps it to "1"/"0". |
| js/common/lib/inference-session.ts | Documents and exposes enableRobustness?: boolean on the shared JS WebGPU options type surface (noted as Node-only behavior). |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Jiajia Qin (qjia7)
requested review from
Edward Chen (edgchen1) and
Hariharan Seshadri (hariharans29)
August 11, 2026 03:46
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Motivation and Context
Dawn buffer robustness is a device-creation setting that is separate from validation. ONNX Runtime previously enabled Dawn's disable_robustness toggle unconditionally, so native users could not request robust buffer access or configure the safety/performance tradeoff independently.
This change exposes that choice for native WebGPU device creation while making the shared-device behavior explicit. It keeps the performance-oriented non-Debug default and enables the safer Debug default.
Testing