code wiki / (root) / nx_q4k_to_f32.nx

nx_q4k_to_f32.nx

buildroot/runtime/nx_q4k_to_f32.nx

12018 B297 linesdepth 6pulls 11 transitivereach 89 importersview sourcekind librarytopic q4k
docsdependenciesstructsconstsfunctions

about

nx_q4k_to_f32.nx -- bits-up Q4_K dequantization producing IEEE 754 binary32 outputs. L4.5 / L8 brick. Composes the L4 bits-up f32 substrate (mul + sub + cvt) with the GGML Q4_K block layout to produce dequantized values in genuine IEEE 754 form -- bit-comparable against ggml's reference dequant on the same input bytes. Same algorithm as nx_gguf_dequant_q4_k (Q10 output) and nx_gguf_dequant_q4_k_q14 (Q14 output), but the multiplication + subtraction chain uses bits-up f32 ops shipped earlier in this L4 tower. No libm, no compiler-builtin lowerings. Per-value formula: d = f16_to_f32(super_block_d) (super-scale) dmin = f16_to_f32(super_block_dmin) (super-min) sc_j = unpacked 6-bit sub-block j scale (i32->f32 widened) m_j = unpacked 6-bit sub-block j min q4 = 4-bit nibble (0..15) (i32->f32 widened) value_f32 = (d * sc_j) * q4 - (dmin * m_j) genealogy_id: ggml_q4k_block_canon + ieee754_binary32_dequant lineage_id: substrate_q4k_to_f32_v1

dependencies 7 imports · 14 importers

nx_syscalls.nx nx_tier.nx nx_le.nx nx_gguf.nx nx_gguf_load.nx nx_f32.nx nx_f32_cvt.nx nx_q4k_to_f32.nx nx_f32_lazy_weight_test.nx nx_f32_llama_layer_lazy_load.nx nx_f32_q4k_matmul.nx nx_f32_q4k_matmul_test.nx nx_gguf_load_f32.nx nx_q4k_ggml_kat.nx nx_q4k_linear.nx nx_q4k_linear_hp.nx nx_q4k_real_gemm.nx nx_q4k_speed_bench.nx

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

imports: nx_syscalls.nxnx_tier.nxnx_le.nxnx_gguf.nxnx_gguf_load.nxnx_f32.nxnx_f32_cvt.nx

imported by: nx_f32_lazy_weight_test.nxnx_f32_llama_layer_lazy_load.nxnx_f32_q4k_matmul.nxnx_f32_q4k_matmul_test.nxnx_gguf_load_f32.nxnx_q4k_ggml_kat.nxnx_q4k_linear.nxnx_q4k_linear_hp.nxnx_q4k_real_gemm.nxnx_q4k_speed_bench.nxnx_q4k_to_f32_test.nxnx_qwen_hybrid_attn.nxnx_qwen_hybrid_ffn.nxnx_qwen_hybrid_qkv.nx

structs

none

consts

36const NX_Q4KF_OK: nx_int = 0
37const NX_Q4KF_ERR_BAD_BUF: nx_int = 1
38const NX_Q4KF_N_VERDICTS: nx_int = 2

functions

40func nx_q4kf_verdict_is_valid(v: nx_int) -> nx_int
called by 1: main
51func nx_q4k_block_to_f32(buf: *u8, super_off: i64,
144func nx_q4k_to_f32(buf: *u8, base_off: i64, n_values: i64,
170func _q4kp_st4(out: *u8, idx: i64, bits: i64) -> i64
178func nx_q4k_block_to_f32_packed(buf: *u8, super_off: i64,
283func nx_q4k_to_f32_packed(buf: *u8, base_off: i64, n_values: i64,