nx_genweights.nx
buildroot/runtime/nx_genweights.nx
about
nx_genweights.nx -- read model weights straight from a GGUF. The engine's weight source.
Until now this lane read weights from fixtures the oracle tap had dumped. That was right for
building a RULER -- the tap's f32 conversion is ggml's own dequantization, which is exactly what
a differential test needs. It is wrong for an ENGINE: it means the sovereign path cannot run
without first booting a third-party binary to export its weights, and it does not scale (one
Z-Image layer is ~190MB of raw blocks; 36 layers is ~7GB of fixtures nobody should be dumping).
★ A RULER MAY DEPEND ON THE INCUMBENT. A RUNTIME MAY NOT.
The GGUF's tensor names turn out to be EXACTLY the names sd.cpp uses internally
("model.diffusion_model.layers.0.attention.qkv.weight"), so this is a drop-in swap for the
fixture loader -- verified by running the same block both ways and comparing.
The file is mmapped whole (sys_map_file), not read: a 6.2GB model is paged in on demand and
only the tensors actually touched ever reach RAM.
HANDLE LAYOUT (i64 slots): [0]=mapped base, [1]=file length, [2]=*NxGgufHeader
license_tier: ORIGINAL
dependencies 8 imports · 15 importers
diagram shows first 10 each side; +0 more imports, +5 more importers in the complete lists below.
imports: nx_syscalls.nxnx_le.nxnx_f32.nxnx_tensor.nxnx_gguf.nxnx_gguf_load.nxnx_q8_0_to_f32.nxnx_safetensors_load.nx
imported by: nx_gen_archprobe.nxnx_gen_blockrun.nxnx_gen_ditchain.nxnx_gen_ditfull.nxnx_gen_embed_verify.nxnx_gen_lora_repr.nxnx_gen_lora_verify.nxnx_gen_modelid.nxnx_gen_pipecheck.nxnx_gen_zoo.nxnx_genarch.nxnx_genblock.nxnx_genlora.nxnx_genpipe.nxnx_genrole.nx
structs
| none |
consts
| 30 | const NX_GW_TYPE_F32: i64 = 0 |
| 31 | const NX_GW_TYPE_F16: i64 = 1 |
| 32 | const NX_GW_TYPE_Q8_0: i64 = 8 |
| 37 | const NX_GW_FMT_GGUF: i64 = 0 |
| 38 | const NX_GW_FMT_ST: i64 = 1 |
| 41 | const NX_GW_ST_F32: i64 = 100 |
| 42 | const NX_GW_ST_F16: i64 = 101 |
| 43 | const NX_GW_ST_BF16: i64 = 102 |
| 44 | const NX_GW_ST_F8E4M3: i64 = 103 |
functions
| 49 | func nx_gw_f8e4m3_to_f32(b: i64) -> i64 called by 1: nx_gw_to_f32_packed |
| 67 | func nx_gw_open(path: *u8) -> *i64 called by 10: mainmainmainmainmainmain+4 calls 5: sys_mmapsys_map_filestl_header_lenstl_data_startnx_gguf_parse |
| 112 | func _gw_st_find(gw: *i64, name: *u8, nl: i64, out: *i64) -> i64 |
| 160 | func nx_gw_ntensors(gw: *i64) -> i64 |
| 168 | func nx_gw_find(gw: *i64, name: *u8, nl: i64) -> i64 |
| 181 | func _gw_st_last(gw: *i64, out: *i64) -> i64 |
| 185 | func _gw_info(gw: *i64, idx: i64) -> *NxGgufTensorInfo |
| 191 | func nx_gw_data(gw: *i64, idx: i64) -> *u8 |
| 202 | func nx_gw_type(gw: *i64, idx: i64) -> i64 |
| 211 | func nx_gw_dim0(gw: *i64, idx: i64) -> i64 |
| 220 | func nx_gw_dim1(gw: *i64, idx: i64) -> i64 |
| 237 | func nx_gw_to_f32_packed(gw: *i64, idx: i64, out: *u8, n_values: i64) -> i64 |