nx_f32_q4k_matmul_test.nx
buildroot/runtime/nx_f32_q4k_matmul_test.nx
about
nx_f32_q4k_matmul_test.nx -- smoke for nx_f32_q4k_matmul.nx.
REWRITTEN 2026-07-07 to the organ's CURRENT axis semantics: B is n
WEIGHT ROWS, each row = k quantized values ((k/256) super-blocks,
144 B each), C[i,j] = dot(A[i,:], dequant(row j)). The previous
version of this test encoded the OLD transposed [in,out] layout
(k=1, one block along n) -- after the k-axis fix landed in the
organ, that shape trips ERR_ALIGN (k=1 is not 256-aligned) and the
test had been failing exit 23 UNNOTICED (found 2026-07-07 during
the threading arc's consumer sweep; serving-ne-working class).
Builds a synthetic Q4_K super-block whose dequantized values are
2.0 at position 0, 3.0 at position 32, 4.0 at position 128, and 0
everywhere else (ggml 32-byte-group nibble layout, see
nx_q4k_to_f32_test.nx).
Tests (all operands small exact integers -> f32 math is bit-exact):
1. m=1, k=256, n=1: A = 1.0 at [0],[32],[128] -> C[0] = 2+3+4 = 9.0;
then A[0]=2.0 -> C[0] = 11.0 (input scaling).
2. n=2 identical rows -> C[0] = C[1] = 9.0 (row offset stride 144).
3. m=2 (second A row doubled) -> row0 gets 9.0s, row1 gets 18.0s.
4. k not 256-aligned -> NX_FQ4M_ERR_ALIGN.
5. MT cross-check: nx_f32_q4k_matmul_mt (2 workers) bit-equals the
serial result on the n=2 shape (full adversarial coverage lives
in nx_q4k_matmul_mt_gate).
dependencies 7 imports · 0 importers
imports: nx_syscalls.nxnx_tier.nxnx_le.nxnx_gguf_load.nxnx_f32.nxnx_q4k_to_f32.nxnx_f32_q4k_matmul.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| none |
functions
| 42 | func _write_block(buf: *u8, off: i64) -> i64 |
| 69 | func _fill_a_row(A: *i64, row_off: i64, v_bits: i64) -> i64 called by 1: main |
| 81 | func main() -> i64 |