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/codegen_tc_sim.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 / codegen_tc_sim.c` 68 lines · 2880 bytes Raw Blame History 1 /* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */ 2 #include 3 #include 4 #include 5 #include "omega_blackwell_codegen_tc.h" 6 #include "bw_warp_sim_tc.h" 7 8 static BlackwellIRProgram p; 9 static WsSim sim; 10 11 static void pointer(unsigned at, const void *p) { 12 uint64_t v=(uintptr_t)p; 13 sim.cbank[at/4]=(uint32_t)v; 14 sim.cbank[at/4+1]=(uint32_t)(v>>32); 15 } 16 static void range(unsigned at,const void *p,size_t bytes) { 17 sim.ranges[at].lo=(uintptr_t)p; 18 sim.ranges[at].hi=(uintptr_t)p+bytes; 19 sim.nranges=at+1; 20 } 21 static int probe(void) { 22 static uint32_t input[OMEGA_TC_PROBE_IN_BYTES/4]; 23 static float output[OMEGA_TC_PROBE_OUT_BYTES/4]; 24 for(unsigned i=0;i<192;i++)input[i]=0x3f803f80u; 25 for(unsigned i=0;i<128;i++) { 26 float c=(float)(i%17); 27 memcpy(&input[192+i],&c,4); 28 } 29 for(int mutant=0;mutant<=1;mutant++) { 30 if(omega_blackwell_codegen_tc_probe_prog(mutant,&p))return 1; 31 memset(&sim,0,sizeof sim);sim.p=&p;sim.threads=32; 32 memset(output,0xee,sizeof output); 33 pointer(0x380,input);pointer(0x388,output); 34 range(0,input,sizeof input);range(1,output,sizeof output); 35 if(ws_run(&sim,1,1)){fprintf(stderr,"probe sim: %s\n",sim.msg);return 1;} 36 for(unsigned i=0;i<128;i++) { 37 float want=mutant?0.0f:(float)(i%17); 38 for(unsigned k=0;k<16;k++)want+=1.0f; 39 if(output[i]!=want){fprintf(stderr,"probe output[%u] differs\n",i);return 1;} 40 } 41 } 42 puts("CODEGEN TC PROBE SIM PASS (accumulate and zero accumulator)");return 0; 43 } 44 static int bandwidth(void) { 45 enum { THREADS=64, ITERS=3, GRID=2, REGION=ITERS*THREADS*128/4 }; 46 static uint32_t input[GRID*REGION],output[GRID*THREADS]; 47 for(unsigned i=0;i