export type Precision = 'f32' | 'f64' export interface MatmulResult { ms: number /** C[0], for a cheap cross-method sanity check. */ sample: number } export interface MatmulMethod { id: string label: string precision: Precision /** Short note shown next to the method (e.g. a precision caveat). */ note?: string /** Runs synchronously long enough (n=2048 naive JS: ~10s+) to freeze the * tab, so BenchmarkRunner dispatches it to a Web Worker instead of * calling run() on the main thread. */ worker?: boolean /** Methods backed by a pthread-capable WASM module run in a dedicated * classic worker (threadedClient), keyed by this registry kind * ('matmul-mt' | 'blis-st' | 'blis-mt'); BenchmarkRunner dispatches these * specially and their run() is unused. Threaded kinds also require * crossOriginIsolated. */ threadedKind?: 'matmul-mt' | 'blis-st' | 'blis-mt' available(): boolean run?(n: number, a: Float64Array, b: Float64Array): Promise } export function gflops(n: number, ms: number): number { return (2 * n * n * n) / (ms / 1000) / 1e9 }