nx_f32_llm_load.nx
buildroot/runtime/nx_f32_llm_load.nx
about
nx_f32_llm_load.nx -- model-level GGUF binder.
Populates an NxF32LlamaModel from a parsed GGUF:
- 3 top-level tensors:
token_embd.weight -> embed_weights
output_norm.weight -> gamma_out
output.weight -> lm_head (tied to embed if missing)
- N per-layer NxF32LlamaLayer structs via nx_f32_llama_layer_load_from_gguf
Caller responsibility: pre-fill model dimension fields (n_layers,
hidden_dim, n_heads, n_kv_heads, head_dim, ffn_dim, vocab_size).
v1 does not parse GGUF metadata to derive them -- a separate
metadata-walker brick is queued for that. This keeps the binder
focused on tensor binding only.
Tied-embed detection: if "output.weight" is not found, lm_head
points to the same storage as embed_weights (the canonical Llama
memory-saving trick used by Qwen, Llama-3, etc.). Caller must
not free either pointer independently.
genealogy_id: llama_gguf_naming_gerganov_2024 + standard_model_binding
+ tied_embed_qwen_llama3
lineage_id: substrate_f32_llm_load_v1
dependencies 7 imports · 4 importers
imports: nx_syscalls.nxnx_tier.nxnx_gguf.nxnx_gguf_load_f32.nxnx_f32_llama_block.nxnx_f32_llama_layer_load.nxnx_f32_llm.nx
imported by: nx_f32_llm_e2e_test.nxnx_f32_llm_load_test.nxnx_f32_llm_run_test.nxnx_f32_llm_run_v2_test.nx
structs
| none |
consts
| 33 | const NX_FLM_OK: nx_int = 0 |
| 34 | const NX_FLM_ERR_NULL: nx_int = 1 |
| 35 | const NX_FLM_ERR_BAD_DIM: nx_int = 2 |
| 36 | const NX_FLM_ERR_NOT_FOUND: nx_int = 3 |
| 37 | const NX_FLM_ERR_LAYER: nx_int = 4 |
| 38 | const NX_FLM_N_VERDICTS: nx_int = 5 |
functions
| 40 | func nx_flm_verdict_is_valid(v: nx_int) -> nx_int called by 1: main |
| 52 | func nx_f32_llm_load_weights_from_gguf(buf: *u8, hdr: *NxGgufHeader, |