Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/CUDApp/blob/main/tests/gpu_resident_test.c # CUDApp CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `CUDApp / tests / gpu_resident_test.c` 81 lines · 5107 bytes Raw Blame History 1 /* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */ 2 #include "omega_gpu_resident.h" 3 #include "gpu_resident_grid.h" 4 #include "gpu_resident_fixture.h" 5 #include "omega_bw_hazard.h" 6 /* The static scoreboard checker over the encoded kernel. The warp simulator has no instruction latency, so a 7 * variable-latency producer (S2R, loads, atomics) read without its wait is invisible to it and is caught only here 8 * or on the chip (2026-11-12: S2R emitted fixed-latency, GB10 marker timeout). */ 9 static int hazards(unsigned n, unsigned ctas) { 10 static BlackwellIRProgram p; static OmegaBwHazardReport rep; 11 static uint8_t code[65536]; OmegaBlackwellKernel kernel; uint64_t err=0; 12 if(omega_gpu_resident_build(resident_model,n,64,ctas,&p,&err)) { fprintf(stderr,"resident build refused err=%llu\n",(unsigned long long)err);return 1; } 13 size_t bytes=omega_bw_program_code_bytes(&p); 14 if(bytes>sizeof code||omega_blackwell_kernel_encode_into(&p,code,bytes,&kernel)) { fprintf(stderr,"resident encode refused\n");return 1; } 15 int rc=omega_bw_hazard_check(code,bytes,&rep); 16 if(rc||rep.count) { 17 fprintf(stderr,"resident hazards layers=%u ctas=%u: rc=%d findings=%zu\n",n,ctas,rc,rep.count); 18 for(size_t i=0;i>32); } 49 s.ranges[0]=(WsRange){(uintptr_t)resident_model,(uintptr_t)resident_model+sizeof resident_model}; 50 s.ranges[1]=(WsRange){(uintptr_t)arena,(uintptr_t)arena+sizeof arena}; 51 s.ranges[2]=(WsRange){(uintptr_t)sync,(uintptr_t)sync+sizeof sync};s.nranges=3; 52 int rc=resident_grid(&s,2,order); 53 if(!drop && (rc||memcmp(arena,expected,sizeof arena)||sync[1]!=5)) { 54 fprintf(stderr,"resident rc=%d %s gen=%u order=%u quantum=%u\n",rc,s.msg,sync[1],order,quantum); 55 for(unsigned i=32;i<46;i++) fprintf(stderr,"%u %g expected %g\n",i,arena[i],expected[i]); 56 return 1; 57 } 58 return drop ? (!rc && !memcmp(arena,expected,sizeof arena)) : 0; 59 } 60 int main(int argc,char **argv) { 61 if(argc!=2||strcmp(argv[1],"--sim")) { fprintf(stderr,"use --sim; chip tier NOT_RUN\n");return 2; } 62 for(unsigned n=1;n<=5;n+=4) for(unsigned c=1;c<=2;c++) if(hazards(n,c)) return 1; 63 for(unsigned w=0;w<2;w++) for(unsigned o=0;o<2;o++) for(unsigned q=1;q<=17;q+=8) if(run(0,o,q,w)) return 1; 64 if(run(1,0,10000,0)) { fprintf(stderr,"dropped barrier survived\n");return 1; } 65 uint32_t bad[40];memcpy(bad,resident_model,sizeof bad);bad[3]=64; 66 static BlackwellIRProgram p;uint64_t err=0; 67 if(!omega_gpu_resident_build(bad,5,64,2,&p,&err)) return 1; 68 memcpy(bad,resident_model,sizeof bad);bad[0]=99; 69 if(!omega_gpu_resident_build(bad,5,64,2,&p,&err)) return 1; 70 const unsigned fields[]={0,1,2,3,4,4,5,5,6,7,13,28}; 71 const uint32_t values[]={0,64,64,0,0,33,0,33,1,1,2,2}; 72 for(unsigned i=0;i