code wiki / (root) / nx_gguf_load_q4k_test.nx

nx_gguf_load_q4k_test.nx

buildroot/runtime/nx_gguf_load_q4k_test.nx

5248 B146 linesdepth 6pulls 8 transitivereach 0 importersview sourcekind gate/prooftopic gguf
docsdependenciesstructsconstsfunctions

about

nx_gguf_load_q4k_test.nx -- focused smoke for Q4_K dequant. Builds a synthetic GGUF with one Q4_K tensor (1 super-block, 256 values) and verifies the dequant: d = 1.0 (f16 0x3C00) -> d_q10 = 1024 dmin = 0.0 -> dmin_q10 = 0 scales[0..7] = {1, 1, 1, 1, 2, 0, 0, 0} (only sc[4]=2 in high half) mins[0..7] = {0, 0, 0, 0, 0, 0, 0, 0} nibble byte 0: 0x32 -> low nibble 2, high nibble 3 nibble byte 64: 0x32 -> low nibble 2, high nibble 3 all other nibbles = 0 ggml layout (32-byte groups; group g -> sub-block 2g low / 2g+1 high) + Q24 super-scale (d=1.0 -> d_q24 = 2^24 = 16777216). 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 Q24 outputs: out[0] = 16777216 * sc[0]=1 * 2 - 0 = 33554432 out[32] = 16777216 * sc[1]=1 * 3 - 0 = 50331648 out[128] = 16777216 * sc[4]=2 * 2 - 0 = 67108864 everywhere else: 0 Tests both the low-half (is<4) and high-half (is>=4) scale unpacking paths in nx_gguf_dequant_q4_k.

dependencies 6 imports · 0 importers

nx_syscalls.nx nx_tier.nx nx_le.nx nx_tensor.nx nx_gguf.nx nx_gguf_load.nx nx_gguf_load_q4k_test.nx

imports: nx_syscalls.nxnx_tier.nxnx_le.nxnx_tensor.nxnx_gguf.nxnx_gguf_load.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_mmap nx_le_write_u64 nx_le_write_u32 nx_le_write_u32 ↻ nx_le_write_u16 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_tensor_at nx_gguf_ggml_values_per_bl nx_gguf_ggml_bytes_per_blo nx_gguf_tensor_n_values nx_gguf_tensor_data_bytes nx_gguf_tensor_n_values ↻ nx_gguf_ggml_values_per_bl ↻ nx_gguf_ggml_bytes_per_blo ↻ nx_gguf_load_tensor nx_gguf_find_tensor nx_gguf_tensor_at ↻ nx_gguf_name_equals nx_gguf_tensor_at ↻ nx_gguf_tensor_n_values ↻ sys_mmap ↻ nx_t_alloc nx_dt_is_valid nx_dt_element_bytes sys_mmap ↻ nx_t_compute_strides_rowma nx_gguf_dequant_f32 nx_le_read_u32 ↻ _gguf_f32_to_q10 nx_gguf_dequant_f16 nx_le_read_u16

structs

none

consts

none

functions

36func main() -> i64