nx_q4k_dot_simd.nx
buildroot/runtime/nx_q4k_dot_simd.nx
about
nx_q4k_dot_simd.nx -- SIMD-accelerated Q4_K fused dot (vpmaddwd), bit-exact vs nx_q4k_dot_row_col.
Perf-exceed applied to the Qwen GEMM. Reformulation (exact integer algebra): per sub-block,
dot += Σ (d1*q - m0)*col = d1*(Σ q*col) - m0*(Σ col) = d1*sq - m0*sc
sq = Σ q*col via one vpmaddwd accumulate (q i16 0..15, col i16 Q10). Optimizations vs v1: read qs bytes
ONCE (extract lo+hi together), and take sc = Σ col from a PRECOMPUTED sub-block table (activation-only,
constant across the dot -- free in a GEMM). col: both Q10 i64 (unused now except pack) + i16-packed.
license_tier: ORIGINAL
dependencies 13 imports · 0 importers
diagram shows first 10 each side; +3 more imports, +0 more importers in the complete lists below.
imports: nx_syscalls.nxnx_tier.nxnx_le.nxnx_strconv.nxnx_tensor.nxnx_gguf.nxnx_gguf_load.nxnx_gguf_meta.nxnx_placement.nxnx_gguf_load_lazy.nxnx_q4k_matmul.nxnx_dequant_iter.nxnx_clock.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
| 23 | func ds_pack4(a: i64, b: i64, c: i64, d: i64) -> i64 |
| 27 | func ds_hsum(acc: *i64) -> i64 called by 1: nx_q4k_dot_simd |
| 43 | func nx_q4k_sc_precompute(col_q10: *i64, n_blocks: i64, sc_pre: *i64) -> i64 called by 1: main |
| 60 | func nx_q4k_dot_simd(buf: *u8, base_off: i64, n_blocks: i64, col_i16: *i64, |
| 135 | func ds_emit(fd: i64, key: *u8, kl: i64, v: i64) -> i64 |
| 153 | func ds_synth(buf: *u8, nb: i64) -> i64 called by 1: main |
| 175 | func main(argc: i64, argv: *i64) -> i64 |