code wiki / _hdl_build / _gpu_bm_qmd_v5_gate.nx

_gpu_bm_qmd_v5_gate.nx

buildroot/runtime/_hdl_build/_gpu_bm_qmd_v5_gate.nx

14060 B208 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind gate/prooftopic gpu
docsdependenciesstructsconstsfunctions

about

_gpu_bm_qmd_v5_gate.nx -- BARE-METAL SOVEREIGN-GPU rung BM-GPU-7a: REAL Blackwell QMDV05_00 descriptor. Hardens BM-GPU-C2 (_gpu_bm_qmd_gate): that rung's LAUNCH METHODS were faithful (SET_OBJECT 0xCDC0 + SEND_PCAS_A 0x2b4 + SEND_SIGNALING_PCAS2_B 0x2c0 + PCAS_ACTION=SCHEDULE) but its QMD-INTERNAL field offsets were REPRESENTATIVE ("QMDV0x bit-packing wasn't locatable"). THIS rung writes the REAL QMDV05_00 bit-packed layout, recovered (deep-research, 3-0 verified) verbatim from NVIDIA's open header classes/compute/clcdc0qmd.h and independently mirrored in tinygrad's NVCEC0_QMDV05_00. So the GPU LAUNCH DESCRIPTOR is now byte/bit-FAITHFUL to NVIDIA's published Blackwell spec, not a stand-in. QMDV05_00 fields are MW(hi:lo) BIT ranges over a 3072-bit (384-byte) struct (NOT plain byte fields): PROGRAM_ADDRESS_LOWER_SHIFTED4 MW(1055:1024), UPPER_SHIFTED4 MW(1076:1056) [stored = addr>>4] CTA_THREAD_DIMENSION0/1/2 MW(1103:1088)/(1119:1104)/(1127:1120) [block dims] CTA_RASTER_WIDTH/HEIGHT/DEPTH MW(1279:1248)/(1295:1280)/(1327:1312) [grid dims] REGISTER_COUNT MW(1136:1128); SHARED_MEMORY_SIZE_SHIFTED7 MW(1162:1152) CONSTANT_BUFFER_ADDR_LOWER_SHIFTED6(i) MW((1375+i*64):(1344+i*64)), UPPER_SHIFTED6(i) MW((1394+i*64):(1376+i*64)) CONSTANT_BUFFER_SIZE_SHIFTED4(i) MW((1407+i*64):(1395+i*64)); VALID(i) MW((1856+i*4):(1856+i*4)) QMD_GROUP_ID MW(149:144) HONEST SCOPE (no-false-green): the QMD LAYOUT is now REAL (round-trip: every field written at its real bit range reads back exactly; the SKED extracts program_address + the const-buffer VA from the REAL offsets and the GEMM runs off that real cbuf pointer). The SASS kernel itself STILL STANDS IN -- real Blackwell sm_120 SASS is not hand-emittable from open sources yet (encoding/control-bits unsolved; only Mesa NAK can emit it) = BM-GPU-7b, blocked on the open ecosystem / real silicon. So: descriptor REAL, machine-code modeled. GREEN iff: A) all real QMDV05_00 fields round-trip (write->read at real bit offsets == value); B) the SKED reading program_address + cbuf from the REAL offsets dispatches a GEMM == independent reference; C) TAMPER: zeroing CONSTANT_BUFFER_VALID(0) OR a wrong bit range -> field/dispatch mismatch (the real layout is load-bearing). Marker -> knowledge/status/gpu_baremetal.log (BMQMDV5GATE). license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_syscalls.nx _gpu_bm_qmd_v5_gate.nx

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

main p sys_write sys_mmap wr32 qmd_set qmd_set_bit qmd_get qmd_get_bit n sys_mmap ↻ sys_write ↻ gpfifo_run_qmd rd32 qmd_get ↻ wr32 ↻ rd32 ↻ sys_openat_append fp sys_write ↻ fx sys_mmap ↻ fp ↻ sys_write ↻ sys_write ↻ sys_close

structs

none

consts

32const COMPUTE_CLASS: i64 = 0xCDC0 // BLACKWELL_COMPUTE_A (NVCDC0), confirmed
33const SET_OBJECT: i64 = 0x0000
34const SEND_PCAS_A: i64 = 0x02b4
35const SEND_SIGNALING_PCAS2_B: i64 = 0x02c0
36const PCAS_ACTION_SCHEDULE: i64 = 0x2
37const DIM: i64 = 4

functions

39func p(s: *u8) -> i64 { var nn: i64=0; while s[nn]!=(0 as u8){nn=nn+1} sys_write(1,s,nn); return 0 }
called by 2: xmain calls 1: sys_write
40func 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 }
called by 2: fxmain calls 1: sys_write
41func 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 }
called by 1: main calls 2: sys_mmapsys_write
42func 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 }
43func fx(fd: i64, v: i64) -> i64 { 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 } let o:*u8=sys_mmap(20); var i:i64=0; while i<k{o[i]=bb[k-1-i];i=i+1} fp(fd,"0x" as *u8); sys_write(fd,o,k); return 0 }
called by 1: main calls 3: sys_mmapfpsys_write
44func rd32(b: *u8, o: i64) -> i64 { return (b[o] as i64)|((b[o+1] as i64)<<8)|((b[o+2] as i64)<<16)|((b[o+3] as i64)<<24) }
called by 2: gpfifo_run_qmdmain
45func wr32(b: *u8, o: i64, v: i64) -> i64 { b[o]=(v&0xff) as u8; b[o+1]=((v>>8)&0xff) as u8; b[o+2]=((v>>16)&0xff) as u8; b[o+3]=((v>>24)&0xff) as u8; return 0 }
called by 2: gpfifo_run_qmdmain
48func qmd_set_bit(q: *u8, b: i64, v: i64) -> i64
called by 1: qmd_set
53func qmd_get_bit(q: *u8, b: i64) -> i64 { return ((q[b >> 3] as i64) >> (b & 7)) & 1 }
called by 1: qmd_get
55func qmd_set(q: *u8, hi: i64, lo: i64, val: i64) -> i64
called by 1: main calls 1: qmd_set_bit
60func qmd_get(q: *u8, hi: i64, lo: i64) -> i64
called by 2: gpfifo_run_qmdmain calls 1: qmd_get_bit
68func gpfifo_run_qmd(gmem: *u8, pb_off: i64, pb_dwords: i64, cs: *i64) -> i64
called by 1: main calls 3: rd32qmd_getwr32
108func main() -> i64