code wiki / _hdl_build / nx_nv.nx
nx_nv.nx
buildroot/runtime/_hdl_build/nx_nv.nx
about
nx_nv.nx -- the native-Linux NVIDIA OPEN-KERNEL-MODULE device shim (TIER-1 sovereign executor), sibling to
nx_dxg (the WSL2 GPU-PV shim). This is the path that ACTUALLY EXECUTES on real silicon -- modeled on tinygrad's
ops_nv.py, which submits via /dev/nvidia* + a GPFIFO ring + a usermode doorbell, bypassing the CUDA runtime
(and bypassing the proprietary dxg priv-data handshake that walls WSL2). Runs on a native-Linux / rented cloud
GPU instance (brick-safe, rule #26).
LOCALLY-VERIFIABLE (gated bit-exact here): the GPFIFO entry encoder + the doorbell offset.
CLOUD-PENDING (structured, completed against the instance's open-gpu-kernel-modules headers on first run):
the full RM-API object tree -- NV_ESC_RM_ALLOC on /dev/nvidiactl for root client -> device -> subdevice ->
channel-group -> GPFIFO channel (NV_CHANNELGPFIFO_ALLOCATION_PARAMETERS) -> compute object; NV_ESC_RM_CONTROL
for GPFIFO_SCHEDULE + GET_WORK_SUBMIT_TOKEN; NV_ESC_RM_MAP_MEMORY for the usermode doorbell BAR.
Pure funcs, no main. license_tier: ORIGINAL
dependencies 1 imports · 1 importers
imports: nx_syscalls.nx
imported by: nx_nv_gate.nx
structs
| none |
consts
| 17 | const NV_ESC_RM_ALLOC: i64 = 0x2b |
| 18 | const NV_ESC_RM_CONTROL: i64 = 0x2a |
| 19 | const NV_ESC_RM_MAP_MEMORY: i64 = 0x4e |
| 21 | const NV_DOORBELL_OFF: i64 = 0x90 |
functions
| 23 | func nv_open_ctl() -> i64 { return sys_openat_rd("/dev/nvidiactl" as *u8) } |
| 24 | func nv_open_dev() -> i64 { return sys_openat_rd("/dev/nvidia0" as *u8) } calls 1: sys_openat_rd |
| 25 | func nv_open_uvm() -> i64 { return sys_openat_rd("/dev/nvidia-uvm" as *u8) } calls 1: sys_openat_rd |
| 30 | func nv_gpfifo_entry(gpu_va: i64, len_dwords: i64) -> i64 { return ((gpu_va >> 2) << 2) | (len_dwords << 42) | (1 << 41) } called by 1: main |
| 33 | func nv_doorbell_ring(mmio_base: i64, token: i64) -> i64 |