Repository navigation
Fix WebGPU bundled Dawn platform cleanup - #33526
Merged
Merged
Conversation
Release and reset the bundled Dawn platform after WebGPU contexts and the cached instance are released. Retain explicit lifetime control to avoid static destruction ordering hazards while fixing the allocation reported by Application Verifier on provider unload. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9bab1fc9-3c49-4110-91c4-5097c3373dd5
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The cleanup order, factory locking, and build guards support the intended lifecycle, with only a nonblocking regression-test suggestion remaining.
1 open issue
What changed in this PR
Fixes the Application Verifier-reported leak by releasing the bundled Dawn platform after WebGPU contexts and the cached instance are destroyed.
Changes:
- Adds explicit platform deletion and reset, allowing later recreation.
- Calls cleanup only in native bundled-Dawn builds.
- Documents teardown ordering and concurrency requirements.
| File | Description |
|---|---|
| onnxruntime/core/providers/webgpu/webgpu_context.cc | Invokes platform cleanup after context and instance teardown. |
| onnxruntime/core/providers/webgpu/webgpu_context_dawn_platform.h | Declares cleanup and documents its lifetime constraints. |
| onnxruntime/core/providers/webgpu/webgpu_context_dawn_platform.cc | Makes platform storage resettable and implements deletion. |
Review effort: Balanced
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9bab1fc9-3c49-4110-91c4-5097c3373dd5
Pass the instance descriptor by const reference and clarify the platform deleter documentation. Allow intentional Abseil flag retention in the Windows Debug leak checker and remove the obsolete Dawn platform suppression. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5f4f7562-11aa-4473-afeb-c8e1206de604
Jiajia Qin (qjia7)
approved these changes
Oct 22, 2026
Edward Chen (edgchen1)
added a commit
that referenced
this pull request
Oct 22, 2026
### Description <!-- Describe your changes. --> This cherry-picks the following commits for the release: | Commit ID | PR Number | Commit Title | |-----------|-----------|-------------| | 1f4b965 | #33526 | Fix WebGPU bundled Dawn platform cleanup | | 2297e77 | #33226 | Fix WASM Debug external-data test failures | ### 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. --> WebGPU EP release. --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: tianleiwu <30328909+tianleiwu@users.noreply.github.com> Copilot-Session: 9bab1fc9-3c49-4110-91c4-5097c3373dd5 Copilot-Session: 5f4f7562-11aa-4473-afeb-c8e1206de604
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
Release and reset the bundled Dawn platform after WebGPU contexts and the cached instance are released.
The original code was leaking the
DawnPlatform*.Motivation and Context
Fix Application Verifier-reported leak.