code wiki / (root) / nx_live_fire_gguf.nx

nx_live_fire_gguf.nx

buildroot/runtime/nx_live_fire_gguf.nx

3454 B72 linesdepth 8pulls 10 transitivereach 1 importersview sourcekind librarytopic live
docsdependenciesstructsconstsfunctions

about

nx_live_fire_gguf.nx -- live-fire end-to-end GGUF round-trip on real disk. This is NOT a synthetic in-memory smoke. It exercises: 1. Build a Llama-shape GGUF in a buffer (3 top-level tensors) 2. WRITE the buffer to /tmp/nx_live_fire.gguf via sys_write 3. CLOSE the file 4. READ it back via sys_read_file (re-opens, sys_read into mmap) 5. Parse the header via nx_gguf_parse 6. LAZY-load every tensor handle via nx_gguf_load_tensor_lazy (Phase B of the conductor arc; zero-RAM tensor handles) 7. MATERIALIZE on demand via nx_placed_tensor_get 8. VERIFY the dequantized values bit-exactly match the source we wrote 4 syscalls ago (proves disk round-trip + dequant pipeline is end-to-end correct) 9. MEASURE elapsed monotonic time via sys_clock_gettime_mono + assert each phase is under generous budget Why this matters (live-fire vs synthetic-smoke discipline): * Synthetic in-memory smokes (all 9 bricks shipped so far this session) prove ALGORITHMIC correctness on hand-built buffers. * THIS smoke proves the same primitives survive a kernel-mediated file-system round-trip (write(2) -> close(2) -> openat(2) -> read(2)) which is the actual deployment path for real-model loading. * If any of: file-descriptor leakage, buffered-write inversion, mmap-vs-read alignment, byte-order on RV64 host -- bit-exact comparison after disk round-trip catches it. * Per the honest-perf-verdict cardinal: timing assertions in the smoke are SIGNAL-ONLY, not the verdict. The verdict is correctness; timing is recorded for trend visibility. Bits-up composition: nx_syscalls.nx -- sys_openat_wr / sys_write / sys_close / sys_read_file / sys_clock_gettime_mono nx_le.nx -- header byte writers nx_gguf.nx + nx_gguf_load.nx -- parse + per-tensor dequant nx_placement.nx -- lazy placement nx_gguf_load_lazy.nx -- Phase B lazy loader

dependencies 8 imports · 1 importers

nx_syscalls.nx nx_tier.nx nx_le.nx nx_tensor.nx nx_gguf.nx nx_gguf_load.nx nx_placement.nx nx_gguf_load_lazy.nx nx_live_fire_gguf.nx nx_live_fire_gguf_test.nx

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

imported by: nx_live_fire_gguf_test.nx

structs

none

consts

68const NX_LF_WRITE_BUDGET_MS: i64 = 2000
69const NX_LF_READ_BUDGET_MS: i64 = 2000
70const NX_LF_PARSE_BUDGET_MS: i64 = 500
71const NX_LF_LAZY_LOAD_BUDGET_MS: i64 = 500
72const NX_LF_MATERIALIZE_BUDGET_MS: i64 = 500

functions

none