Repository navigation
[WebGPU] Fix initializer upload on GPUs without Resizable BAR - #32816
Merged
Jiajia Qin (qjia7) merged 1 commit intoSep 29, 2026
Merged
Jiajia Qin (qjia7) merged 1 commit into
Jiajia Qin (qjia7) merged 1 commit into
Conversation
### Description This PR fixes initializer upload on discrete GPUs without Resizable BAR. BufferMapExtendedUsages is now requested only when a host visible device local heap is as large as the largest device local heap. Otherwise initializers use the staged upload. ### Motivation and Context On an AMD Radeon RX 7900 XT without Resizable BAR, the CPU can write directly into only 256 MiB of GPU memory. Dawn's Vulkan backend still offers BufferMapExtendedUsages, so the WebGPU Execution Provider creates every initializer as a mapped storage buffer that must fit in those 256 MiB. Initializers larger than 256 MiB fail with "Allocation size too large", so Qwen3-0.6B FP16 failed to load on that GPU and now loads and runs with this change. Dawn tracks this case in crbug.com/422798184.
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
Author
|
@microsoft-github-policy-service agree company="University of California, Santa Cruz" |
Contributor
Author
|
Jiajia Qin (@qjia7) Yulong Wang (@fs-eire) could you take a look when you have time? This keeps mapped initializer upload for UMA and Resizable BAR GPUs and falls back to the staged upload when the host visible device local heap is smaller than device memory. The CI workflows are waiting for maintainer approval, so I would appreciate it if one of you could approve them as well. |
Jiajia Qin (qjia7)
approved these changes
Sep 29, 2026
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
This PR fixes model loading on discrete GPUs without Resizable BAR. The WebGPU Execution Provider now writes model weights straight into GPU memory only when the CPU can reach all of that memory. Otherwise it copies the weights through a temporary buffer first, which works on every GPU.
Motivation and Context
Without Resizable BAR, the CPU can write to only 256 MiB of GPU memory. On an AMD Radeon RX 7900 XT, Dawn's Vulkan backend still offers BufferMapExtendedUsages, so the WebGPU Execution Provider tried to put every model weight into those 256 MiB. Any weight larger than 256 MiB failed with "Allocation size too large", so Qwen3-0.6B FP16 could not load on that GPU. With this change it loads and runs. Dawn tracks this case in crbug.com/422798184.