Skip to content

[ExecuTorch][WebGPU] Switch native backend from wgpu-native to Dawn (Tint) + SwiftShader#20192

Merged
JulianCloudNTH merged 3 commits into
mainfrom
gh/JulianCloudNTH/14/orig
Jun 10, 2026
Merged

[ExecuTorch][WebGPU] Switch native backend from wgpu-native to Dawn (Tint) + SwiftShader#20192
JulianCloudNTH merged 3 commits into
mainfrom
gh/JulianCloudNTH/14/orig

Conversation

@pytorchbot

Copy link
Copy Markdown
Collaborator

This PR was created by the merge bot to help merge the original PR into the main branch.
ghstack PR number: #20079 by @JulianCloudNTH
^ Please use this as the source of truth for the PR details, comments, and reviews
ghstack PR base: https://github.com/pytorch/executorch/tree/gh/JulianCloudNTH/14/base
ghstack PR head: https://github.com/pytorch/executorch/tree/gh/JulianCloudNTH/14/head
Merge bot PR base: https://github.com/pytorch/executorch/tree/main
Merge bot PR head: https://github.com/pytorch/executorch/tree/gh/JulianCloudNTH/14/orig

@diff-train-skip-merge

…Tint) + SwiftShader

Pull Request resolved: #20079

Make Dawn (Chrome's WebGPU implementation, whose WGSL compiler Tint is the spec reference) running on SwiftShader the sole native WebGPU backend, replacing wgpu-native (naga), so the op tests run on a spec-faithful, headless, deterministic CLI backend. The `WEBGPU_IMPL` cache variable, the wgpu-native CMake branch, and the `WEBGPU_IMPL_DAWN` compile define are removed -- CMake now unconditionally `find_package(Dawn REQUIRED)` and links `dawn::webgpu_dawn`. `WebGPUCompat.h` drives pending callbacks via Dawn's `wgpuInstanceProcessEvents` on native and yields to the JS event loop under Emscripten.

Dawn is vendored with NO new S3 artifact: `oss/.ci/scripts/setup-webgpu-linux-deps.sh` downloads Google's official `ubuntu-latest-Release` prebuilt directly from github.com/google/dawn/releases (pinned tag + sha256, the same pattern as `setup-wgpu-native.sh`), and reuses the SwiftShader prebuilt already on the ossci bucket. The release exports `dawn::webgpu_dawn` (a static lib) which drops into the existing `find_package(Dawn)`. It has no bundled SwiftShader, so `WebGPUDevice.cpp` requests a normal Vulkan adapter (`forceFallbackAdapter=false`) and `VK_ICD_FILENAMES` makes SwiftShader the only device. The release is built with a recent GCC, so the deps script also pulls a current libstdc++ from the `ubuntu-toolchain-r` PPA (its lib references `_M_replace_cold`, a GCC 13+ symbol) plus `libvulkan1` (Dawn dlopens the Vulkan loader) -- all scoped to the WebGPU CI job, backward-compatible, no repo-wide impact.

Authored with assistance from Claude.
ghstack-source-id: 391968389
@exported-using-ghexport

Differential Revision: [D107589774](https://our.internmc.facebook.com/intern/diff/D107589774/)
@pytorch-bot

pytorch-bot Bot commented Jun 10, 2026

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/20192

Note: Links to docs will display an error until the docs builds have been completed.

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 10, 2026
@github-actions

Copy link
Copy Markdown

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

Comment on lines +33 to +54
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
runner: linux.4xlarge.memory
docker-image: ci-image:executorch-ubuntu-22.04-clang12
submodules: recursive
timeout: 120
script: |
set -eux

# The generic Linux job uses the base conda env, not the image's; activate
# the image env (it has the pinned from-source torch). Mirrors
# test-vulkan-operators-linux in pull.yml.
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
conda activate "${CONDA_ENV}"

# Install the python package + runtime deps (the .pte exporters).
PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh --build-tool cmake

# Vendor Dawn (Tint) + SwiftShader, then build + run the native executables.
source .ci/scripts/setup-webgpu-linux-deps.sh
bash backends/webgpu/scripts/test_webgpu_native_ci.sh
@JulianCloudNTH JulianCloudNTH self-requested a review June 10, 2026 17:59
…tests

Pull Request resolved: #20080

Native unit tests for two runtime enablers: per-pass compute-dispatch ordering (D107543258) and graph-owned scratch buffers (D107543259). `test/native/test_dispatch_order.cpp` exercises multi-dispatch read-after-write ordering through a single `execute()` using dependency chains -- a single-input `add` self-chain and a heterogeneous `rms_norm` -> `add` chain, both lowered via `VulkanPartitioner` -- comparing GPU output to a torch-computed golden per element. `test/native/test_scratch_buffer.cpp` is a white-box test of `WebGPUGraph::create_scratch_buffer` (no black-box consumer exists below the SDPA op): allocation + zero-size guard, copy round-trip, a compute Storage round-trip (its actual use), and a create/destroy lifecycle stress. Authored with assistance from Claude.
ghstack-source-id: 391979580
@exported-using-ghexport

Differential Revision: [D107576199](https://our.internmc.facebook.com/intern/diff/D107576199/)
@JulianCloudNTH JulianCloudNTH merged commit f0dff03 into main Jun 10, 2026
320 of 329 checks passed
@JulianCloudNTH JulianCloudNTH deleted the gh/JulianCloudNTH/14/orig branch June 10, 2026 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants