programs/matmul's exact mode on the CPU: counter-hash matrices, C = A B and y = A x in the GPU's summation order, the FNV digest
$ sexc add @ajax/mesh-ref-matmul- total 3
- drwxr-xr-x-../
- drwxr-xr-x-Oct 27 01:59v/# 1 version
- drwxr-xr-x-Oct 27 01:59files/# the files of 0.1.0
- latest
- 0.1.0, published Oct 27 01:59 by ajax
- owners
- ajax
- license
- MIT
- dependencies
- @ajax/mesh-ftz ^0.1.0, @ajax/mesh-ref-block ^0.1.0
- dependents
- @ajax/mesh-ref-gpt2, @ajax/mesh-ref-gpt2-weights
- keywords
- alphaos mesh reference matmul gemv determinism
- homepage
- https://github.com/thomasdavis/alpha-c-mesh/tree/main/packages/mesh-ref-matmul
- repository
- https://github.com/thomasdavis/alpha-c-mesh
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`.