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/q38-head/norm-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 / q38-head / norm-check.c` 78 lines · 4449 bytes Raw Blame History 1 /* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */ 2 /* External verification instrument for the existing 5120-wide final RMSNorm. */ 3 #include "omega_blackwell_codegen_dec.h" 4 #include "omega_gpu_session.h" 5 #include 6 #include 7 #include 8 #include 9 #include 10 #include 11 #include "../standalone-oracles/oracle.h" 12 13 #define H 5120u 14 static void demand(int rc) { 15 if (rc) { fprintf(stderr, "GPU: %s\n", omega_gpu_session_last_error()); exit(4); } 16 } 17 static void pointer(uint32_t *a, unsigned off, uint64_t p) { 18 a[(off-0x380)/4]=(uint32_t)p; a[(off-0x380)/4+1]=(uint32_t)(p>>32); 19 } 20 static void scalar(uint32_t *a, unsigned off, float x) { memcpy(a+(off-0x380)/4,&x,4); } 21 static uint32_t rng=710; 22 static float random_value(void) { 23 rng=(uint32_t)so_call(22,rng,0,0,0); 24 return so_float(so_call(23,rng,0,0,0)); 25 } 26 int main(int argc,char **argv) { 27 if(argc!=4 || strcmp(argv[1],"--chip")) return 65; 28 char *end=NULL; float envelope=strtof(argv[3],&end); 29 if(!end || *end || !so_all(so_call(24,so_bits(envelope),0,0,0),so_call(37,so_bits(envelope),so_bits(0.0f),0,0),1)) return 65; 30 float weights[H]; FILE *f=fopen(argv[2],"rb"); assert(f); 31 assert(fread(weights,4,H,f)==H && fgetc(f)==EOF); fclose(f); 32 float wm=0; for(unsigned j=0;jlargest)largest=norm; 70 int oracle_ok=norm<=envelope; 71 failed=so_bad(failed,oracle_ok); 72 if(!oracle_ok) printf("FAIL weight=%u exponent=%d pattern=%u norm=%.12Lg bound=%.12g\n",wi,exponents[e],pattern,norm,envelope); 73 checks=(unsigned)so_call(5,checks,1,0,0); 74 } 75 omega_gpu_session_free(&data);omega_gpu_session_free(&code);omega_gpu_session_unlock(); 76 printf("RMSNorm envelope: %u cases, %u failures, largest norm %.12Lg, bound %.12g: %s\n",checks,failed,largest,envelope,failed?"FAIL":"PASS"); 77 return failed?1:0; 78 }