Expand description
OxiCUDA WebGPU backend — cross-platform GPU compute via wgpu and WGSL.
Provides a WebGpuBackend that implements the oxicuda_backend::ComputeBackend trait
from oxicuda-backend, using wgpu to target Vulkan, Metal, Direct3D 12,
and the browser WebGPU API from a single Rust crate.
§Quick Start
use oxicuda_webgpu::WebGpuBackend;
use oxicuda_backend::ComputeBackend;
let mut backend = WebGpuBackend::new();
backend.init().expect("WebGPU init failed");
// Allocate 1 KiB on the GPU.
let ptr = backend.alloc(1024).expect("alloc failed");
backend.free(ptr).expect("free failed");§Architecture
┌──────────────────────────────────────────┐
│ WebGpuBackend │
│ (implements ComputeBackend) │
└──────────────┬───────────────────────────┘
│
┌────────▼────────┐
│ WebGpuDevice │ ← wgpu Instance + Adapter + Device + Queue
└────────┬────────┘
│
┌───────────▼────────────┐
│ WebGpuMemoryManager │ ← buffer pool (u64 handle → wgpu::Buffer)
└────────────────────────┘§WGSL Shader Generation
The shader module provides helpers that produce WGSL source strings for
common kernels (GEMM, element-wise ops, reductions).
Re-exports§
pub use backend::WebGpuBackend;pub use error::WebGpuError;pub use error::WebGpuResult;
Modules§
- backend
WebGpuBackend— the main entry point for the oxicuda-webgpu crate.- device
- WebGPU device wrapper — owns the wgpu instance, adapter, device, and queue.
- error
- Error types for the oxicuda-webgpu backend.
- memory
- WebGPU buffer manager — allocates, copies, and frees
wgpu::Bufferobjects through an opaqueu64handle interface that mirrors the CUDA device-pointer model used by the rest of OxiCUDA. - shader
- WGSL shader source generation for common compute kernels.
- wasm
- WASM target support for browser-based GPU compute via WebGPU.