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/test_core_cubin_message.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 / test_core_cubin_message.c` 35 lines · 2265 bytes Raw Blame History 1 /* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */ 2 #include "omega_cubin.h" 3 #include "cudapp_native.h" 4 #include 5 #include 6 #include 7 #define CUBIN_OM_WORDS 16777216u 8 #include "core_cubin_refusal_ref.inc" 9 static uint64_t state=UINT64_C(0x56f0138093aac175); 10 static uint64_t next(void){state^=state<<13;state^=state>>7;state^=state<<17;return state;} 11 int main(int argc,char **argv){ 12 int flip=argc==2&&!strcmp(argv[1],"--flip"); 13 OmegaCubinParam params[64]; 14 for(unsigned t=0;t<10000;t++){ 15 for(size_t i=0;i<64;i++){params[i].offset=(uint32_t)next();params[i].size=(uint32_t)next();params[i].is_pointer=(uint32_t)next();} 16 uint64_t m[16]={0},d[3]={next()%8,next()%70,next()},r; 17 m[0]=t%8;m[1]=t&1?OMEGA_CUBIN_SM_86:OMEGA_CUBIN_SM_121; 18 m[2]=d[0];m[3]=d[1];m[4]=d[2];m[5]=next();m[6]=t%65; 19 m[7]=(uint32_t)next();m[8]=(uint32_t)next();m[9]=(uint32_t)next();m[12]=t%301; 20 if(d[1]=sizeof staging){fprintf(stderr,"cubin message status=%u case=%u\n",status,t);return 1;} 25 if(m[12])memcpy(actual,staging,(size_t)r+1); 26 if(flip&&t==1)actual[0]^=1; 27 if(memcmp(actual,expected,sizeof actual)){fprintf(stderr,"cubin message mismatch case=%u rc=%llu detail=%llu cap=%llu\n",t,(unsigned long long)m[0],(unsigned long long)d[0],(unsigned long long)m[12]);return 1;} 28 } 29 for(uint32_t s=0;s<64;s++){ 30 uint64_t m[16]={8,0,s},r;m[12]=256; 31 char actual[256],expected[256];snprintf(expected,sizeof expected,"cubin_elf.om stopped with status %u",s); 32 if(omega_cubmsg(&r,m,16,actual,sizeof actual)||strcmp(actual,expected)){fputs("cubin bridge status message mismatch\n",stderr);return 1;} 33 } 34 puts("CORE-UTIL cubin messages PASS: 10000 differential cases, truncation and bridge status boundaries");return 0; 35 }