code wiki / _hdl_build / _gpu_bm_qmd_gate.nx
_gpu_bm_qmd_gate.nx
buildroot/runtime/_hdl_build/_gpu_bm_qmd_gate.nx
about
_gpu_bm_qmd_gate.nx -- BARE-METAL SOVEREIGN-GPU rung BM-GPU-C2: FAITHFUL Ampere+ compute QMD-by-pointer dispatch
(hardens BM-GPU-C1's representative compute launch toward the real silicon dispatch).
The real Ampere+ compute launch (NVC6C0, methods VERIFIED vs open spec clc6c0.h): bind the compute class
(SET_OBJECT@0x0), write a QMD descriptor to memory, then SEND_PCAS_A@0x2b4 = QMD_GPU_VA>>8, then
SEND_SIGNALING_PCAS2_B@0x2c0 with PCAS_ACTION INVALIDATE_COPY_SCHEDULE(=3)/SCHEDULE(=2) -> the SKED engine fetches
the QMD and dispatches the grid. Kernel params live in a CONSTANT BUFFER (the real mechanism). The modeled SKED
reads the QMD's const-buffer ptr, loads the GEMM params (A/B/C addrs + M/N/K), and runs the GEMM (SASS stand-in).
NISHI-ECOSYSTEM-ONLY: our model+driver+command-stream. HONEST SCOPE: the LAUNCH METHOD SEQUENCE is FAITHFUL/verified
(SET_OBJECT/SEND_PCAS_A/SEND_SIGNALING_PCAS2_B + the real PCAS_ACTION values); the QMD-INTERNAL field byte-offsets
are REPRESENTATIVE (the QMDV0x bit-packing wasn't locatable in one fetch); the SKED+SASS execution STANDS IN. Real
QMD layout + Blackwell sm_120 SASS GEMM kernel = BM-GPU-7 on real silicon.
GREEN iff: after the faithful QMD dispatch, C == independent reference GEMM; AND tampers (no SEND_SIGNALING_PCAS2_B /
PCAS_ACTION without SCHEDULE [NOP=0 or INVALIDATE-only=1]) leave C unwritten (the real SCHEDULE action is required).
Marker -> knowledge/status/gpu_baremetal.log (BMQMDGATE). 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
| 20 | const COMPUTE_CLASS: i64 = 0xCDC0 |
| 21 | const DIM: i64 = 4 |
| 22 | const SET_OBJECT: i64 = 0x0000 |
| 23 | const SEND_PCAS_A: i64 = 0x02b4 |
| 24 | const SEND_SIGNALING_PCAS2_B: i64 = 0x02c0 |
| 25 | const PCAS_ACTION_SCHEDULE: i64 = 0x2 |
| 26 | const PCAS_ACTION_INVALIDATE_COPY_SCHEDULE: i64 = 0x3 |
functions
| 28 | 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 } |
| 29 | 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 } |
| 30 | 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 } |
| 31 | 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 } |
| 32 | func 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 } |
| 33 | func 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) } |
| 34 | func 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 } |
| 35 | func rd64a(b: *u8, o: i64) -> i64 { return (rd32(b,o) & 0xffffffff) | (rd32(b,o+4) << 32) } |
| 39 | func gpfifo_run_qmd(gmem: *u8, pb_off: i64, pb_dwords: i64, cs: *i64) -> i64 |
| 75 | func emit1(gmem: *u8, off: i64, subch: i64, method: i64, data: i64) -> i64 |
| 79 | func main() -> i64 |