code wiki / (root) / nx_q4k_linear_hp.nx

nx_q4k_linear_hp.nx

buildroot/runtime/nx_q4k_linear_hp.nx

5283 B139 linesdepth 9pulls 22 transitivereach 0 importersview sourcekind tooltopic q4k
docsdependenciesstructsconstsfunctions

about

nx_q4k_linear_hp.nx -- higher-precision integer linear (Q14 activation -> Q24 output). sd-server -> Nishi migration (precision upgrade for the finding: Q10 activation quant is amplified by SwiGLU -> FFN worst 3.3%). Uses a Q14 activation (4 more fractional bits) and keeps the output at Q24 (dot is Q24-weight x Q14-act = Q38 -> >>14 -> Q24) instead of collapsing to Q10. Test: on real blk.0.attn_q, compare the Q14/Q24 path vs the Q10 path against the FULL-precision-activation f32 dot -> the hp path's total error must be smaller (the precision knob works). license_tier: ORIGINAL

dependencies 17 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_linear_hp.nx

diagram shows first 10 each side; +7 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_q4k_linear.nxnx_q4k_to_f32.nxnx_f32.nxnx_f32_cvt.nxnx_f32_div.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 ↻ nx_q10_to_f32 nx_i32_to_f32 _gguf_f32_to_q10 _gguf_f32_to_q14 nx_q4k_iter_alloc sys_mmap ↻ nx_q4k_linear nx_q4k_dot_row_col nx_q4k_iter_init nx_le_read_u16 _gguf_f16_to_q24 nx_le_read_u8 nx_q4k_iter_scale _q4k_iter_scale_at nx_q4k_iter_min _q4k_iter_min_at nx_le_read_u8 ↻ nx_q4km_q20_to_q10 nx_q4k_linear_hp nx_q4k_dot_row_col ↻ nx_q4k_to_f32 nx_q4k_block_to_f32

structs

none

consts

none

functions

27func hp_q24_to_f32(q24: i64) -> i64
called by 1: main calls 2: nx_f32_divnx_i32_to_f32
32func nx_q4k_linear_hp(buf: *u8, w_off: i64, out_dim: i64, in_dim: i64,
called by 1: main calls 1: nx_q4k_dot_row_col
50func hp_emit(fd: i64, key: *u8, kl: i64, v: i64) -> i64
64func main() -> i64