w3c / machine-learning-charter

Discussions on a possible charter for a future W3C Working Group developing Machine Learning solutions
https://w3c.github.io/machine-learning-charter/charter.html
9 stars 3 forks source link

WebGPU interoperability #20

Closed anssiko closed 1 year ago

anssiko commented 1 year ago

(Related to the WebML WG Charter in development at https://github.com/w3c/machine-learning-charter/pull/19)

We discussed WebGPU interoperability expectations on our 6 October 2022 call and concluded working with WebGPU contributors is important for the success of the WebNN spec. I'd want us to revise the charter language around WebNN-WebGPU interoperability expectations accordingly.

The initial charter mentions WebGPU in the context of Out of Scope and Coordination as follows:

To avoid overlap with existing work, generic primitives used by traditional machine learning algorithms such as base linear algebra operations are out of scope. The WebGL and WebGPU shaders and WebAssembly SIMD are expected to address these requirements, see the Coordination section for details.

The GPU for the Web Working Group defines a WebGPU Shading Language that may be used to implement traditional machine learning algorithms efficiently. The Web Machine Learning Working Group should coordinate with this group to avoid overlap.

This issue is open to solicit proposals how to update the above. Tagging @RafaelCintron who provided feedback on the call.

anssiko commented 1 year ago

IIRC the text "base linear algebra operations are out of scope" was added to the initial charter to clarify the WebNN API spec does not try to align with the BLAS APIs, referring to the Basic Linear Algebra Subprograms spec. Some of those ops make sense in the WebNN API context, but alignment with the full BLAS API was a non-goal.

We could possibly clarify this text, proposal:

To avoid overlap with existing work, alignment with the Basic Linear Algebra Subprograms (BLAS) interface is out of scope. The WebGL and WebGPU shaders and WebAssembly SIMD are expected to address the BLAS compatibility requirement, see the Coordination section for details.

There are a number of BLAS libraries that could assist in implementation of the WebNN API. Also, there seems to be experimental BLAS implementations using WebGPU https://github.com/milhidaka/webgpu-blas and WebGL https://github.com/waylonflinn/weblas, maybe also a Wasm port exists for some of the libs.