-
Notifications
You must be signed in to change notification settings - Fork 368
Description
According to webmachinelearning/webnn#6, ML framework authors require a way to write custom ops (operations) that can interop with the built-in neural net ops of WebNN. That means having high-performance data exchange between custom ops and built-in ops.
In order to answer this requirement, in particular when the custom ops are written in WebGPU shaders, WebNN adds the device selection capability and the support for GPU resources from WebGPU and WebGL in webmachinelearning/webnn#162.
Specifically, developers are able to create an MLContext from a specific GPUDevice that is already in use by the application. In such case, developers could use the corresponding GPUBuffer resources as MLGraph constants, and use the GPUTexture and GPUBuffer as the inputs and outputs of MLGraph.compute. These GPU resources must be created from the same GPUDevice.
This interop capability of WebNN / WebGPU is also useful for integration with real-time video processing, where developers might want to establish a full-GPU-only pipeline by importing a video frame to GPUExternalTexture and feeding into WebNN graph compute.
Given those and thanks to @Kangz 's suggestion, this issue is opened for the coordination and investigation between WebGPU and WebNN groups on this topic.