code wiki / (root) / nx_q4k_matmul_bench.nx

nx_q4k_matmul_bench.nx source

↩ module page · 16 lines · 723 B

1// nx_q4k_matmul_bench.nx -- fused vs materialize-then-dot bench. 2// 3// Compares the two paths for a K=2048 row × col dot product 4// (8 Q4_K super-blocks = ~3 KB of quantized weights): 5// 6// Path A: nx_gguf_dequant_q4_k(buf, ..., scratch_2048) + 7// manual scalar dot product over scratch_2048 vs col_2048 8// Path B: nx_q4k_dot_row_col(buf, ..., col_2048, iter) fused 9// 10// Honest framing: numbers are on qemu-riscv64 emulation; this is OUR 11// own two paths compared, NOT a claim against ggml/llama.cpp/CUDA. 12// Comparison against external frameworks requires running them on 13// the same hardware. 14 15const NX_QMB_N_BLOCKS: i64 = 8 // K_dim / 256 16const NX_QMB_K_RUNS: i64 = 256 // bench iterations