[web] Fix 2 bugs in emdawnwebgpu (patches dawn)#27641
Open
Conversation
35bee1c to
c04f11d
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates ONNX Runtime’s Dawn (emdawnwebgpu) patch set to address two upstream bugs impacting WebGPU on Emscripten, and wires those patches into the Dawn FetchContent patch pipeline.
Changes:
- Add a patch to keep the Emscripten runtime alive until
device.lostresolves, avoiding premature ABORT that can drop subsequent callbacks. - Add a patch to fix
importJsBuffercreatingWGPUBufferImplwith the wrong constructor by disambiguating the “injection” constructor path. - Apply both new patches during Dawn dependency setup in
onnxruntime_external_deps.cmake.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| cmake/patches/dawn/dawn_device_lost_keepalive.patch | Patches library_webgpu.js to add runtimeKeepalivePush/Pop around the device.lost handler. |
| cmake/patches/dawn/dawn_buffer_fix_injection.patch | Patches webgpu.cpp to adjust WGPUBufferImpl injection constructor usage for JS-imported buffers. |
| cmake/external/onnxruntime_external_deps.cmake | Adds the new Dawn patches to the patch command sequence with explanatory comments. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+780
to
+782
| # tagged with kImportedFromJS. This removes the unused WGPUBufferMapState parameter | ||
| # from the injection constructor so emwgpuCreateBuffer correctly uses it, ensuring | ||
| # imported buffers are properly tagged as kImportedFromJS. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fix 2 bugs in emdawnwebgpu.
Fix incorrect handling for device lost. See also:
(but dawn does not accept PR with copilot as co-author, so just for reference)
Fix wrong call to WGPUBufferImpl constructor. See also: