code wiki / _hdl_build / _gpu_dxg_vidmem_gate.nx
_gpu_dxg_vidmem_gate.nx
buildroot/runtime/_hdl_build/_gpu_dxg_vidmem_gate.nx
about
_gpu_dxg_vidmem_gate.nx -- SOVEREIGN-GPU ladder R4b (read the REAL VRAM budget of the 5080).
R4a created a GPU context. R4b reads the discrete adapter's REAL video-memory budget via
LX_DXQUERYVIDEOMEMORYINFO -- an UNFAKEABLE number (~14.9 GiB on the 16GB 5080) proving we read actual
GPU state off the silicon, not just opaque handle slots. This is the memory-sizing prerequisite for
real GPU allocations (R4c) and the GEMM working set (R6).
ABI (recon-pinned LIVE, _gpu_dxg_r4b_recon: no uapi header -> size-swept, only _IOC_SIZE=56 recognized;
OUT field offsets located by buffer dump):
LX_DXQUERYVIDEOMEMORYINFO = _IOWR(0x47, 0x0a, 56) = 0xC038470A
struct (56B): process @0 (u64, 0=current, IN); adapter @8 (d3dkmthandle, IN); memory_segment_group @12
(u32, IN: 0=LOCAL/VRAM, 1=NON_LOCAL/shared-sysmem); budget @16 (u64, OUT); current_usage @24 (OUT);
current_reservation @32 (OUT); available_for_reservation @40 (OUT); physical_adapter_index @48 (IN).
GREEN iff (author=organ, from REAL device returns):
A) enum ret==0 AND exactly ONE discrete hw adapter (R1 identity);
B) query(discrete, LOCAL) ret==0 AND budget in [4 GiB, 32 GiB] (a real discrete-GPU-class VRAM budget,
NOT hardcoded to the exact byte count -- bounds, so it stays valid across host-reservation drift);
C) query(discrete, NON_LOCAL) ret==0 AND its budget != the LOCAL budget
(DISCRIMINATION: the segment_group field is genuinely honored -> not a stuck constant);
D) TAMPER: T1 bogus adapter(0xdeadbeef) -> ret!=0 AND budget stays 0 (no data w/o a real adapter);
T2 wrong _IOC_SIZE(48) -> -ENOTTY; T3 on a non-dxg fd -> -ENOTTY.
Marker -> knowledge/status/gpu_dxg.log (DXGVRAMGATE). raw syscalls only. NO-WAVE: reads memory STATE
(a budget), NOT throughput -- zero speedup/exceed claimed (that is R7).
license_tier: ORIGINAL
dependencies 1 imports · 0 importers
imports: nx_syscalls.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
| 28 | const ENUM2_CODE: i64 = 0xC0104714 |
| 29 | const QAI_CODE: i64 = 0xC0184709 |
| 30 | const QVM_CODE: i64 = 0xC038470A // LX_DXQUERYVIDEOMEMORYINFO (_IOWR(0x47,0x0a,56), recon-pinned) |
| 31 | const QVM_BADSZ: i64 = 0xC030470A // wrong _IOC_SIZE=48 -> -ENOTTY tamper |
| 32 | const GIB: i64 = 1073741824 |
functions
| 34 | func p(s: *u8) -> i64 { var nn: i64=0; while s[nn]!=(0 as u8){nn=nn+1} sys_write(1,s,nn); return 0 } |
| 35 | func fp(fd: i64, s: *u8) -> i64 { var nn: i64=0; while s[nn]!=(0 as u8){nn=nn+1} sys_write(fd,s,nn); return 0 } |
| 36 | func n(v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(1,"-" as *u8,1)}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48;k=1}; while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1}; var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1}; sys_write(1,bb,k); return 0 } |
| 37 | func fn(fd: i64, v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;fp(fd,"-" as *u8)}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48;k=1}; while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1}; var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1}; sys_write(fd,bb,k); return 0 } |
| 38 | func x(v: i64) -> i64 { p("0x" as *u8); let bb:*u8=sys_mmap(20); var k:i64=0; var m:i64=v; if m==0{bb[0]=48;k=1}; while m>0{ let d:i64=m&15; if d<10{bb[k]=(48+d) as u8}else{bb[k]=(87+d) as u8}; m=(m>>4); k=k+1 } var i:i64=0; let o:*u8=sys_mmap(20); while i<k{o[i]=bb[k-1-i];i=i+1} sys_write(1,o,k); return 0 } |
| 39 | func rd32(buf: *u8, off: i64) -> i64 { return (buf[off] as i64)|((buf[off+1] as i64)<<8)|((buf[off+2] as i64)<<16)|((buf[off+3] as i64)<<24) } |
| 40 | func rd64(buf: *u8, off: i64) -> i64 { let q: *i64 = (buf as i64 + off) as *i64; return q[0] } called by 1: query_vidmem |
| 42 | func query_type(fd: i64, handle: i64, qtype: i64, psize: i64, outv: *i64) -> i64 |
| 51 | func query_vidmem(fd: i64, code: i64, adapter: i64, segment: i64, outb: *i64, outa: *i64) -> i64 |
| 59 | func main() -> i64 |