nx_q4k_to_f32_test.nx
buildroot/runtime/nx_q4k_to_f32_test.nx
about
nx_q4k_to_f32_test.nx -- smoke for nx_q4k_to_f32.nx.
Synthetic Q4_K block (same as nx_gguf_load_q4k_test):
d = 1.0 (f16 0x3C00 -> f32 0x3F800000)
dmin = 0 (f16 0x0000 -> f32 0)
sc[0..3] = 1, sc[4] = 2, sc[5..7] = 0
m[0..7] = 0
nibble byte 0 -> low nibble 2, high nibble 3
nibble byte 64 -> low nibble 2, high nibble 3
ggml layout (verified bit-exact vs ggml-quants.c): 32-byte groups
g=0..3; group g feeds sub-block 2g (low nibbles) + 2g+1 (high nibbles).
byte 0 is group 0, l=0 -> low -> sub-block 0, out[0];
high -> sub-block 1, out[32]
byte 64 is group 2, l=0 -> low -> sub-block 4, out[128];
high -> sub-block 5 (sc[5]=0) -> out[160]=0
Expected f32 outputs (EXACT — all operands are exact small ints):
out[0] = 1 * sc[0]=1 * 2 - 0 = 2.0 (f32 0x40000000)
out[32] = 1 * sc[1]=1 * 3 - 0 = 3.0 (f32 0x40400000)
out[128] = 1 * sc[4]=2 * 2 - 0 = 4.0 (f32 0x40800000)
out[160] = 1 * sc[5]=0 * 3 - 0 = 0.0 (sc[5] is zero)
everywhere else: 0.0 (f32 0)
dependencies 7 imports · 0 importers
imports: nx_syscalls.nxnx_tier.nxnx_le.nxnx_gguf.nxnx_f32.nxnx_f32_cvt.nxnx_q4k_to_f32.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| none |
functions
| 33 | func main() -> i64 |