ringkernel-wgpu
WebGPU backend for RingKernel.
Overview
This crate provides cross-platform GPU compute support for RingKernel via WebGPU (wgpu). It works across Vulkan, Metal, DX12, and browser environments.
Requirements
- A GPU supporting Vulkan 1.2, Metal, or DirectX 12
- For browsers: WebGPU-enabled browser (Chrome 113+, Firefox 118+)
Features
- Cross-platform GPU access (Windows, macOS, Linux, Web)
- WGSL (WebGPU Shading Language) compute shaders
- Event-driven execution model
- Automatic backend selection (Vulkan → Metal → DX12)
Limitations
Compared to the CUDA backend:
- No persistent kernels: WebGPU doesn't support cooperative groups; kernels are dispatched per batch
- No 64-bit atomics: Counters use lo/hi u32 pair emulation
- No kernel-to-kernel messaging: K2K is not supported in WebGPU's execution model
- Event-driven only: Must re-dispatch for continuous processing
Usage
use WgpuRuntime;
async
Exports
| Type | Description |
|---|---|
WgpuRuntime |
Main runtime implementing RingKernelRuntime |
WgpuAdapter |
GPU adapter handle |
WgpuKernel |
Compiled compute pipeline |
WgpuBuffer |
GPU buffer wrapper |
Testing
# Requires WebGPU-capable GPU
Browser Support
When targeting WebAssembly, the runtime automatically detects the browser's WebGPU support and configures accordingly.
License
Apache-2.0