What WebGPU provides
A model running in the browser eventually becomes a sequence of GPU operations: matrix multiplications, normalizations, convolutions, attention primitives, quantization operations, data-layout transformations, and many more. [1]
WebGPU makes these operations available across modern browsers through a portable API, while WGSL provides a common language for the shaders that execute them. [2]
Why portability is not performance
Portability, however, does not automatically mean performance. [3]
Two shaders can implement the same operation and produce the same output while behaving completely differently across different accelerators. [4]
What affects performance
Workgroup sizes, memory access patterns, vectorization, data types, and fusion strategies can all affect performance. [5]
The best choice can also change with the input shape, device, browser, and available WebGPU features. [6]
Sources
- The Hugging Face source says: A model running in the browser eventually becomes a sequence of GPU operations: matrix multiplications, normalizations, convolutions, attention primitives, quantization operations, data-layout transformations, and many more. huggingface/kernels: WebGPU Kernels for Local AI
- The Hugging Face source says: WebGPU makes these operations available across modern browsers through a portable API, while WGSL provides a common language for the shaders that execute them. huggingface/kernels: WebGPU Kernels for Local AI
- The Hugging Face source says: Portability, however, does not automatically mean performance. huggingface/kernels: WebGPU Kernels for Local AI
- The Hugging Face source says: Two shaders can implement the same operation and produce the same output while behaving completely differently across different accelerators. huggingface/kernels: WebGPU Kernels for Local AI
- The Hugging Face source says: Workgroup sizes, memory access patterns, vectorization, data types, and fusion strategies can all affect performance. huggingface/kernels: WebGPU Kernels for Local AI
- The Hugging Face source says: The best choice can also change with the input shape, device, browser, and available WebGPU features. huggingface/kernels: WebGPU Kernels for Local AI