code wiki / (root) / nx_f32_q4k_matmul_test.nx

nx_f32_q4k_matmul_test.nx

buildroot/runtime/nx_f32_q4k_matmul_test.nx

5581 B141 linesdepth 9pulls 22 transitivereach 0 importersview sourcekind gate/prooftopic f32
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_tier.nx nx_le.nx nx_gguf_load.nx nx_f32.nx nx_q4k_to_f32.nx nx_f32_q4k_matmul.nx nx_f32_q4k_matmul_test.nx

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

main nx_fq4m_verdict_is_valid sys_mmap _write_block nx_le_write_u16 _fill_a_row nx_f32_q4k_matmul fq4m_rows sys_mmap ↻ _fq4m_pack_a nx_q4k_to_f32_packed nx_q4k_block_to_f32_packed nx_le_read_u16 nx_f16_to_f32 nx_le_read_u8 nx_i32_to_f32 _q4kp_st4 sys_munmap nx_f32_q4k_matmul_mt nx_hw_worker_count nx_hw_cpu_count sys_mmap ↻ sys_munmap ↻ nx_f32_q4k_matmul ↻ nx_pool_new nx_hw_worker_count ↻ sys_mmap ↻ nx_chan_new sys_mmap ↻ _nx_chan_cell sys_thread_create nx_thread_spawn sys_mmap ↻ nx_thread_spawn_fn sys_mmap ↻ nx_f32_q4k_matmul_pool sys_mmap ↻ nx_pool_n_completed nx_atom_load_i64 nx_pool_submit

structs

none

consts

none

functions

42func _write_block(buf: *u8, off: i64) -> i64
called by 1: main calls 1: nx_le_write_u16
69func _fill_a_row(A: *i64, row_off: i64, v_bits: i64) -> i64
called by 1: main
81func main() -> i64