code wiki / (root) / nx_vram_estimate.nx

nx_vram_estimate.nx

buildroot/runtime/nx_vram_estimate.nx

3771 B72 linesdepth 5pulls 5 transitivereach 0 importersview sourcekind tooltopic vram
docsdependenciesstructsconstsfunctions

about

nx_vram_estimate.nx -- SOVEREIGN VRAM footprint estimator for DiT inference (Z-Image + LTX) under levers. Breaks peak VRAM into weights + attention-scores + activations (MB), and shows how each O(n) lever moves it: FlashAttention -> scores O(n^2) -> ~O(d) (matrix never built) DC-AE -> tokens 16x fewer -> scores + activations collapse Q4 quant -> weights bytes/param down (orthogonal; included for completeness) MoE + offload -> resident weights = active/streamed subset, not the full model Integer math in MB. No 3rd party. Numbers are first-order (dominant terms), for budgeting not billing. license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_strconv.nx nx_vram_estimate.nx

imports: nx_syscalls.nxnx_strconv.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_openat_wr sys_write vram_row sys_write ↻ p_kv sys_write ↻ p_int sys_mmap nx_strconv_format_i64 sys_write ↻ p_int ↻ sys_close

structs

none

consts

12const K_MAGIC_1000000: i64 = 1000000
13const K_MAGIC_1024: i64 = 1024
14const K_MAGIC_6000: i64 = 6000
15const K_MAGIC_4096: i64 = 4096
16const K_MAGIC_3840: i64 = 3840
17const K_MAGIC_22000: i64 = 22000
18const K_MAGIC_11000: i64 = 11000
19const K_MAGIC_2200: i64 = 2200

functions

21func p_int(fd: i64, v: i64) -> i64
27func p_kv(fd: i64, label: *u8, ll: i64, v: i64) -> i64
called by 1: vram_row calls 2: sys_writep_int
35func vram_row(fd: i64, name: *u8, nl: i64, rparams_M: i64, bpp10: i64, tokens: i64, hidden: i64, heads: i64, hdim: i64, use_fa: i64, actf: i64) -> i64
called by 1: main calls 3: sys_writep_kvp_int
55func main() -> i64