Repository navigation
[WebGPU] Fix plugin tensor conversion for CPU memory descriptors - #33634
Open
Yang Gu (gyagp) wants to merge 1 commit into
Open
Yang Gu (gyagp) wants to merge 1 commit into
Yang Gu (gyagp) wants to merge 1 commit into
Conversation
Use the device memory type when reconstructing OrtDevice from an API tensor, preserving the separate OrtMemType field so valid CPU descriptors pass the existing constructor validation. Add a plugin inference regression, including profiling that confirms MemcpyFromHost executes for CPU input descriptors. Select the registered plugin by library path in the C# package smoke test. Fixes microsoft#33557.
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
Author
|
/run bots |
Contributor
|
The request was received. Approve workflow runs. Thanks. |
This branch has not been deployed
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
CPU tensors created with C#'s default
OrtMemType.Cpudescriptor can terminate the process when a WebGPU plugin kernel converts them through the EP API adapter. The adapter passes theOrtMemTypevalue (-1) intoOrtDevice::MemoryType, whose valid values are 0 and 5. Validation then throws through anoexceptdelegating constructor.Use
GetDeviceMemoryType()when reconstructingOrtDevice, while preserving the separateOrtMemTypefield. Valid CPU and host-accessible descriptors then pass the existing constructor validation.Add regression coverage for WebGPU inference with default, CPU-input, CPU-output, and host-accessible memory descriptors. The inference graph consumes one input on both CPU and GPU, and profiling must confirm execution of
MemcpyFromHost. The C# package smoke test now selects the registered plugin by library path, preventing built-in WebGPU from satisfying the test accidentally.Motivation and Context
Addresses microsoft/onnxruntime#33557 by fixing the erroneous memory-type conversion before constructor validation.
Validation
git diff --checkpass.onnxruntime_provider_testpassed with the originalOrtDeviceheader retained.WebGpuPluginSharedAllocatorTest.InferenceWithCpuTensorMemoryTypespassed on macOS arm64 with the originalnoexceptdeclaration retained. It covers four memory descriptors and verifies four actual WebGPUMemcpyFromHostexecutions through profiling.