Expand description
Run handwired circuits as WebGPU compute shaders.
A program becomes one WGSL compute shader that evaluates one record per
invocation, so a batch of records, e.g. 100,000 documents to score, runs
in parallel. The shader reproduces the CPU reference evaluator’s values
bit for bit, within the limits in wgsl’s documentation.
let gpu = handwired_rs_gpu::Gpu::new().unwrap();
let batch = handwired_rs_gpu::GpuBatch::new(&gpu, &pick_circuit()).unwrap();
let results = batch.run(&gpu, &[(1,), (5,), (200,)]).unwrap();
assert_eq!(results, vec![12, 10, 10]);Modules§
- wgsl
- WGSL for a compiled tensor program: one compute invocation per record, one
letper operation, in the executor’s order.
Structs§
- Gpu
- A GPU device and its queue.
- GpuBatch
- A
#[handwired]function’s circuit on the GPU, run on typed arguments. - GpuProgram
- A compiled program on the GPU: the shader pipeline and its constant tables.