Enable multi-device WebGPU plugin routing - #32234
Open
Xiaofei Han (xiaofeihan1) wants to merge 2 commits into
Open
Enable multi-device WebGPU plugin routing#32234Xiaofei Han (xiaofeihan1) wants to merge 2 commits into
Xiaofei Han (xiaofeihan1) wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Enables WebGPU plugin routing to distinct Windows D3D12 GPUs using logical device IDs and adapter LUIDs.
Changes:
- Adds per-device discovery metadata, memory information, and Dawn adapter selection.
- Caches contexts and routes allocators/transfers by logical device ID.
- Adds dedicated allocator and manual multi-GPU tests.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
onnxruntime/test/autoep/test_webgpu_allocators.cc |
Adds WebGPU allocator, transfer, and manual multi-GPU tests. |
onnxruntime/test/autoep/test_allocators.cc |
Adjusts includes alongside extracted tests. |
onnxruntime/core/providers/webgpu/webgpu_provider_options.h |
Defines adapter identity configuration keys. |
onnxruntime/core/providers/webgpu/webgpu_provider_factory.cc |
Parses adapter metadata and routes transfers per device. |
onnxruntime/core/providers/webgpu/webgpu_context.h |
Extends context configuration and retention APIs. |
onnxruntime/core/providers/webgpu/webgpu_context.cc |
Selects and validates Dawn adapters by LUID. |
onnxruntime/core/providers/webgpu/ep/factory.h |
Introduces per-device factory state. |
onnxruntime/core/providers/webgpu/ep/factory.cc |
Enumerates devices and creates routed allocators and EPs. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+489
to
+495
| if (src_is_gpu && dst_is_gpu && src_device_id != dst_device_id) { | ||
| return OrtApis::CreateStatus(ORT_INVALID_ARGUMENT, | ||
| "WebGPU does not support direct copies between different devices."); | ||
| } | ||
| const int tensor_context_id = src_is_gpu ? src_device_id : dst_device_id; | ||
| if (tensor_context_id < 0 || (impl.context_id_ >= 0 && tensor_context_id != impl.context_id_)) { | ||
| return OrtApis::CreateStatus(ORT_INVALID_ARGUMENT, "Invalid WebGPU device for tensor copy."); |
Comment on lines
+187
to
+190
| #if defined(_WIN32) && defined(DAWN_ENABLE_D3D12) | ||
| auto adapter_luid = GetHardwareDeviceLuid(*devices[i]); | ||
| if (adapter_luid.has_value()) { | ||
| candidates.push_back({devices[i], adapter_luid}); |
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
Enable the WebGPU plugin EP to route distinct
OrtEpDeviceinstances to distinct physical GPUs on Windows D3D12.OrtMemoryInfoto each discovered GPU.WebGpuContextcreation.RequestAdapterOptionsLUIDand validate its vendor/device identity.WebGpuContextper logical device while continuing to share the Dawn instance.Testing
onnxruntime_autoep_test: 92/92 passedWebGpuPluginSharedAllocatorTest.*:SharedAllocators.*: 7/7 passedgit diff --check: passed