Skip to content

[ExecuTorch][WebGPU] Use requiredFeatures instance API on native + emscripten Dawn#20725

Merged
2 commits merged into
gh/JulianCloudNTH/83/origfrom
gh/JulianCloudNTH/84/orig
Jul 4, 2026
Merged

[ExecuTorch][WebGPU] Use requiredFeatures instance API on native + emscripten Dawn#20725
2 commits merged into
gh/JulianCloudNTH/83/origfrom
gh/JulianCloudNTH/84/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: #20652 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/84/base
ghstack PR head: https://github.com/pytorch/executorch/tree/gh/JulianCloudNTH/84/head
Merge bot PR base: https://github.com/pytorch/executorch/tree/gh/JulianCloudNTH/83/orig
Merge bot PR head: https://github.com/pytorch/executorch/tree/gh/JulianCloudNTH/84/orig

@diff-train-skip-merge

…scripten Dawn

Pull Request resolved: #20652

**Key the `timedWaitAny` instance setup to the actual Dawn API instead of `__EMSCRIPTEN__`, so native-rig Dawn and emscripten/emdawnwebgpu use the modern `requiredFeatures` path and only the vendored Dawn uses the legacy `capabilities.*` path.**

The instance-descriptor setup was guarded by `#if defined(__EMSCRIPTEN__)`, which routed emscripten (emdawnwebgpu, emcc 4.0.19+) through the legacy `capabilities.*` API that no longer exists there. The guard now keys off the API actually present.

Key changes:
- `WebGPUDevice.cpp` — `#if defined(__EMSCRIPTEN__)` → `#if defined(WEBGPU_DAWN_INSTANCE_CAPABILITIES)`. The legacy `instance_desc.capabilities.*` path is taken only by the buck-vendored Dawn (which defines the macro); native cmake Dawn and emscripten leave it undefined and take the `requiredFeatures` / `WGPUInstanceFeatureName_TimedWaitAny` path.

Co-authored-with: Claude Code.
ghstack-source-id: 399812934
@exported-using-ghexport

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

pytorch-bot Bot commented Jul 4, 2026

Copy link
Copy Markdown

🔗 Helpful Links

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

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 Jul 4, 2026
Pull Request resolved: #20706

Convert the remaining hand-rolled `int main()` + printf/`bool ok` native tests to GTest so the whole `backends/webgpu/test/` suite is uniform, filterable via `--gtest_filter`, and self-reporting (extends the GTest conversion already applied to `test_dynamic_shape`). The five converted files are a harness-only change — every test case, tensor shape, tolerance, artifact filename, and skip condition is preserved 1:1, only the pass/fail reporting mechanism changes — and this diff additionally wires the already-GTest `webgpu_dynamic_shape_test` into the CI runner so the dynamic-shape suite actually executes.

Key changes:
- `test/test_webgpu_native.cpp`, `test/native/test_dispatch_order.cpp`, `test/native/test_index.cpp`, `test/native/test_scratch_buffer.cpp`, `test/native/test_update_cache.cpp` — `main`+`printf`/`bool ok` accumulator → `TEST()` cases using `EXPECT_*`/`ASSERT_*`; each keeps a custom `main()` that brings up the WebGPU device once then `RUN_ALL_TESTS()` (device-absent still SKIPs by returning 0). `test_index`/`test_webgpu_native` use inclusive `EXPECT_LE(err, tol)` to match the original `err > tol` fail gate exactly.
- `CMakeLists.txt` — move every native-test target into the `if(TARGET GTest::gtest)` block, linking `GTest::gtest`.
- `scripts/test_webgpu_native_ci.sh` — add `-DEXECUTORCH_BUILD_TESTS=ON` to the native-test configure so the now-gtest-gated targets are defined, and wire `webgpu_dynamic_shape_test` into the runner: export its `.pte`s + goldens via `export_dynamic_shape_cases`, add it to the built/run target list behind the same `--target help` probe, and run it guarded (mirroring the `index` test).
- `test/test_build_webgpu.sh` — add `-DEXECUTORCH_BUILD_TESTS=ON` so the local build script (which builds the now-gtest-gated targets unconditionally) still finds them.
ghstack-source-id: 399812941
@exported-using-ghexport

Differential Revision: [D110536636](https://our.internmc.facebook.com/intern/diff/D110536636/)
@ghost ghost requested review from kirklandsign and larryliu0820 as code owners July 4, 2026 17:32
@ghost ghost temporarily deployed to cadence July 4, 2026 17:32 — with GitHub Actions Inactive
@ghost ghost temporarily deployed to cadence July 4, 2026 17:32 — with GitHub Actions Inactive
@ghost ghost merged commit 882e658 into gh/JulianCloudNTH/83/orig Jul 4, 2026
16 of 17 checks passed
@ghost ghost deleted the gh/JulianCloudNTH/84/orig branch July 4, 2026 17:32
@ghost ghost temporarily deployed to cadence July 4, 2026 18:02 — with GitHub Actions Inactive
This pull request was closed.
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.

2 participants