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/om/prefill-shape/scoped-check.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 / om / prefill-shape / scoped-check.c` 59 lines · 4094 bytes Raw Blame History 1 /* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */ 2 /* Real call-path isolation test. The device-open and kernel-cache boundaries are 3 * intercepted; neither a GPU nor fake matrix arithmetic is used. */ 4 #include "omega_gpu_prefill.h" 5 #include "omega_blackwell_codegen_qg.h" 6 #include 7 #include 8 #include "../standalone-oracles/oracle.h" 9 static unsigned opened, keyed, failed; 10 static OmegaQgSpec want; 11 int __wrap_omega_gpu_pf_open_locked(void) { opened=(unsigned)so_call(5,opened,1,0,0); return OMEGA_GPU_PF_OK; } 12 int __wrap_omega_gpu_pf_kernel_locked(const OmegaPfKey *key, OmegaPfGen gen, OmegaPfKernel *out) { 13 OmegaQgSpec got; (void)gen; (void)out; 14 memcpy(&got,key->words,sizeof got); keyed=(unsigned)so_call(5,keyed,1,0,0); 15 if (!so_eq((uint64_t)(int64_t)memcmp(&got,&want,sizeof got),0)) { fprintf(stderr,"wrong per-call kernel key\n"); failed=so_bad(failed,0); } 16 return OMEGA_GPU_PF_TOO_LARGE; /* stop before allocation/launch */ 17 } 18 static void expect(unsigned rt,unsigned warps,unsigned group,unsigned mutant) { 19 memset(&want,0,sizeof want);want.rt=rt;want.warps=warps;want.group=group;want.mutant=mutant; 20 want.k=128;want.n=256;want.wait=45;want.direct=1; 21 opened=keyed=0; 22 } 23 static void check(int ok,const char *why) { failed=so_bad(failed,ok); if(!ok) fprintf(stderr,"%s\n",why); } 24 static int scoped(unsigned rt,unsigned group) { 25 return omega_gpu_pf_qgemm_scoped(rt,8,45,group,256,128,OMEGA_GPU_PF_PLAIN,16,1,0,32,48,64,NULL); 26 } 27 int main(void) { 28 omega_gpu_pf_qgemm_set_shape(2,4,45);omega_gpu_pf_qgemm_set_group(1);omega_gpu_pf_qgemm_test_set_mutant(1); 29 check(so_eq(omega_gpu_pf_qgemm_scoped_bm(8,8,45,4),128),"checked128 tile height"); 30 check(so_eq(omega_gpu_pf_qgemm_scoped_bm(4,8,45,0),64),"checked64 tile height"); 31 check(so_eq(omega_gpu_pf_qgemm_scoped_bm(0,8,45,4),0),"zero shape refused"); 32 check(so_eq(omega_gpu_pf_qgemm_scoped_bm(8,8,121,4),0),"unsafe wait refused"); 33 check(so_eq(omega_gpu_pf_qgemm_scoped_bm(8,8,45,6),0),"group outside bound refused"); 34 for(unsigned i=0;i<3;i++) { 35 unsigned rt=(unsigned)so_call(41,so_eq(i,1),8,4,0),group=(unsigned)so_call(41,so_eq(i,1),4,0,0); 36 expect(rt,8,group,0); 37 int src=scoped(rt,group); 38 check(so_all(so_eq((uint64_t)(int64_t)src,(uint64_t)(int64_t)OMEGA_GPU_PF_TOO_LARGE),so_eq(opened,1),so_eq(keyed,1)),"scoped call reached its own kernel key"); 39 expect(2,4,1,1); 40 int rc=omega_gpu_pf_qgemm(256,128,OMEGA_GPU_PF_PLAIN,16,1,0,32,48,64,NULL); 41 check(so_all(so_eq((uint64_t)(int64_t)rc,(uint64_t)(int64_t)OMEGA_GPU_PF_TOO_LARGE),so_eq(opened,1),so_eq(keyed,1)),"legacy settings unchanged after scoped call"); 42 check(so_eq(omega_gpu_pf_qgemm_bm(),32),"legacy tile height unchanged"); 43 } 44 const uint32_t rows[] = {1,30,64,65,128,4096,UINT32_MAX}; 45 for(unsigned i=0;i