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_qmma_diff_test.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_qmma_diff_test.c` 200 lines · 11164 bytes Raw Blame History 1 /* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */ 2 #include 3 #include "omega_cubin.h" 4 #include 5 #define CUDAPP_MIGRATION_PENDING_C_CODEGEN_QMMA 1 6 #define CUDAPP_MIGRATION_PENDING_C_QMMA_PROBE_REST 1 7 #define omega_qmma_is_mark oracle_qmma_is_mark 8 #define omega_qmma_patch_code oracle_qmma_patch_code 9 #define omega_qmma_patch_selftest oracle_qmma_patch_selftest 10 #define omega_blackwell_codegen_qmma_probe_prog oracle_qmma_probe 11 #define omega_blackwell_codegen_qmma_peak_prog oracle_qmma_peak 12 #define omega_blackwell_codegen_f2e4_probe_prog oracle_f2e4_probe 13 #include "../src/omega_blackwell_codegen_qmma.c" 14 #undef omega_blackwell_codegen_qmma_probe_prog 15 #undef omega_blackwell_codegen_qmma_peak_prog 16 #undef omega_blackwell_codegen_f2e4_probe_prog 17 extern int omega_blackwell_codegen_qmma_probe_prog(int, uint32_t, BlackwellIRProgram *); 18 extern int omega_blackwell_codegen_qmma_peak_prog(uint32_t, uint32_t, uint32_t, uint32_t, BlackwellIRProgram *); 19 extern int omega_blackwell_codegen_f2e4_probe_prog(BlackwellIRProgram *); 20 #undef omega_qmma_patch_code 21 extern int omega_qmma_patch_code(const BlackwellIRProgram *, uint8_t *, size_t); 22 static uint32_t mutant_unit(uint64_t *result,uint64_t k,uint64_t x,uint64_t y,uint64_t z,void *ins,uint64_t ni,void *meta,uint64_t nm) { 23 uint32_t rc=omega_cg_qmma(result,k,x,y,z,ins,ni,meta,nm); 24 if(!rc && !*result) ((uint64_t *)ins)[6]^=UINT64_C(1)<<32; 25 return rc; 26 } 27 static BlackwellIRProgram a,b; 28 static uint8_t x[BW_MAX_IR_INSNS*16],y[BW_MAX_IR_INSNS*16]; 29 static size_t nx,ny; 30 static unsigned cases; 31 static int same(int ca,int cb,const char *label) { 32 nx=ny=0; 33 if ((ca==0)!=(cb==0)) {fprintf(stderr,"%s refusal C=%d Omega=%d\n",label,ca,cb);return 0;} 34 if(ca) return 1; 35 if(omega_bw_encode_program(&a,x,sizeof x,&nx)||omega_bw_encode_program(&b,y,sizeof y,&ny)||nx!=ny||memcmp(x,y,nx)) { 36 fprintf(stderr,"%s differs: count %zu/%zu bytes %zu/%zu\n",label,a.count,b.count,nx,ny); 37 for(size_t i=0;icount; 98 for(size_t i=0;icount;i++) if(p->insns[i].op==BW_IR_MOV_IMM && p->insns[i].imm==7) { 99 if(found!=p->count) return 0; 100 found=i; 101 } 102 if(found==p->count || found*16+2*sizeof(uint32_t)>len) return 0; 103 *field=found*16+sizeof(uint32_t); 104 return 1; 105 } 106 static int iteration_only(const uint8_t *code,size_t len,const uint8_t *base,size_t base_len, 107 size_t field,uint32_t iterations) { 108 if(len!=base_len || field+sizeof(uint32_t)>len) return 0; 109 uint32_t decoded=0; 110 for(unsigned i=0;i