code wiki / (root) / nx_q5k_dot_simd.nx

nx_q5k_dot_simd.nx

buildroot/runtime/nx_q5k_dot_simd.nx

9977 B254 linesdepth 8pulls 14 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_q5k_dot_simd.nx -- SIMD-accelerated Q5_K fused dot (vpmaddwd), bit-exact vs a scalar Q5_K dot. Extends the perf-exceed to the Q5_K layer matmuls (attn_v/output/ffn_down). Q5_K = Q4_K + a 5th bit from qh: q5 = q4 + (qh_bit ? 16 : 0). Reformulation is the same: dot += d1*sq - m0*sc, sq = Σ q5*col via vpmaddwd (q5 i16 0..31, col i16 Q10). Read-once + sc-precompute like nx_q4k_dot_simd. Includes an inline scalar Q5_K dot as the bit-exact oracle. Verified on real blk.0.attn_v + measured. license_tier: ORIGINAL

dependencies 11 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_q5k_dot_simd.nx

diagram shows first 10 each side; +1 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_clock.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 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 ↻ q5s_pack4 q5k_dot_scalar _gguf_f16_to_q24 nx_le_read_u16 q5s_scmin nx_le_read_u8 nx_le_read_u8 ↻ q5k_dot_simd _gguf_f16_to_q24 ↻ nx_le_read_u16 ↻ q5s_scmin ↻ nx_le_read_u8 ↻ q5s_hsum nx_clock_monotonic_ns sys_mmap ↻ sys_clock_gettime_mono sys_openat_wr q5s_emit sys_mmap ↻ nx_strconv_format_i64 sys_write

structs

none

consts

none

functions

20func q5s_pack4(a: i64, b: i64, c: i64, d: i64) -> i64
called by 1: main
24func q5s_hsum(acc: *i64) -> i64
called by 1: q5k_dot_simd
40func q5s_scmin(buf: *u8, scales_off: i64, j: i64, out: *i64) -> i64
53func q5k_dot_scalar(buf: *u8, base_off: i64, n_blocks: i64, col_q10: *i64, sm: *i64) -> i64
97func q5k_dot_simd(buf: *u8, base_off: i64, n_blocks: i64, col_i16: *i64,
157func q5s_emit(fd: i64, key: *u8, kl: i64, v: i64) -> i64
171func main() -> i64