nx_vram_estimate.nx
buildroot/runtime/nx_vram_estimate.nx
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
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
structs
| none |
consts
| 12 | const K_MAGIC_1000000: i64 = 1000000 |
| 13 | const K_MAGIC_1024: i64 = 1024 |
| 14 | const K_MAGIC_6000: i64 = 6000 |
| 15 | const K_MAGIC_4096: i64 = 4096 |
| 16 | const K_MAGIC_3840: i64 = 3840 |
| 17 | const K_MAGIC_22000: i64 = 22000 |
| 18 | const K_MAGIC_11000: i64 = 11000 |
| 19 | const K_MAGIC_2200: i64 = 2200 |
functions
| 21 | func p_int(fd: i64, v: i64) -> i64 |
| 27 | func p_kv(fd: i64, label: *u8, ll: i64, v: i64) -> i64 |
| 35 | func 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 |
| 55 | func main() -> i64 |