code wiki / _hdl_build / nx_hw_envelope.nx
nx_hw_envelope.nx
buildroot/runtime/_hdl_build/nx_hw_envelope.nx
about
nx_hw_envelope.nx -- HARDWARE-AWARE MODEL ROUTER (2026-07-23; operator: "hardware aware component
if we shift to larger or smaller systems so future nishi os can run on anything from a phone to a
supercomputer"). Measures the HOST envelope (RAM via /proc/meminfo, logical cores via /proc/cpuinfo,
both STREAM-read because /proc stat sizes lie) and picks the maker/bench model roster for this
hardware TIER from the sovereign plane knowledge/store/hwtier- (rule 11: thresholds AND rosters are
DATA -- rows `tier|min_gb|maker|bench|note`, pipe-packed payload = the declared-canonical store row
format). External models appear ONLY in the bench column and are marked BENCH-ONLY (the
external-reimpls-bench-only law); the sovereign maker column is always the primary. Fail-closed:
absent/empty plane = RED exit 1; no tier fits the measured RAM = RED exit 3; VRAM reports
UNMEASURED in v1 (no honest sovereign probe yet), never guessed.
nx_hw_envelope probe -- measure host -> JSON
nx_hw_envelope route [planeprefix] -- probe + tier-match -> routing JSON (+ hw_envelope.out)
nx_hw_envelope selftest -- hermetic teeth (gv lib)
license_tier: ORIGINAL expect_exit: 0 No hw writes (Rule 26).
dependencies 5 imports · 0 importers
imports: nx_syscalls.nxnx_gate_verdict.nxnx_sovjson_lib.nxnx_store_seed_lib.nxnx_seg_store.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
| 21 | const HW_CAP: i64 = 262144 |
| 22 | const HW_PLANE: i64 = 1048576 |
| 23 | const HW_KB_PER_GB: i64 = 1048576 |
| 24 | const HW_SLOT: i64 = 16 |
| 25 | const HW_MAXROWS: i64 = 32 |
| 26 | const HW_ROWI: i64 = 9 |
| 27 | const HW_ROWBYTES: i64 = 2304 |
| 28 | const HW_RES: i64 = 80 |
| 29 | const HW_USAGE: i64 = 2 |
| 30 | const HW_NOFIT: i64 = 3 |
functions
| 32 | func hw_read_stream(path: *u8, buf: *u8, cap: i64) -> i64 |
| 48 | func hw_num_after(q: *u8, n: i64, key: *u8) -> i64 |
| 80 | func hw_count_linestart(q: *u8, n: i64, lit: *u8) -> i64 |
| 99 | func hw_pick(mins: *i64, n: i64, ram_gb: i64) -> i64 called by 1: main |
| 112 | func hw_row(q: *u8, ls: i64, le: i64, res: *i64) -> i64 |
| 140 | func hw_makers(d: *u8, o: i64, q: *u8, s: i64, e: i64) -> i64 called by 1: main |
| 163 | func hw_span(d: *u8, o: i64, q: *u8, s: i64, e: i64) -> i64 called by 1: main |
| 171 | func hw_probe(out: *i64) -> i64 |
| 187 | func main(argc: i64, argv: *i64) -> i64 |