nx_q4k_to_f32.nx
buildroot/runtime/nx_q4k_to_f32.nx
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
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
| 36 | const NX_Q4KF_OK: nx_int = 0 |
| 37 | const NX_Q4KF_ERR_BAD_BUF: nx_int = 1 |
| 38 | const NX_Q4KF_N_VERDICTS: nx_int = 2 |
functions
| 40 | func nx_q4kf_verdict_is_valid(v: nx_int) -> nx_int called by 1: main |
| 51 | func nx_q4k_block_to_f32(buf: *u8, super_off: i64, |
| 144 | func nx_q4k_to_f32(buf: *u8, base_off: i64, n_values: i64, |
| 170 | func _q4kp_st4(out: *u8, idx: i64, bits: i64) -> i64 called by 1: nx_q4k_block_to_f32_packed |
| 178 | func nx_q4k_block_to_f32_packed(buf: *u8, super_off: i64, called by 1: nx_q4k_to_f32_packed calls 5: nx_le_read_u16nx_f16_to_f32nx_le_read_u8nx_i32_to_f32_q4kp_st4 |
| 283 | func nx_q4k_to_f32_packed(buf: *u8, base_off: i64, n_values: i64, |