Skip to content

Commit 9ce5fd6

Browse files
[WebGPU] Update to latest native headers (#7932)
* [WebGPU] Update to latest native headers * Update mini_webgpu.h with latest version from Dawn * Document this process * Remove an argument from wgpuQueueOnSubmittedWorkDone Fixes #7581 * [WebGPU] Note that wgpu is not yet supported * [WebGPU] Add https:// to external links in README * update to commit b5d38fc7dc2a20081312c95e379c4a918df8b7d4 * Update mini_webgpu.h --------- Co-authored-by: Steven Johnson <[email protected]>
1 parent 976ea0b commit 9ce5fd6

File tree

3 files changed

+269
-161
lines changed

3 files changed

+269
-161
lines changed

Diff for: README_webgpu.md

+22-4
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ When invoking `emcc` to link Halide-generated objects, include these flags:
3636
`-s USE_WEBGPU=1 -s ASYNCIFY`.
3737

3838
Tests that use AOT compilation can be run using a native WebGPU implementation
39-
that has Node.js bindings, such as [Dawn](dawn.googlesource.com/dawn/).
39+
that has Node.js bindings, such as [Dawn](https://dawn.googlesource.com/dawn/).
4040
You must set an environment variable named `HL_WEBGPU_NODE_BINDINGS` that
4141
has an absolute path to the bindings to run these tests, e.g. `HL_WEBGPU_NODE_BINDINGS=/path/to/dawn.node`.
4242

@@ -47,13 +47,18 @@ JIT compilation is not supported when using WebGPU with WASM.
4747

4848
## Running natively: `HL_TARGET=host-webgpu`
4949

50-
> _Tested with top-of-tree Dawn as of 2023-03-14._
50+
> _Tested with top-of-tree Dawn as of 2023-11-27 [commit b5d38fc7dc2a20081312c95e379c4a918df8b7d4]._
5151
5252
For testing purposes, Halide can also target native WebGPU libraries, such as
53-
[Dawn](dawn.googlesource.com/dawn/) or [wgpu](github.com/gfx-rs/wgpu).
53+
[Dawn](https://dawn.googlesource.com/dawn/) or
54+
[wgpu](https://github.com/gfx-rs/wgpu).
5455
This is currently the only path that can run the JIT correctness tests.
5556
See [below](#setting-up-dawn) for instructions on building Dawn.
5657

58+
> Note that as of 2023-11-27, wgpu is not supported due to
59+
> [lacking `override` support for WGSL](https://github.com/gfx-rs/wgpu/issues/1762)
60+
> which we require > in order to set GPU block sizes.
61+
5762
When targeting WebGPU with a native target, Halide defaults to looking for a
5863
build of Dawn (with several common names and suffixes); you can override this
5964
by setting the `HL_WEBGPU_NATIVE_LIB` environment variable to the absolute path
@@ -71,7 +76,7 @@ will be selected based on the Halide target specified.
7176

7277
Building Dawn's Node.js bindings currently requires using CMake.
7378

74-
First, [install `depot_tools`](commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up) and add it to the
79+
First, [install `depot_tools`](https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up) and add it to the
7580
`PATH` environment variable.
7681

7782
Next, get Dawn and its dependencies:
@@ -108,3 +113,16 @@ This will produce the following artifacts:
108113

109114
These paths can then be used for the `HL_WEBGPU_NODE_BINDINGS` and
110115
`HL_WEBGPU_NATIVE_LIB` environment variables when using Halide.
116+
117+
## Updating mini_webgpu.h
118+
119+
The recommended method for updating `mini_webgpu.h` is to copy the
120+
`gen/include/dawn/webgpu.h` file from the Dawn build directory, then:
121+
- Restore the `// clang-format {off,on}` lines.
122+
- Comment out the `#include <std*>` lines.
123+
- Remove the `void` parameter from the `WGPUProc` declaration.
124+
125+
This guarantees a version of the WebGPU header that is compatible with Dawn.
126+
When the native API eventually stabilizes, it should be possible to obtain a
127+
header from the `webgpu-native` GitHub organization that will be compatible
128+
with Dawn, wgpu, and Emscripten.

0 commit comments

Comments
 (0)