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 browser GPU API, shipping in Chrome 113+ and Firefox
nightly. 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 does not support f64 natively, so this library currently
implements single-precision (f32) routines only.
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 processing one element). 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 browser GPU API, shipping in Chrome 113+ and Firefox nightly. 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 processing one element). 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