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/components/numerical.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 / components / numerical.c` 78 lines · 4346 bytes Raw Blame History 1 /* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */ 2 /* Verification only: substitute native-produced IR at the existing test's 3 * generator seam. Reuse its unchanged simulator, data, packing and oracle. */ 4 #ifdef COMPONENT_STAGED 5 #define omega_blackwell_codegen_fp8gemm_prog component_native_staged 6 #define main component_original_staged_main 7 #include "../gpu_fp8gemm_test.c" 8 #undef main 9 #undef omega_blackwell_codegen_fp8gemm_prog 10 #else 11 #define omega_blackwell_codegen_fp8_gemv_prog component_native_direct 12 #define omega_blackwell_codegen_fp8_gemv2_prog component_native_rowpipe 13 #define main component_original_direct_main 14 #include "../gpu_fp8_api_test.c" 15 #undef main 16 #undef omega_blackwell_codegen_fp8_gemv_prog 17 #undef omega_blackwell_codegen_fp8_gemv2_prog 18 #endif 19 #include "native-frame.h" 20 static uint32_t shape[5]; 21 #ifdef COMPONENT_STAGED 22 int component_native_staged(const OmegaFp8GemmSpec *s,BlackwellIRProgram *p) { 23 if(s->k!=shape[0]||s->lane_bytes!=shape[1]||s->mt!=shape[2]||s->warps!=shape[3]||s->rowmap!=shape[4]||s->mutant) return -1; 24 *p=native_program;return 0; 25 } 26 #else 27 static int component_native_gemv(const OmegaFp8GemvSpec *s,BlackwellIRProgram *p) { 28 if(s->k!=shape[0]||s->lane_bytes!=shape[1]||s->rows!=shape[2]||s->warps!=shape[3]||s->wfirst!=shape[4]||s->mutant||s->coal||s->depth||s->sched) return -1; 29 *p=native_program;return 0; 30 } 31 int component_native_direct(const OmegaFp8GemvSpec *s,BlackwellIRProgram *p) {return component_native_gemv(s,p);} 32 int component_native_rowpipe(const OmegaFp8GemvSpec *s,BlackwellIRProgram *p) {return component_native_gemv(s,p);} 33 #endif 34 int main(int argc,char **argv) { 35 /* frame K LB rows/MT warps wfirst/rowmap family */ 36 if(argc!=8) return 65; 37 for(unsigned j=0;j<5;j++) shape[j]=(uint32_t)strtoul(argv[j+2],NULL,10); 38 char msg[512];size_t bad=0;int rc; 39 #ifdef COMPONENT_STAGED 40 if(!frame_load(argv[1],1)) return 66; 41 SimPt point={shape[0],40,shape[1],shape[2],shape[3],2,{1,5,9},3}; 42 int moved=0; 43 rc=sim_point2(&point,0,41,(int)shape[4],1,0,msg,sizeof msg,&bad,&moved); 44 if(rc||bad||(shape[4]&&!moved)) {fprintf(stderr,"native staged numerical: rc%d bad%zu: %s\n",rc,bad,msg);return 1;} 45 printf("native staged both fragment orders, empty segment, tail rows, multi-segment%s: %s\n",shape[4]?", YMAP movement":"",msg); 46 if(!frame_wrong_result()) return 67; 47 bad=0;rc=sim_point2(&point,0,41,(int)shape[4],1,0,msg,sizeof msg,&bad,&moved); 48 if(rc||!bad) {fprintf(stderr,"FFMA->FADD wrong-result mutant not numerically caught: %s\n",msg);return 2;} 49 printf("wrong-result mutant: %s\n",msg); 50 native_program.insns[0].op=(BlackwellIROpcode)0x7fffffff; 51 rc=sim_point2(&point,0,41,(int)shape[4],1,0,msg,sizeof msg,&bad,&moved); 52 #else 53 if(!frame_load(argv[1],0)) return 66; 54 g_sim_variant=atoi(argv[7]); 55 if(g_sim_variant!=1&&g_sim_variant!=2) return 65; 56 Weights weights;weights_make(&weights,3,128,shape[0],41); 57 uint32_t ids[3]={2,0,1},seed=42; 58 size_t words=(size_t)3*shape[0];float *x=malloc(words*4),*y=malloc(3*128*4); 59 if(!x||!y) return 68; 60 for(size_t j=0;jFADD wrong-result mutant not numerically caught: %s\n",msg);return 2;} 70 printf("wrong-result mutant: double-oracle bad%zu\n",bad); 71 native_program.insns[0].op=(BlackwellIROpcode)0x7fffffff; 72 rc=sim_gemv(&spec,&weights,3,ids,x,3,y,2,0,msg,sizeof msg); 73 weights_free(&weights);free(x);free(y); 74 #endif 75 if(!rc||!strstr(msg,"opcode not modelled")) {fprintf(stderr,"unknown-op refusal lost: rc%d %s\n",rc,msg);return 3;} 76 printf("unknown-op mutant refused: %s\n",msg); 77 return 0; 78 }