code wiki / _hdl_build / nx_gpu_power.nx

nx_gpu_power.nx

buildroot/runtime/_hdl_build/nx_gpu_power.nx

1905 B30 linesdepth 2pulls 2 transitivereach 1 importersview sourcekind librarytopic gpu
docsdependenciesstructsconstsfunctions

about

nx_gpu_power.nx -- sovereign GPU POWER + THERMAL GOVERNOR (operator 2026-06-20: "fix the energy and heat output if we need to as nvidia fries their gpus"). NEVER-FRY BY CONSTRUCTION (rule #26) + resource-aware (rule #21): clamps the power cap to the hardware [min,max], DERATES under thermal stress, and EMERGENCY-caps to minimum at the critical temperature. Also yields the LOCKED CLOCKS the benchmark methodology needs (reproducible measurement). The governor LOGIC is pure INTEGER (no-float, deterministic) -- gated locally. APPLYING the cap = the device shim's RM_CONTROL power-limit command (nx_nv on native-Linux, RM NV2080_CTRL_CMD_PERF; or nvidia-smi -pl as the incumbent, admin) = TODO_DEVICE. Real 5080 range probed: pmin=5W, pmax=175W, default=80W. Pure funcs, no main. license_tier: ORIGINAL

dependencies 1 imports · 1 importers

nx_syscalls.nx nx_gpu_power.nx nx_gpu_power_gate.nx

imports: nx_syscalls.nx

imported by: nx_gpu_power_gate.nx

structs

none

consts

none

functions

13func nx_power_governor(requested_w: i64, pmin: i64, pmax: i64, temp_c: i64, temp_warn: i64, temp_crit: i64) -> i64
called by 1: main
30func nx_clock_lock_target(max_mhz: i64, percent: i64) -> i64 { var c: i64 = (max_mhz * percent) / 100; if c > max_mhz { c = max_mhz } return c }
called by 1: main