skip to content
==> README.md <==
1# @ajax/mesh-ref-matmul
2
3programs/matmul's exact mode on the CPU, the seed of GPU inference: f32 matrices from a counter hash,
4`C = A B` with every element a sequential sum over k from +0.0 (a correctly rounded multiply, then a
5correctly rounded add, both in the cluster float mode, never fused), and `y = A x` in the GPU's
6warp-strided order (lane l sums k = l, l + 32, … then the warp butterfly). `mesh_matmul_digest` is the
7FNV-1a 64 the checkers compare.
8
9**Ported from** `crates/mesh-ref/src/matmul.rs`. Host only: `mesh_matmul` splits rows over POSIX threads
10(the result is the same for any thread count).
11
12**Tested** by matmul.rs's test, ported, and a golden digest from the Rust over matmul and matvec at four
13shapes plus a thousand matrix values.
14
15## Differences
16
17- Rust uses scoped threads; here POSIX threads, and if a thread can't be started its rows run on the
18  caller's thread. Outputs go to a caller buffer instead of a returned `Vec`.