code wiki / (root) / nx_q4k_dot_simd.nx

nx_q4k_dot_simd.nx

buildroot/runtime/nx_q4k_dot_simd.nx

6723 B165 linesdepth 8pulls 17 transitivereach 0 importersview sourcekind tooltopic q4k
docsdependenciesstructsconstsfunctions

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 14 imports · 0 importers

nx_syscalls.nx nx_tier.nx nx_le.nx nx_strconv.nx nx_tensor.nx nx_gguf.nx nx_gguf_load.nx nx_gguf_meta.nx nx_placement.nx nx_gguf_load_lazy.nx nx_q4k_dot_simd.nx

diagram shows first 10 each side; +4 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.nxnx_q4k_dot_simd_lib.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_openat_rd sys_mmap nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ sys_read sys_close nx_gguf_parse nx_le_read_u32 nx_le_read_u64 nx_le_read_u32 ↻ _gguf_skip_value nx_le_read_u64 ↻ nx_le_read_u32 ↻ _gguf_skip_value ↻ sys_mmap ↻ nx_gguf_find_tensor nx_gguf_tensor_at nx_gguf_name_equals nx_gguf_tensor_at ↻ ds_synth ds_pack4 nx_q4k_sc_precompute nx_q4k_iter_alloc sys_mmap ↻ nx_q4k_dot_row_col nx_q4k_iter_init nx_le_read_u16

structs

none

consts

none

functions

25func ds_emit(fd: i64, key: *u8, kl: i64, v: i64) -> i64
43func ds_synth(buf: *u8, nb: i64) -> i64
called by 1: main
65func main(argc: i64, argv: *i64) -> i64