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/gemm_host_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 / gemm_host_plan_test.c` 105 lines · 6802 bytes Raw Blame History 1 /* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */ 2 #define CUDAPP_MIGRATION_PENDING_C_GEMM_HOST_PLAN 1 3 #include "../src/omega_gpu_gemm.c" 4 #include 5 static unsigned long cases; 6 static void ck(uint64_t got, uint64_t want, const char *what) { 7 if (getenv("GEMM_POLICY_RED") && strcmp(what,"value status")) want ^= 1; 8 if (got != want) { fprintf(stderr,"FAIL %s case=%lu got=%lu want=%lu\n",what,cases,got,want); exit(1); } 9 cases++; 10 } 11 static void load(uint64_t x[32], const OmegaGemmCfg *c) { 12 memset(x,0,32*sizeof *x); x[0]=(unsigned)c->type; x[1]=c->rt;x[2]=c->ct;x[3]=c->wm;x[4]=c->wn; 13 x[5]=c->stall;x[6]=(unsigned)c->mutant;x[7]=c->band; 14 } 15 static uint64_t val(uint64_t op,uint64_t a,uint64_t b,uint64_t c,uint64_t d) { 16 uint64_t r; ck(omega_gemm_value(&r,op,a,b,c,d),OMEGA_OK,"value status");return r; 17 } 18 struct Calls { uint64_t y[64]; unsigned n, fail; }; 19 static int collect(void *v,OmegaGemmKind k,const uint32_t *a,uint32_t gx,uint32_t gy,uint32_t th) { 20 struct Calls *c=v; c->n++; c->y[8+2*k]=gx;c->y[9+2*k]=gy;c->y[14+k]=th; 21 for(unsigned w=0;w<10;w++) c->y[24+10*k+w]=a[w]; 22 return c->n==c->fail; 23 } 24 int main(void) { 25 const uint32_t edges[]={0,1,2,3,4,5,7,8,9,14,15,16,17,31,32,33,63,64,65,127,128,129,255,256,257,16383,16384,16385,UINT32_MAX-1,UINT32_MAX}; 26 const uint64_t lds[]={0,1,2,3,15,16,17,31,32,33,65535,65536,65537,UINT32_MAX-1,UINT32_MAX,UINT64_MAX}; 27 OmegaGemmCfg c; uint64_t x[32],y[64],r; 28 for(unsigned t=0;t<5;t++) { 29 omega_gpu_gemm_default_cfg((OmegaGpuGemmType)t,&c); 30 ck(val(0,t,0,0,0),esz(c.type),"esz");ck(val(1,t,0,0,0),kstep(c.type),"kstep"); 31 ck(val(2,t,0,0,0),type_ok(t),"type"); 32 for(unsigned field=0;field<8;field++) for(unsigned z=0;z=(unsigned)y[54]+fail) break; 84 ck(y[8+2*k],calls.y[8+2*k],"drive gx");ck(y[9+2*k],calls.y[9+2*k],"drive gy");ck(y[14+k],calls.y[14+k],"drive threads"); 85 for(unsigned w=0;w<10;w++) ck(y[24+10*k+w],calls.y[24+10*k+w],"drive args"); 86 } 87 } 88 for(unsigned i=0;i=lds[j],"reuse"); 92 } 93 const char *envs[]={NULL,"","0","00","1","01"}; 94 for(unsigned i=0;i