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/cmdlist_plan_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 / cmdlist_plan_test.c` 120 lines · 6938 bytes Raw Blame History 1 /* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */ 2 /* Independent host oracle: enumerate overlapping half-open intervals, then drain 3 * all outstanding dispatches at the first conflicting dispatch. No GPU access. */ 4 #include "cudapp_native.h" 5 #include "omega_blackwell_qmd.h" 6 #include 7 #include 8 #include 9 #include 10 #define MAX 4096u 11 #define STRIDE 49u 12 #define SLOTS (MAX * STRIDE) 13 static uint64_t program[SLOTS], barriers[MAX], reference[MAX]; 14 static unsigned failures; 15 static uint64_t seed = 0x9e3779b97f4a7c15ull; 16 static uint64_t rnd(void) { seed ^= seed << 13; seed ^= seed >> 7; seed ^= seed << 17; return seed; } 17 static void check(int ok, const char *s) { if (!ok) { fprintf(stderr,"FAIL %s\n",s); failures++; } } 18 static unsigned conflict(unsigned a, unsigned b) { 19 const uint64_t *x=program+a*STRIDE,*y=program+b*STRIDE; 20 if (x[0]==17 || y[0]==17) return 7; 21 unsigned hazard=0; 22 for (unsigned i=0;i64?((uint32_t)a[8]+7)/8*8:64; 97 OmegaBlackwellQmdConfig c={.code_va=a[7],.cbank_va=bv,.scratch_va=a[13],.sem_va=a[12]+a[1]*16,.qmd0_va=qv+512,.qmd1_va=qv,.threads_x=(uint32_t)a[3],.threads_y=a[4]?(uint32_t)a[4]:1,.grid_x=(uint32_t)a[5],.grid_y=(uint32_t)a[6],.gpr_count=gp,.shared_bytes=(uint32_t)a[9]}; 98 check(omega_blackwell_build_qmd1(q1,&c)==0,"C QMD oracle");omega_blackwell_build_qmd0(q0,qv+512,qv); 99 for(unsigned j=0;j<96;j++) { check(words[256+j]==q1[j],"QMD1 differential");check(words[384+j]==q0[j],"QMD0 differential"); } 100 } 101 a[1]=4;check(omega_cmdlist_record(&r,a,16,args,32,words,512)==0 && r==2,"record full refusal"); 102 a[1]=0;a[9]=32769;check(omega_cmdlist_record(&r,a,16,args,32,words,512)==0 && r!=0,"shared bound refusal"); 103 a[9]=0;a[0]=MAX;a[1]=MAX-1; 104 check(omega_cmdlist_record(&r,a,16,args,32,words,512)==0 && r==0,"full-capacity final record accepted"); 105 a[1]=MAX;check(omega_cmdlist_record(&r,a,16,args,32,words,512)==0 && r==2,"capacity+1 record refused"); 106 } 107 int main(int argc,char **argv) { 108 (void)argc;(void)argv; edge_tests(); 109 for(unsigned t=0;t<12000;t++) { 110 unsigned n=1+rnd()%32; memset(program,0,n*STRIDE*sizeof *program); 111 for(unsigned i=0;i>1)&1); 115 if(failures) break; 116 } 117 records(); 118 printf("%s cmdlist independent differential: 12000 randomized programs, edges, 1000 launch records\n",failures?"FAIL":"PASS"); 119 return failures?1:0; 120 }