interplane.Get Omega
Read in your language

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

branch main Branches Tags History

CUDApp / om / q38-head / pipeline.patch

46 lines · 2478 bytes Raw Blame History
1--- tests/gpu_exact_head_test.c
2+++ pipeline.c
3@@ -0,0 +1 @@
4+/* External qualification derivative of tests/gpu_exact_head_test.c. Not runtime code. */
5@@ -141 +142 @@
6-#define XH_K 2048u
7+#define XH_K 5120u
8@@ -154,0 +156,10 @@
9+ if (kind == OMEGA_DEC_XBOUND && mode == 0 && mutant == 0) {
10+ const char *path=getenv("Q38_BOUNDS_BIN"); if(!path)return -1;
11+ FILE *f=fopen(path,"rb");if(!f)return -1;
12+ unsigned char bytes[16384];size_t need=fread(bytes,1,sizeof bytes,f);
13+ if(ferror(f)||!feof(f)||!need){fclose(f);return -1;}fclose(f);
14+ if(omega_gpu_session_alloc_code(need,&k->code))return -1;
15+ memcpy(k->code.cpu,bytes,need);k->gpr=64;
16+ return omega_gpu_session_sync_to_gpu(&k->code);
17+ }
18+
19@@ -239,4 +250,8 @@
20- uint32_t xb[OMEGA_DEC_XB_WORDS]; memset(xb, 0, sizeof xb);
21- put64v(xb, OMEGA_DEC_XB_S, V + o_s); put64v(xb, OMEGA_DEC_XB_C, V + o_c); put64v(xb, OMEGA_DEC_XB_H, V + o_h);
22- put64v(xb, OMEGA_DEC_XB_LO, V + o_lo); put64v(xb, OMEGA_DEC_XB_HI, V + o_hi); xb[(OMEGA_DEC_XB_N - 0x380u) / 4] = n;
23- e |= xadd(clT, &kb, (n + OMEGA_DEC_THREADS - 1) / OMEGA_DEC_THREADS, n, xb, OMEGA_DEC_XB_WORDS);
24+ uint32_t xb[10]={0};
25+ put64v(xb,896,V+o_s);put64v(xb,904,V+o_c);
26+ put64v(xb,912,V+o_lo);put64v(xb,920,V+o_hi);
27+ long double hn2=0;
28+ for(uint32_t j=0;j<k;j++)hn2=nextafterl(hn2+(long double)h[j]*h[j],INFINITY);
29+ float hn=nextafterf((float)nextafterl(sqrtl(hn2),INFINITY),INFINITY);
30+ memcpy(&xb[8],&hn,4);xb[9]=n;
31+ e |= xadd(clT,&kb,(n+255)/256,n,xb,10);
32@@ -252,0 +268,12 @@
33+ const char *captured=getenv("Q38_CAPTURE_DIR");
34+ uint32_t position;memcpy(&position,rec+4,4);char fn[64];
35+ snprintf(fn,sizeof fn,"%u-logits.f32",position);
36+ float *saved=read_all(captured,fn,n*4);if(!saved){sub_fail++;break;}
37+ size_t saved_bad=0,bound_bad=0;
38+ for(uint32_t i=0;i<n;i++) {
39+ saved_bad+=memcmp(saved+i,yf+i,4)!=0;
40+ bound_bad+=!(((float*)(B+o_lo))[i]<=yf[i]&&((float*)(B+o_hi))[i]>=yf[i]);
41+ }
42+ free(saved);
43+ CHECK(!saved_bad&&!bound_bad,"saved full logits mismatch %zu; GPU compact interval violations %zu",saved_bad,bound_bad);
44+ printf("record %zu position %u saved_bits_bad %zu bounds_bad %zu\n",r,position,saved_bad,bound_bad);
45@@ -259,0 +287 @@
46+ printf("record %zu candidates %zu full %u selected %u\n",r,c,tokf,tok);