nx_gguf_load_model.nx
buildroot/runtime/nx_gguf_load_model.nx
about
nx_gguf_load_model.nx -- top-level model-tensor loader.
L4 brick: the missing companion to nx_gguf_load_block.nx. Where
block_load reads the 9 per-layer tensors, this brick reads the 3
top-level (non-per-layer) tensors a Llama-class GGUF carries:
token_embd.weight -- vocab x hidden (embedding table)
output.weight -- hidden x vocab (output projection /
"lm head"; often
tied to token_embd)
output_norm.weight -- hidden (final RMSNorm scale)
Together with nx_gguf_load_block, this brick covers the FULL set of
tensor names a Llama-2 / Llama-3 / Mistral / Qwen GGUF contains
(modulo extra K/V biases that don't appear in standard files).
After this brick, the path from text prompt -> first emitted token
is loader-complete; the next workstream is `nx_llm_run` v2 which
composes load_model + load_block + transformer_block_forward +
final_norm + output_projection + softmax + sample.
Bits-up composition:
nx_gguf.nx, nx_gguf_load.nx -- header + per-tensor load
nx_tensor.nx -- NxTensor output
genealogy_id: llama_gguf_naming_gerganov_2024 + standard_lm_head
lineage_id: substrate_gguf_model_loader_v1
dependencies 5 imports · 2 importers
imports: nx_syscalls.nxnx_tier.nxnx_tensor.nxnx_gguf.nxnx_gguf_load.nx
imported by: nx_gguf_load_model_test.nxnx_llm_run_v2.nx
structs
| 80 | struct NxGgufModelWeights |
consts
| 54 | const NX_GML_OK: nx_int = 0 |
| 55 | const NX_GML_ERR_EMBED_NOT_FOUND: nx_int = 1 |
| 56 | const NX_GML_ERR_OUTPUT_NOT_FOUND: nx_int = 2 |
| 57 | const NX_GML_ERR_NORM_NOT_FOUND: nx_int = 3 |
| 58 | const NX_GML_ERR_LOAD_FAIL: nx_int = 4 |
| 59 | const NX_GML_N_VERDICTS: nx_int = 5 |
| 88 | const NX_GML_BUNDLE_BYTES: nx_int = 32 // 4 fields * 8 |
functions
| 61 | func nx_gml_verdict_is_valid(v: nx_int) -> nx_int called by 1: main |
| 92 | func nx_gguf_load_model_weights(buf: *u8, hdr: *NxGgufHeader, |