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/standalone-oracles/host-norm.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 / standalone-oracles / host-norm.c` 37 lines · 2231 bytes Raw Blame History 1 /* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */ 2 /* Verification only: execute the unchanged emitted norm IR in WsSim. No GPU, 3 * driver, ioctl, device file or physical address participates in this adapter. */ 4 #include "omega_gpu_session.h" 5 #include "omega_blackwell_codegen_dec.h" 6 #include "bw_warp_sim_k.h" 7 #include 8 #include 9 static const BlackwellIRProgram *norm_program; 10 static OmegaGpuMem data; 11 int __real_omega_blackwell_codegen_dec_prog(const OmegaDecSpec *,BlackwellIRProgram *); 12 int __wrap_omega_blackwell_codegen_dec_prog(const OmegaDecSpec *s,BlackwellIRProgram *p) { 13 int rc=__real_omega_blackwell_codegen_dec_prog(s,p);norm_program=p;return rc; 14 } 15 void __wrap_omega_gpu_session_lock(void) {} 16 void __wrap_omega_gpu_session_unlock(void) {} 17 OmegaGpuSession *__wrap_omega_gpu_session_open(void) {return (OmegaGpuSession *)(uintptr_t)1;} 18 static int allocate(size_t n,OmegaGpuMem *m) {memset(m,0,sizeof *m);m->cpu=calloc(1,n);m->size=n;m->va=(uintptr_t)m->cpu;return m->cpu?0:-1;} 19 int __wrap_omega_gpu_session_alloc_code(size_t n,OmegaGpuMem *m) {return allocate(n,m);} 20 int __wrap_omega_gpu_session_alloc(size_t n,OmegaGpuMem *m) {int rc=allocate(n,m);data=*m;return rc;} 21 int __wrap_omega_gpu_session_sync_to_gpu(const OmegaGpuMem *m) {(void)m;return 0;} 22 int __wrap_omega_gpu_session_sync_to_cpu(const OmegaGpuMem *m) {(void)m;return 0;} 23 void __wrap_omega_gpu_session_free(OmegaGpuMem *m) {free(m->cpu);memset(m,0,sizeof *m);} 24 int __wrap_omega_gpu_session_launch(const OmegaGpuLaunch *l,uint64_t *ns,uint32_t *marker) { 25 (void)ns;(void)marker;static WsSim sim;static unsigned char shared[65536]; 26 memset(&sim,0,sizeof sim);sim.p=norm_program;sim.threads=l->threads_x;sim.smem=shared;sim.smem_bytes=sizeof shared; 27 sim.nranges=1;sim.ranges[0].lo=data.va;sim.ranges[0].hi=data.va+data.size; 28 memcpy(sim.cbank+0x380/4,l->args,l->n_args*sizeof(uint32_t)); 29 int rc=ws_run(&sim,l->grid_x,l->grid_y); 30 if(rc) {fprintf(stderr,"host norm simulation: %s\n",sim.msg);return rc;} 31 if(getenv("SO_HOST_RED")) { 32 unsigned i=(OMEGA_DEC_RES_Y-0x380)/4; 33 uintptr_t p=(uintptr_t)l->args[i]|((uint64_t)l->args[i+1]<<32); 34 *(float *)p=INFINITY; 35 } 36 return 0; 37 }