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_tern_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_tern_diff_test.c` 91 lines · 6021 bytes Raw Blame History 1 /* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */ 2 #include 3 #include 4 #include 5 #define CUDAPP_MIGRATION_PENDING_C_CODEGEN_TERN 1 6 #define omega_tern_gemv_chunks oracle_chunks 7 #define omega_tern_gemv_spec_ok oracle_spec_ok 8 #define omega_tern_gemv_steps oracle_steps 9 #define omega_tern_gemv_coalesced_out oracle_coalesced 10 #define omega_tern_gemv_out_slot_bytes oracle_slot 11 #define omega_tern_gemv_shared_bytes oracle_shared 12 #define omega_tern_word_offset oracle_offset 13 #define omega_tern_i2fp_violations oracle_violations 14 #define omega_blackwell_codegen_tern_gemv_prog oracle_prog 15 #define omega_tern_gemv_prog_stats oracle_stats 16 #include "../src/omega_blackwell_codegen_tern.c" 17 #undef omega_tern_gemv_chunks 18 #undef omega_tern_gemv_spec_ok 19 #undef omega_tern_gemv_steps 20 #undef omega_tern_gemv_coalesced_out 21 #undef omega_tern_gemv_out_slot_bytes 22 #undef omega_tern_gemv_shared_bytes 23 #undef omega_tern_word_offset 24 #undef omega_tern_i2fp_violations 25 #undef omega_blackwell_codegen_tern_gemv_prog 26 #undef omega_tern_gemv_prog_stats 27 #include "omega_gpu_om_ir.h" 28 #include "cudapp_native.h" 29 extern uint32_t omega_tern_gemv_chunks(const OmegaTernGemvSpec *); 30 extern int omega_tern_gemv_spec_ok(const OmegaTernGemvSpec *); 31 extern uint32_t omega_tern_gemv_steps(const OmegaTernGemvSpec *); 32 extern int omega_tern_gemv_coalesced_out(const OmegaTernGemvSpec *); 33 extern uint32_t omega_tern_gemv_out_slot_bytes(const OmegaTernGemvSpec *); 34 extern uint32_t omega_tern_gemv_shared_bytes(const OmegaTernGemvSpec *); 35 extern uint64_t omega_tern_word_offset(uint32_t,uint32_t,uint32_t,uint32_t,uint32_t); 36 extern long omega_tern_i2fp_violations(const BlackwellIRProgram *); 37 extern int omega_blackwell_codegen_tern_gemv_prog(const OmegaTernGemvSpec *,BlackwellIRProgram *); 38 static BlackwellIRProgram a,b; 39 static unsigned cases,refused; 40 static int equal(const OmegaTernGemvSpec *s) { 41 int ra=oracle_prog(s,&a),rb=omega_blackwell_codegen_tern_gemv_prog(s,&b); 42 if((ra==0)!=(rb==0)) goto fail; 43 /* A refused program has no specified IR output; compare the refusal, not stale scratch state. */ 44 if(ra){refused++;return 1;} 45 if(a.count!=b.count||memcmp(a.insns,b.insns,a.count*sizeof a.insns[0])||memcmp(&a.regalloc,&b.regalloc,sizeof a.regalloc)) goto fail; 46 static uint8_t x[BW_MAX_IR_INSNS*16],y[BW_MAX_IR_INSNS*16];size_t nx=0,ny=0; 47 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))goto fail; 48 if(omega_tern_i2fp_violations(&b)!=oracle_violations(&a))goto fail; 49 cases++;return 1; 50 fail: 51 fprintf(stderr,"TERN DIFF k=%u layout=%u rows=%u warps=%u depth=%u epi=%u mutant=%d C=%d Omega=%d count=%zu/%zu\n",s->k,s->layout,s->rows,s->warps,s->depth,s->epi,s->mutant,ra,rb,a.count,b.count); 52 for(size_t i=0;i