Planning data for the benchmark sweeps, kept as JSON so it can be read by
tools as well as people. The roofline reads routine_params.json's levels
and FLOP counts (benchmarks/results-reader.mjs); nothing else reads them.
routine_params.json — each routine's real parameters (from
src/<routine>/<routine>.mjs) with its BLAS level and each parameter's
role: size, scalar, increment, leading-dimension, flag,
layout or data; and, for routines whose benchmarks record bytes but
not FLOPs, flops: the standard BLAS FLOP count as a formula over the
sizes a result row records (n, m, k, order) and bytes.
params.json — derived from it: every unique parameter name,
the ones excluded as sweep axes (data, and size, which every
benchmark already sweeps), and the remaining sweep candidates grouped by
role, each with an expected-effect priority, the baseline it's pinned to
while other parameters are swept, and the levels its own sweep walks.
Both predate the double-precision ports: they cover the 26 single-precision
routines plus dasum and idamax, not the other f64 routines or cscal.
docs/google53e32ad8e8c1b544.html
The file Google Search Console fetches to verify site ownership. It has to
sit at the docs root, but TypeDoc wipes docs/ on every build, so it
lives here and scripts/gen-sitemap.mjs (run by npm run docs) copies it
into docs/ after each build.
docs/runner.js
Loaded by TypeDoc as a custom JS file on every docs page (customJs in
typedoc.json, served as assets/custom.js with <script defer>, so one
pass after the page is parsed finds everything). It turns two kinds of
code blocks into live, editable, runnable examples — no leaving the page —
and mounts the benchmark viewer (bench.js) and the browser test runner
(browser-tests/) on the pages with their placeholders:
Code blocks containing import — edited and run against the real
wgblas bundle, with console output captured below the block.
HTML blocks starting with <!doctype html> — edited and rendered
live in a sandboxed <iframe> below the block.
How It Works
On page load runner.js walks every <pre> element looking for a
qualifying block. For each match it:
Injects a ▶ Run button — in the block's top-left corner, clear of
TypeDoc's own top-right "Copy" button.
Swaps in an editable CodeMirror 5 editor — loaded once from unpkg
(pinned version, CM_VERSION) and shared by every block on the page,
with its theme kept in step with the site's light/dark switch. Until it
finishes loading (or if it fails to), Run still works against the
original static text — the editor is progressive enhancement, not a
dependency.
On click, for a JS block:
Stops with a warning if navigator.gpu isn't available.
Loads wgblas.browser.js from the docs root on the first click (the
IIFE bundle scripts/build-browser.mjs publishes there), shared by
every block afterwards.
Transforms imports — removes every named import from wgblas or
wgblas/... in the current editor contents and gathers the names
into one const { a, b } = window.wgblas; at the top. Only named
imports (import { … }) are handled — default and namespace imports
are left as-is and will fail to run.
Runs the result as the body of an async function (so top-level
await works, and the code sees only globals), capturing
console.log/warn/error/table output (typed arrays and tables
formatted for readability) into a panel below the block; a thrown
error shows there as ❌ <message>.
Calls wgblas.cleanup() afterwards, so every run starts on a fresh
device.
On click, for an HTML block:
Takes the current editor contents, injects a small <style> block
matching the site's active light/dark theme (the iframe's document is
separate from the parent page and doesn't inherit its CSS), and
assigns it to an <iframe srcdoc> — reassigning srcdoc reloads the
iframe, so re-running executes the page fresh each click.
Why window.wgblas
ES module import statements can't run outside a module: they're static
declarations, resolved before the code runs. The transform replaces them
with destructuring assignments against window.wgblas, the global the
IIFE bundle registers on load. That gives code that can run in a function
body while the source still reads like normal module imports.
Static assets embedded in the wgblas docs site.
Folder Structure
routines/Planning data for the benchmark sweeps, kept as JSON so it can be read by tools as well as people. The roofline reads
routine_params.json's levels and FLOP counts (benchmarks/results-reader.mjs); nothing else reads them.routine_params.json— each routine's real parameters (fromsrc/<routine>/<routine>.mjs) with its BLAS level and each parameter's role:size,scalar,increment,leading-dimension,flag,layoutordata; and, for routines whose benchmarks record bytes but not FLOPs,flops: the standard BLAS FLOP count as a formula over the sizes a result row records (n,m,k,order) andbytes.params.json— derived from it: every unique parameter name, the ones excluded as sweep axes (data, andsize, which every benchmark already sweeps), and the remaining sweep candidates grouped by role, each with an expected-effect priority, the baseline it's pinned to while other parameters are swept, and the levels its own sweep walks.Both predate the double-precision ports: they cover the 26 single-precision routines plus
dasumandidamax, not the other f64 routines orcscal.docs/google53e32ad8e8c1b544.htmlThe file Google Search Console fetches to verify site ownership. It has to sit at the docs root, but TypeDoc wipes
docs/on every build, so it lives here andscripts/gen-sitemap.mjs(run bynpm run docs) copies it intodocs/after each build.docs/runner.jsLoaded by TypeDoc as a custom JS file on every docs page (
customJsintypedoc.json, served asassets/custom.jswith<script defer>, so one pass after the page is parsed finds everything). It turns two kinds of code blocks into live, editable, runnable examples — no leaving the page — and mounts the benchmark viewer (bench.js) and the browser test runner (browser-tests/) on the pages with their placeholders:import— edited and run against the realwgblasbundle, with console output captured below the block.<!doctype html>— edited and rendered live in a sandboxed<iframe>below the block.How It Works
On page load
runner.jswalks every<pre>element looking for a qualifying block. For each match it:CM_VERSION) and shared by every block on the page, with its theme kept in step with the site's light/dark switch. Until it finishes loading (or if it fails to), Run still works against the original static text — the editor is progressive enhancement, not a dependency.navigator.gpuisn't available.wgblas.browser.jsfrom the docs root on the first click (the IIFE bundlescripts/build-browser.mjspublishes there), shared by every block afterwards.wgblasorwgblas/...in the current editor contents and gathers the names into oneconst { a, b } = window.wgblas;at the top. Only named imports (import { … }) are handled — default and namespace imports are left as-is and will fail to run.asyncfunction (so top-levelawaitworks, and the code sees only globals), capturingconsole.log/warn/error/tableoutput (typed arrays and tables formatted for readability) into a panel below the block; a thrown error shows there as❌ <message>.wgblas.cleanup()afterwards, so every run starts on a fresh device.<style>block matching the site's active light/dark theme (the iframe's document is separate from the parent page and doesn't inherit its CSS), and assigns it to an<iframe srcdoc>— reassigningsrcdocreloads the iframe, so re-running executes the page fresh each click.Why
window.wgblasES module
importstatements can't run outside a module: they're static declarations, resolved before the code runs. The transform replaces them with destructuring assignments againstwindow.wgblas, the global the IIFE bundle registers on load. That gives code that can run in a function body while the source still reads like normal module imports.