code wiki / (root) / nx_q4k_ggml_kat.nx

nx_q4k_ggml_kat.nx

buildroot/runtime/nx_q4k_ggml_kat.nx

41534 B342 linesdepth 8pulls 16 transitivereach 0 importersview sourcekind tooltopic q4k
docsdependenciesstructsconstsfunctions

about

nx_q4k_ggml_kat.nx -- PERMANENT golden regression guard for Q4_K dequant. Embeds the REAL 2304 bytes of blk.0.attn_q.weight ROW 0 (16 Q4_K super-blocks) from Huihui-Qwen3-4B-Instruct-2507-abliterated-Q4_K_M.gguf at file offset 1040894048, and asserts -- through BOTH the f32 path (nx_q4k_to_f32) and the fused integer Q24 path (nx_q4k_dot_row_col) -- the ggml-true golden values: element0 (row0,col0) f32 bits == 0x3AD18400 (= +0.0015985) row-0 dot vs col[i]=1024+(i%5)*256 (Q10) == +0.2157557 (true ggml) Cross-checked bit-exact vs ggml-quants.c (dequantize_row_q4_K) and the gguf-py reference. DO NOT edit the bytes / expected values without re-deriving them from the model + ggml. license_tier: ORIGINAL

dependencies 12 imports · 0 importers

nx_gate_verdict.nx nx_syscalls.nx nx_tier.nx nx_le.nx nx_gguf.nx nx_gguf_load.nx nx_dequant_iter.nx nx_q4k_matmul.nx nx_q4k_to_f32.nx nx_f32.nx nx_q4k_ggml_kat.nx

diagram shows first 10 each side; +2 more imports, +0 more importers in the complete lists below.

imports: nx_gate_verdict.nxnx_syscalls.nxnx_tier.nxnx_le.nxnx_gguf.nxnx_gguf_load.nxnx_dequant_iter.nxnx_q4k_matmul.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 gv_ctr sys_mmap gv_head gv_puts sys_write kat_run sys_mmap ↻ _kat_fill _kat_fill_0 _kat_fill_1 _kat_fill_2 _kat_fill_3 _kat_fill_4 _kat_fill_5 _kat_fill_6 _kat_fill_7 nx_q4k_to_f32 nx_q4k_block_to_f32 nx_le_read_u16 nx_f16_to_f32 nx_le_read_u8 nx_i32_to_f32 nx_f32_add nx_f32_classify nx_f32_exp_field nx_f32_mant_field nx_f32_sign nx_f32_mant_field ↻ nx_f32_exp_field ↻ nx_f32_mul nx_f32_classify ↻ nx_f32_sign ↻ nx_f32_mant_field ↻ nx_f32_exp_field ↻ nx_q10_to_f32 nx_i32_to_f32 ↻ nx_f32_sub nx_f32_add ↻ nx_f32_neg

structs

none

consts

27const KAT_HID: i64 = 4096
28const KAT_NBLK: i64 = 16
29const KAT_BYTES: i64 = 2304

functions

31func _kat_fill_0(buf: *u8) -> i64
called by 1: _kat_fill
59func _kat_fill_1(buf: *u8) -> i64
called by 1: _kat_fill
87func _kat_fill_2(buf: *u8) -> i64
called by 1: _kat_fill
115func _kat_fill_3(buf: *u8) -> i64
called by 1: _kat_fill
143func _kat_fill_4(buf: *u8) -> i64
called by 1: _kat_fill
171func _kat_fill_5(buf: *u8) -> i64
called by 1: _kat_fill
199func _kat_fill_6(buf: *u8) -> i64
called by 1: _kat_fill
227func _kat_fill_7(buf: *u8) -> i64
called by 1: _kat_fill
255func _kat_fill(buf: *u8) -> i64
267func kat_run() -> i64
317func main() -> i64