Skip to content

Isolate bundled Dawn implementation from WebGPU context - #32964

Merged
Mustapha Jaber (mustjab) merged 2 commits into
mainfrom
fix/webgpu-bundled-dawn-boundary
Sep 30, 2026
Merged

Mustapha Jaber (mustjab) merged 2 commits into
mainfrom
fix/webgpu-bundled-dawn-boundary

Conversation

@mustjab

Copy link
Copy Markdown
Contributor

Summary

The common WebGPU context handles both bundled and host-provided Dawn, but it also includes Dawn native/platform headers and implements the bundled worker pool. Move the implementation-dependent code into a bundled-only translation unit so that the common context no longer depends on dawn::native or dawn::platform.

  • Extract default proc-table lookup, custom-platform instance creation, and native adapter enumeration behind private typed helpers.
  • Exclude the bundled-only source from external-Dawn and Emscripten builds.
  • Preserve worker-pool sizing, platform lifetime, instance features, and adapter-selection behavior. No public API or packaging changes.

Validation

  • Windows x64 Release, bundled Dawn: built onnxruntime_provider_test; ran WebGpuContextTest.*, with 27 passed and one expected skip (AdapterIndexRejectsUnsupportedBuild). This includes physical adapter selection and device operations.
  • Windows x64 Release, --use_webgpu --use_external_dawn: configured and built onnxruntime_providers_webgpu. The bundled-only translation unit is excluded from the generated project.
  • Scoped lintrunner and git diff --cached --check passed.

External-host runtime and Emscripten execution were not tested locally.

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.

Copilot review overview

🟒 Approval recommended

The implementation preserves behavior and build isolation; only minor missing license headers remain.

Review effort: Balanced
Findings: 2 Low severity

Open (2)
What changed in this PR

Isolates bundled Dawn dependencies from the common WebGPU context while preserving existing behavior.

Changes:

  • Moves native Dawn platform, proc-table, instance, and adapter logic into dedicated helpers.
  • Excludes bundled-only implementation from external-Dawn and Emscripten builds.
  • Updates context creation and adapter enumeration to use the helpers.
File Description
webgpu_context.cc Uses bundled-Dawn helper APIs.
webgpu_context_dawn_platform.h Declares internal helper APIs.
webgpu_context_dawn_platform.cc Implements bundled Dawn integration.
onnxruntime_providers_webgpu.cmake Excludes bundled implementation where unsupported.

πŸ’‘ Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@mustjab
Mustapha Jaber (mustjab) merged commit d74a6b9 into main Sep 30, 2026
95 of 96 checks passed
@mustjab
Mustapha Jaber (mustjab) deleted the fix/webgpu-bundled-dawn-boundary branch September 30, 2026 12:21
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.

3 participants