A repo tour for contributors, learners, and anyone curious how a GPU BLAS
library is built. Each section mirrors a major folder or system in the
repository and explains the reasoning behind it — not just what the code
does, but why it is shaped the way it is.
How These Docs Are Organized
The sidebar's top-level modules mirror the repository's top-level folders.
devdocs stands in for src/ — the module you're reading right now is a
narrated walkthrough of it, with devdocs/blas-routines and
devdocs/shaders covering src/index.mjs and src/shaders/
respectively. Its siblings — assets, benchmarks, examples, scripts,
tests — each document the identically-named top-level folder.
docs is the one exception: it's the public API reference generated from
index.d.mts, not a tour of the top-level docs/ folder. That folder is
this site's own generated output — the two just happen to share a name.
What is BLAS?
BLAS (Basic Linear Algebra Subprograms) is a standard API for vector and
matrix operations — dot products, norms, scalar multiplies, matrix-vector
products. It is the computational backbone of numerical computing, machine
learning frameworks, and scientific software. The reference spec lives at
netlib.org/blas.
GPUs are well-suited for BLAS: operations like saxpy (y = αx + y) are
embarrassingly parallel — each element is independent — so thousands of GPU
threads can work simultaneously. NVIDIA's
cuBLAS is the canonical example;
this library applies the same idea to the browser via WebGPU.
What is WebGPU?
WebGPU is the modern GPU API for JavaScript — shipping in Chrome and Edge
(113+), Safari (26+) and Firefox (141+, Windows first), and available in
Node.js through Dawn (the webgpu npm package, which is what this
library's tests and benchmarks run on). It lets JavaScript programs upload
data to the GPU, run compute programs on it, and read results back —
without plugins or native code.
Note: WGSL has no native f64, so the double-precision d* routines
emulate it with double-double arithmetic: each value is a pair of f32s
(hi + lo), giving about 48 bits of significand but f32's exponent range
— close to, not identical to, IEEE double. See
devdocs/utility-functions/f64 for the host-side split and merge.
What is a compute shader?
Each routine runs a compute shader written in WGSL (a GPU program that
runs thousands of instances in parallel, each handling a slice of the
work — one element, a strided run of elements, or a tile). WebGPU
has vertex and fragment shaders for graphics too — compute shaders are
specifically for general computation. This library only uses compute shaders,
so we call them simply "shaders" throughout.
New to GPU programming?
Read these two chapters from the CUDA Programming Guide — the mental models
transfer directly to WebGPU; only the terminology changes. Then come back here.
Introduction —
why GPUs exist, GPU vs CPU design philosophy
A repo tour for contributors, learners, and anyone curious how a GPU BLAS library is built. Each section mirrors a major folder or system in the repository and explains the reasoning behind it — not just what the code does, but why it is shaped the way it is.
How These Docs Are Organized
The sidebar's top-level modules mirror the repository's top-level folders.
devdocsstands in forsrc/— the module you're reading right now is a narrated walkthrough of it, withdevdocs/blas-routinesanddevdocs/shaderscoveringsrc/index.mjsandsrc/shaders/respectively. Its siblings —assets,benchmarks,examples,scripts,tests— each document the identically-named top-level folder.docsis the one exception: it's the public API reference generated fromindex.d.mts, not a tour of the top-leveldocs/folder. That folder is this site's own generated output — the two just happen to share a name.What is BLAS?
BLAS (Basic Linear Algebra Subprograms) is a standard API for vector and matrix operations — dot products, norms, scalar multiplies, matrix-vector products. It is the computational backbone of numerical computing, machine learning frameworks, and scientific software. The reference spec lives at netlib.org/blas.
GPUs are well-suited for BLAS: operations like saxpy (y = αx + y) are embarrassingly parallel — each element is independent — so thousands of GPU threads can work simultaneously. NVIDIA's cuBLAS is the canonical example; this library applies the same idea to the browser via WebGPU.
What is WebGPU?
WebGPU is the modern GPU API for JavaScript — shipping in Chrome and Edge (113+), Safari (26+) and Firefox (141+, Windows first), and available in Node.js through Dawn (the
webgpunpm package, which is what this library's tests and benchmarks run on). It lets JavaScript programs upload data to the GPU, run compute programs on it, and read results back — without plugins or native code.What is a compute shader?
Each routine runs a compute shader written in WGSL (a GPU program that runs thousands of instances in parallel, each handling a slice of the work — one element, a strided run of elements, or a tile). WebGPU has vertex and fragment shaders for graphics too — compute shaders are specifically for general computation. This library only uses compute shaders, so we call them simply "shaders" throughout.
New to GPU programming?
Read these two chapters from the CUDA Programming Guide — the mental models transfer directly to WebGPU; only the terminology changes. Then come back here.
CUDA → WebGPU terminology
__global__function@computeshaderthreadIdx.xlocal_invocation_idblockIdx.xworkgroup_idblockDim.x@workgroup_size(N)var<workgroup>cudaMemcpyhost→devicedevice.queue.writeBuffercudaMemcpydevice→hostmapAsync+getMappedRangeWebGPU resources
Further reading