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/runtime/api_plan_unit.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 / runtime / api_plan_unit.c` 115 lines · 9357 bytes Raw Blame History 1 /* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */ 2 #define OMEGA_API_PLAN_ORACLE 1 3 #include "omega_api_plan.h" 4 #include 5 #include 6 #include 7 #include 8 static uint64_t cases[6]; 9 static int selected=-1; 10 static void check(unsigned f,unsigned m,uint64_t a[16]){ 11 if(selected>=0&&(unsigned)selected!=f)return; 12 uint64_t b[16],c[16];memcpy(b,a,sizeof b);memcpy(c,a,sizeof c); 13 for(unsigned i=8;i<16;i++)b[i]=c[i]=0x9e3779b9u+i; 14 int want=-(int)ap_c(f,m,b),got=ap_om(f,m,c); 15 if(want!=got||memcmp(b,c,sizeof b)){ 16 fprintf(stderr,"API PLAN differential FAIL family=%u mode=%u want=%d got=%d\n",f,m,want,got); 17 for(unsigned i=0;i<16;i++)fprintf(stderr,"%u: in=%"PRIu64" C=%"PRIu64" OM=%"PRIu64"\n",i,a[i],b[i],c[i]); 18 exit(1); 19 } 20 cases[f]++; 21 } 22 #define C(F,M,...) do{uint64_t a[16]={__VA_ARGS__};check(F,M,a);}while(0) 23 int main(int argc,char **argv){ 24 if(argc==2)selected=atoi(argv[1]); 25 const uint32_t edge[]={0,1,2,3,7,8,15,16,31,32,63,64,127,128,255,256,511,512,1023,1024,2047,2048,8191,8192,16383,16384,65535,65536,131071,131072,262143,262144,UINT32_MAX-1,UINT32_MAX}; 26 const size_t en=sizeof edge/sizeof edge[0]; 27 for(uint32_t x=0;x<=262145;x++){C(AP_MM,0,1,1,x,0,0);if(x<=16385)C(AP_MM,0,1,x,1,0,0);if(x<=8193)C(AP_MM,0,x,1,1,0,0);} 28 for(size_t i=0;i64?last-64:0,last,n);} 38 for(unsigned mt=1;mt<=512;mt++)for(unsigned per=1;per<=512;per++)for(unsigned r=1;r<=4;r*=2)C(AP_MM,7,mt*16,per*16,r); 39 for(unsigned b=0;b<=1025;b++)C(AP_MM,8,b); 40 for(size_t i=0;i