code wiki / _hdl_build / nx_build_safe.nx
nx_build_safe.nx
buildroot/runtime/_hdl_build/nx_build_safe.nx
about
nx_build_safe.nx -- the Engineer's HANG-SAFE build capability (operator: keep building the team to
handle this). Even with the G2 compiler FOUND, the codegen HANGS on a huge program (the TLS daemon:
the background build produced 0 bytes of asm after minutes). The compiler is also non-deterministic
(a retry may pass) and can miscompile. So a robust build must: compile under a TIMEOUT; classify each
attempt (OK / HANG / ERROR); RETRY the same compiler (non-determinism); ESCALATE to an alternative
compiler after repeated hangs; and -- crucially -- never report a false success (an empty/hung build
is HANG, not OK), giving an HONEST EXHAUSTED verdict if nothing produces a runnable artifact.
This is what the memory's nx_run_timeout + recompile-retry discipline becomes as a first-class
capability. license_tier: ORIGINAL Pairs with nx_build_gate + the Engineer's eng_build_gate.
dependencies 1 imports · 1 importers
imports: nx_syscalls.nx
imported by: nx_build_safe_test.nx
structs
| none |
consts
| 13 | const BS_OK: i64 = 0 // compiled + linked to a non-empty runnable artifact |
| 14 | const BS_HANG: i64 = 1 // timed out / produced no asm -> codegen hung |
| 15 | const BS_ERROR: i64 = 2 // compiled but link/asm failed |
| 16 | const BS_EXHAUSTED: i64 = 3 // retries + escalation exhausted -> honest give-up (NOT a false success) |
functions
| 19 | func bs_attempt(timed_out: i64, asm_bytes: i64, link_ok: i64) -> i64 called by 1: main |
| 27 | func bs_should_retry(verdict: i64, attempts: i64, max_attempts: i64) -> i64 called by 1: main |
| 34 | func bs_should_escalate(hangs_on_current: i64, threshold: i64) -> i64 { if hangs_on_current >= threshold { return 1 } return 0 } called by 1: main |
| 37 | func bs_final(any_ok: i64) -> i64 { if any_ok == 1 { return BS_OK } return BS_EXHAUSTED } called by 1: main |
| 40 | func bs_no_false_success(final_verdict: i64, any_runnable: i64) -> i64 called by 1: main |