Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] WebGPU EP [skip ci] #21904

Closed
wants to merge 167 commits into from
Closed

[WIP] WebGPU EP [skip ci] #21904

wants to merge 167 commits into from

Conversation

fs-eire
Copy link
Contributor

@fs-eire fs-eire commented Aug 28, 2024

Description

For code review purpose only. Offer a place for discussion.

see also:

prerequisite:

related changes:

TODO items

  • Validation Switch (allows to change the behavior of whether perform specific validation checks)
  • pushErrorScope/popErrorScope
  • Graph Capture
  • Profiling supported by WebGPU Query Buffer
  • WebGPU resources tracking (mainly for buffers)
  • Global hanlders( unhandled exceptions and device lost )
  • Fix CI breaks (macOS)

fs-eire and others added 18 commits October 14, 2024 14:10
### Description

This change allows to set EP option "forceCpuNodeNames" in which
includes a list of node names that will always be running on CPU.

Usage example:

```diff
            opt.executionProviders[0] = {
                name: "webgpu",
                validationMode: 'wgpuOnly',
                storageBufferCacheMode: 'bucket',
+               // force node "/model/embed_tokens/Gather" to be put on CPU
+               forceCpuNodeNames: "/model/embed_tokens/Gather"
            };

```
### Description
<!-- Describe your changes. -->



### Motivation and Context
<!-- - Why is this change required? What problem does it solve?
- If it fixes an open issue, please link to the issue here. -->
@jlucaso1
Copy link

@fs-eire on this branch is it already possible to test in nodejs, compiling in my side?

@fs-eire
Copy link
Contributor Author

fs-eire commented Oct 21, 2024

@fs-eire on this branch is it already possible to test in nodejs, compiling in my side?

Yes. Just do build with flags --config Release --use_webgpu --build_nodejs and it should work.

qjia7 and others added 5 commits October 21, 2024 23:52
The MacOS device on CI is an Apple Paravirtual device, which may not
support TimestampQuery. In this PR, If TimestampQuery is not supported,
a warning is printed to not block profiling cpu data.
### Description

introduce this build flag --use_external_dawn to allow specifying Dawn
as an external dependency. When it is specified, `dawn::native` is
excluded from build of onnxruntime, and passing in dawn proc table is
required.

I didn't find a good way to run the test. Currently I need to build with
the following flags:
```sh
C:\code\onnxruntime>build --use_webgpu --use_external_dawn --skip_tests --target onnxruntime_webgpu_external_dawn_test
```

And run the test using:
```sh
# run test that passing dawn proc table. expect session to initialize successfully
C:\code\onnxruntime\build\Windows\Debug\Debug>onnxruntime_webgpu_external_dawn_test.exe

# run test that does not pass proc table. expect exception to throw.
C:\code\onnxruntime\build\Windows\Debug\Debug>onnxruntime_webgpu_external_dawn_test.exe --no_proc_table
```
@fs-eire
Copy link
Contributor Author

fs-eire commented Oct 31, 2024

Most part of this working branch is already merged into main, or in review. Close this draft.

future PRs can target main branch directly.

@fs-eire fs-eire closed this Oct 31, 2024
ishwar-raut1 pushed a commit to ishwar-raut1/onnxruntime that referenced this pull request Nov 19, 2024
This change introduces the WebGPU EP into ONNX Runtime.

To make the PR as simple as possible, this PR excluded the following:
- C API changes for WebGPU EP
- actual implementation of WebGPU EP. Currently in this PR, WebGPU is a
stub implementation that does not register any kernel.
- Python IO Binding update
- Node.js IO Binding update

This PR now contains only 43 file changes (while the working branch
contains 130+) and hopefully this makes it easier to review.

There is going to be separated PRs for each mentioned above.

Current working branch: microsoft#21904
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.