code wiki / (root) / nx_f32_llm_v4.nx

nx_f32_llm_v4.nx

buildroot/runtime/nx_f32_llm_v4.nx

13787 B288 linesdepth 12pulls 51 transitivereach 43 importersview sourcekind librarytopic f32
docsdependenciesstructsconstsfunctions

about

nx_f32_llm_v4.nx -- lazy-aware model binder + LLM forward. Closes the lazy Q4_K path end-to-end: * Model binder uses nx_f32_llama_layer_lazy_load_from_gguf for each layer (Q4_K weights stay as offsets; F32/F16 eagerly widened). * Embed + lm_head + gamma_out loaded eagerly to f32 (small + 1D for gamma_out; embed/lm_head typically F32 or F16 in real GGUFs). * Forward dispatches through nx_f32_llama_stack_forward_v4. Reuses NxF32LlamaModel struct from nx_f32_llm.nx; the layers array now holds *NxF32LlamaLayerLazy values (cast through i64). Caller MUST use v4 forward consistently with v4-loaded model. genealogy_id: standard_llama_forward + lazy_dispatch lineage_id: substrate_f32_llm_v4

dependencies 14 imports · 42 importers

nx_syscalls.nx nx_tier.nx nx_gguf.nx nx_gguf_load_f32.nx nx_f32.nx nx_f32_rmsnorm.nx nx_f32_matmul.nx nx_f32_matmul_t.nx nx_f32_kv_cache.nx nx_f32_lazy_weight.nx nx_f32_llm_v4.nx nx_batched_gate.nx nx_batched_tput.nx nx_chat_warmcache.nx nx_coder_gen_f32.nx nx_companion_chat.nx nx_companion_voice.nx nx_embed_bench.nx nx_f32_embed_gate.nx nx_f32_llama_v4b.nx nx_f32_llama_v4p.nx

diagram shows first 10 each side; +4 more imports, +32 more importers in the complete lists below.

imports: nx_syscalls.nxnx_tier.nxnx_gguf.nxnx_gguf_load_f32.nxnx_f32.nxnx_f32_rmsnorm.nxnx_f32_matmul.nxnx_f32_matmul_t.nxnx_f32_kv_cache.nxnx_f32_lazy_weight.nxnx_f32_llama_block_v4.nxnx_f32_llama_stack_v4.nxnx_f32_llama_layer_lazy_load.nxnx_f32_llm.nx

imported by: nx_batched_gate.nxnx_batched_tput.nxnx_chat_warmcache.nxnx_coder_gen_f32.nxnx_companion_chat.nxnx_companion_voice.nxnx_embed_bench.nxnx_f32_embed_gate.nxnx_f32_llama_v4b.nxnx_f32_llama_v4p.nxnx_f32_llm_bench_test.nxnx_f32_llm_chat_test.nxnx_f32_llm_cohere_test.nxnx_f32_llm_embed_diag_test.nxnx_f32_llm_live_gen_test.nxnx_f32_llm_live_load_only_test.nxnx_f32_llm_live_load_test.nxnx_f32_llm_probe.nxnx_f32_llm_run_v3.nxnx_f32_llm_run_v3_test.nxnx_f32_llm_serve.nxnx_f32_llm_v4_test.nxnx_f32_qwen_capital_gate.nxnx_llm_argmax_probe.nxnx_llm_batch_serve.nxnx_llm_diff_probe.nxnx_llm_forward_profile.nxnx_llm_france_probe.nxnx_llm_layerlens_probe.nxnx_llm_sched.nxnx_llm_sched_gate.nxnx_lowrank_kv_real.nxnx_paged_fwd_gate.nxnx_qwen_native_gate.nxnx_qwen_wsl_timing_gate.nxnx_reason_paged_probe.nxnx_reason_probe.nxnx_reasoning.nxnx_reasoning_gate.nxnx_reasoning_paged.nxnx_specdec.nxnx_specdec_gate.nx

structs

none

consts

34const NX_FLV4_OK: nx_int = 0
35const NX_FLV4_ERR_NULL: nx_int = 1
36const NX_FLV4_ERR_BAD_DIM: nx_int = 2
37const NX_FLV4_ERR_NOT_FOUND: nx_int = 3
38const NX_FLV4_ERR_LAYER: nx_int = 4
39const NX_FLV4_ERR_STACK: nx_int = 5
40const NX_FLV4_ERR_TOKEN: nx_int = 6
41const NX_FLV4_N_VERDICTS: nx_int = 7

functions

43func nx_flv4_verdict_is_valid(v: nx_int) -> nx_int
called by 1: main
52func nx_f32_llm_load_weights_v4_from_gguf(buf: *u8, hdr: *NxGgufHeader,
164func _flv4_core(
257func nx_f32_llm_forward_v4(
275func nx_f32_llm_embed_v4(
called by 2: mainmain calls 1: _flv4_core