Skip to Main Content
Talk Beginner Apache License, Version 2.0 (https://opensource.org/license/apache-2.0) First Talk

wgblas: A BLAS Library for WebGPU

Proposal status is Review Pending
Session Description

Browsers finally have real GPU access through WebGPU, but there’s nothing built on top of it for actual number crunching. If you’re writing JS and need matrix math on the GPU, you’re stuck inside whatever ops a framework like TensorFlow.js happens to expose, or you fall back to the CPU.

I built wgblas to fix that: BLAS Levels 1 through 3, written in WGSL, callable from plain JavaScript, on npm, benchmarked against cuBLAS on the same GPU.

I’ll talk through the decisions that mattered early on (a utils layer so WebGPU’s boilerplate doesn’t leak into every routine, GPU-resident vector/matrix types, TypeScript from day one), and the part that actually ate most of my time: getting correctness right. Every routine is tested against stdlib-js’s CPU BLAS, and early on I kept hitting failures that looked like bugs but turned out to be real GPU floating-point quirks (signed zero, flush-to-zero, FMA rounding) that a naive comparison just gets wrong. I’ll also cover emulating double precision on hardware that doesn’t have it, using Dekker arithmetic, and how I benchmark fairly against cuBLAS.

Key Takeaways
  • What actually matters architecturally when you’re building a BLAS on a platform that’s never had one.

  • How to test GPU numerical code against a CPU reference when the two legitimately disagree and both are correct.

  • GPU floating-point gotchas that’ll bite you in any GPU numerical work, not just this.

  • Getting double precision out of hardware that only has f32.

References

Session Categories

Introducing a FOSS project or a new version of a popular project
Technology architecture
Talk License: Apache License, Version 2.0 (https://opensource.org/license/apache-2.0)
Speakers are hidden and anonymized for this event.