onnxruntime icon indicating copy to clipboard operation
onnxruntime copied to clipboard

[WebGPU] Register DataTransfer to Env

Open qjia7 opened this issue 2 months ago • 4 comments

This pull request adds a C API for WebGPU data transfer, enabling tensor copying between CPU and GPU devices via the WebGPU execution provider. The main changes introduce a wrapper implementation for data transfer, integrate it with the plugin execution provider factory, and expose a creation function for use by the ONNX Runtime core.

qjia7 avatar Oct 30 '25 06:10 qjia7

Please add override CreateDataTransfer: https://github.com/microsoft/onnxruntime/blob/c30905d638418383b8d83b3b1bb65b7b42226f5a/onnxruntime/core/session/plugin_ep/ep_factory_internal_impl.h#L56-L59

in class WebGpuEpFactory (file in https://github.com/Microsoft/onnxruntime/blob/main/onnxruntime/core/session/plugin_ep/ep_factory_webgpu.h) for the purpose of this change.

fs-eire avatar Nov 13 '25 01:11 fs-eire

Please add override CreateDataTransfer:

https://github.com/microsoft/onnxruntime/blob/c30905d638418383b8d83b3b1bb65b7b42226f5a/onnxruntime/core/session/plugin_ep/ep_factory_internal_impl.h#L56-L59

in class WebGpuEpFactory (file in https://github.com/Microsoft/onnxruntime/blob/main/onnxruntime/core/session/plugin_ep/ep_factory_webgpu.h) for the purpose of this change.

WebGPU DataTransfer requires a BufferManager. For graph capture, the BufferManager is tied to the execution provider instance not session-independent. That's the problem.

qjia7 avatar Nov 13 '25 03:11 qjia7

Please add override CreateDataTransfer:

https://github.com/microsoft/onnxruntime/blob/c30905d638418383b8d83b3b1bb65b7b42226f5a/onnxruntime/core/session/plugin_ep/ep_factory_internal_impl.h#L56-L59

in class WebGpuEpFactory (file in https://github.com/Microsoft/onnxruntime/blob/main/onnxruntime/core/session/plugin_ep/ep_factory_webgpu.h) for the purpose of this change.

Done. Use the context 0's buffer manager. Will create one if not exist.

qjia7 avatar Nov 17 '25 05:11 qjia7

@fs-eire @guschmue The webgpu related failures have been fixed. Others are not related with my changes. Please take a look, thanks.

qjia7 avatar Nov 25 '25 07:11 qjia7