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/chip_enum_diff.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 / chip_enum_diff.c` 60 lines · 2900 bytes Raw Blame History 1 /* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */ 2 #include "omega_chip_enum.h" 3 #include 4 #include 5 uint64_t oracle_enum(uint64_t,uint64_t,uint64_t,uint64_t,uint64_t); 6 static unsigned cases; 7 static int plant; 8 static void check(uint64_t m,uint64_t a,uint64_t b,uint64_t c,uint64_t d) { 9 uint64_t want=oracle_enum(m,a,b,c,d), got=omega_chip_enum_decide(m,a,b,c,d); 10 if (plant && !cases) got ^= 1; 11 if (got != want) { fprintf(stderr,"enum mismatch mode=%lu a=%lu b=%lu\n",m,a,b); exit(1); } 12 ++cases; 13 } 14 int main(int argc,char **argv) { 15 if (argc > 2 && !strcmp(argv[1],"--scan")) { 16 OmegaGpuPciDev rows[1024]; 17 for (int cap=-1;cap<=3;cap++) { 18 memset(rows,0xa5,sizeof rows); 19 int n=omega_gpu_chip_scan(argv[2],rows,cap); 20 printf("cap=%d n=%d\n",cap,n); 21 for(int i=0;i1; 30 const uint64_t masks[]={0xffff,0xff,0x1f,7}; 31 for(uint64_t v=0;v<=0xffff;v++) { 32 check(0,v,0x2e12,0x10de,0x2e12); 33 check(0,0x10de,v,0x10de,0x2e12); 34 check(1,v,0,0,0); 35 if (!!omega_gpu_chip_find(v,0x2e12) != (v==0x10de)) return 4; 36 if (!!omega_gpu_chip_find(0x10de,v) != (v==0x2e12)) return 5; 37 for(unsigned m=0;m<4;m++) check(3,v,masks[m],0,0); 38 } 39 const uint64_t edges[]={0,1,6,7,8,30,31,32,254,255,256,65534,65535,65536,UINT32_MAX-1,UINT32_MAX,UINT64_MAX}; 40 for(unsigned i=0;i