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_pfhost_admit_cubin.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_pfhost_admit_cubin.c` 31 lines · 1822 bytes Raw Blame History 1 /* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */ 2 #include "omega_blackwell_codegen_pfhost.h" 3 #include "omega_cubin.h" 4 #include 5 #include 6 extern int omega_blackwell_codegen_rl_prog_c(const OmegaRlSpec *,BlackwellIRProgram *); 7 extern int omega_blackwell_codegen_mc_prog_c(const OmegaMcSpec *,BlackwellIRProgram *); 8 extern uint32_t omega_rl_shared_bytes_c(const OmegaRlSpec *); 9 static BlackwellIRProgram a,b; 10 static uint8_t x[BW_MAX_IR_INSNS*16],y[BW_MAX_IR_INSNS*16]; 11 static int equal(uint32_t sa,uint32_t sb){ 12 size_t nx=0,ny=0,cx=0,cy=0;uint8_t *u=NULL,*v=NULL;char err[128];int ok=0; 13 if(omega_bw_encode_program(&a,x,sizeof x,&nx)||omega_bw_encode_program(&b,y,sizeof y,&ny))return 0; 14 if(omega_cubin_pack("pf_admit",x,nx,NULL,0,OMEGA_CUBIN_PARAM_BASE,omega_bw_gpr_declared(a.regalloc.peak_gpr_usage),sa,&u,&cx,err,sizeof err)){fprintf(stderr,"cubin: %s\n",err);return 0;} 15 if(!omega_cubin_pack("pf_admit",y,ny,NULL,0,OMEGA_CUBIN_PARAM_BASE,omega_bw_gpr_declared(b.regalloc.peak_gpr_usage),sb,&v,&cy,err,sizeof err))ok=cx==cy&&!memcmp(u,v,cx); 16 omega_cubin_free(u);omega_cubin_free(v);return ok; 17 } 18 int main(void){unsigned cases=0; 19 for(int m=0;m<=2;m++)for(uint32_t k=128;k<=256;k+=128){ 20 OmegaRlSpec s={k,32,1,m}; 21 int ca=omega_blackwell_codegen_rl_prog_c(&s,&a),cb=omega_blackwell_codegen_rl_prog(&s,&b); 22 if(ca!=cb)return 1; 23 if(!ca){if(!equal(omega_rl_shared_bytes_c(&s),omega_rl_shared_bytes(&s)))return 1;cases++;} 24 OmegaMcSpec t={k,4,m}; 25 ca=omega_blackwell_codegen_mc_prog_c(&t,&a);cb=omega_blackwell_codegen_mc_prog(&t,&b); 26 if(ca!=cb)return 1; 27 if(!ca){if(!equal(0,0))return 1;cases++;} 28 } 29 if(cases!=11){fprintf(stderr,"unexpected accepted cubin count %u\n",cases);return 1;} 30 printf("PFHOST-ADMIT-CUBIN-IDENTITY PASS cases=%u matching_refusals=1\n",cases);return 0; 31 }