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/evidence/attention-views/2026-11-06/omega_api_plan.h.gcov # 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 / evidence / attention-views / 2026-11-06 / omega_api_plan.h.gcov` 181 lines · 13479 bytes Raw Blame History 1 -: 0:Source:src/omega_api_plan.h 2 -: 0:Graph:~/work/cudastack/lanes/ApiViewsAttn/build/attn-views-qualified-final/cases-oracle.gcno 3 -: 0:Data:~/work/cudastack/lanes/ApiViewsAttn/build/attn-views-qualified-final/cases-oracle.gcda 4 -: 0:Runs:9 5 -: 1:/* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */ 6 -: 2:#ifndef OMEGA_API_PLAN_H 7 -: 3:#define OMEGA_API_PLAN_H 8 -: 4:#include 9 -: 5:#include 10 -: 6:#include "cudapp_native.h" 11 -: 7:#ifndef CUDAPP_MIGRATION_PENDING_C_API_PLAN 12 -: 8:#define CUDAPP_MIGRATION_PENDING_C_API_PLAN 0 13 -: 9:#endif 14 -: 10:/* Private, fixed-size function-mode ABI. Inputs 0..7; outputs 8..15. 15 -: 11: * All calls are serialized by their existing session shell, not by policy. 16 -: 12: * Refusal numbers match the API's negative return codes. Pointer admission is 17 -: 13: * deliberately performed before unpacking a pointed-to object in the shell. */ 18 -: 14:enum { AP_MM, AP_AT, AP_EW, AP_BF, AP_DA, AP_RT }; 19 -: 15:#if CUDAPP_MIGRATION_PENDING_C_API_PLAN || defined(OMEGA_API_PLAN_ORACLE) 20 -: 16:static inline uint64_t ap_log(uint64_t v) { 21 -: 17: if (!v || (v & (v - 1))) return 32; 22 -: 18: uint64_t l = 0; while ((v >> l) != 1) l++; return l; 23 -: 19:} 24 -: 20:static inline uint64_t ap_c(unsigned family, uint64_t mode, uint64_t a[16]) { 25 -: 21: switch (family) { 26 -: 22: case AP_MM: 27 -: 23: if (!mode) { 28 -: 24: uint64_t m=a[0],k=a[1],n=a[2]; 29 -: 25: if (!m||!k||!n) return 1; 30 -: 26: if (m>8192||k>16384||n>262144||a[3]>262144||a[4]>128) return 2; 31 -: 27: uint64_t mp=(m+15)/16*16,kp=(k+15)/16*16,np=(n+7)/8*8; 32 -: 28: uint64_t cb=mp*np*4,one=(a[3]+7)/8*8*64; 33 -: 29: if(one>cb)cb=one; 34 -: 30: a[8]=mp;a[9]=kp;a[10]=np;a[11]=mp*kp*2;a[12]=cb;a[13]=kp*np*2;a[14]=k*n; 35 -: 31: return 0; 36 -: 32: } 37 -: 33: if(mode==3){a[8]=(uint32_t)(a[0]+a[1]-1)/a[1]*a[1];return 0;} 38 -: 34: if(mode==1){ 39 -: 35: uint64_t mp=a[0],np=a[1],b=a[2]?a[2]:1024,mt=mp/16,nt=np/8; 40 -: 36: uint64_t r=mt%4==0?4:mt%2==0?2:1,c=1; 41 -: 37: for(;r>1;r/=2){c=nt%4==0?4:nt%2==0?2:1;if((r-1)*64*np+(c-1)*32+4<`8388608`)break;} 42 -: 38: if(r==1)c=1; 43 -: 39: uint64_t rb=mt/r,nb=nt/c,rows=rb<=b?mp:b*16*r,gx=b/(rows/16/r); 44 -: 40: if(!gx)gx=1; 45 -: 41: if(gx>nb)gx=nb; 46 -: 42: a[8]=rows;a[9]=gx;a[10]=r;a[11]=c;a[12]=rows/16/r;return 0; 47 -: 43: } 48 -: 44: if(mode==2){uint64_t c=64;if(a[3]&&262144/(a[0]*8)1||a[2]>1,u=b?(!(ks%2)&&2*(a[1]+a[2])<=8?2:1):a[3]?a[3]:!(ks%4)?4:!(ks%2)?2:1; 51 -: 47: if(a[4]&&(b||!a[3]))while(u>1&&ks/u<2)u/=2; 52 -: 48: a[8]=b;a[9]=u;return 0;} 53 -: 49: if(mode==6){uint64_t c=a[0]*8,w=a[1]*8;if(w>a[2])w=a[2];a[8]=c;a[9]=w-c;return 0;} 54 -: 50: if(mode==7){uint64_t r=a[0]256||q>1024)return 2;if(q%k)return 1; 59 -: 55: uint64_t l=ap_log(q/k);a[8]=a[9]=0;if(!a[3]&&(h==64||h==128)&&q<=64&&l<32){a[8]=l;a[9]=1;}return 0;} 60 -: 56: if(mode==1){uint64_t l=ap_log(a[0]);if(l==32)return 1;a[8]=l;return 0;} 61 -: 57: if(mode==2){uint64_t p=1024/a[1];if(!p)p=1;if(p>a[0])p=a[0];if(a[4]&&a[3]>=a[2]){uint64_t f=a[3]/a[2];if(f1024)l--;a[8]=l;a[9]=p;a[10]=1ull<p)p=v;} 67 -: 63: a[8]=p*a[1];a[9]=a[1]*a[5]*a[3]*4; 68 -: 64: uint64_t launch=64/a[5];if(!launch)launch=1;if(launch>a[1])launch=a[1]; 69 -: 65: uint64_t part=launch*a[5]*16*(a[3]+2)*4;a[10]=part>a[9]?part:a[9]; 70 -: 66: part=(a[1]*a[0]+a[1])*4;if(!a[6])part+=a[1]*16+a[5]*4;a[11]=part<8?8:part;return 0;} 71 -: 67: if(mode==6)return !a[0]||!a[1]||a[1]>1024||!a[2]||a[2]>256?1:0; 72 -: 68: if(mode==7){union{uint32_t u;float f;}s={.u=a[3]};return !a[0]||(int64_t)a[1]<-1||(int64_t)a[2]<-1||!(s.f>=0.0f)||s.f>3.0e38f?1:0;} 73 -: 69: if(mode==8){if(!a[1])return 1;uint64_t t=a[0]+a[1];if(t>0x7fffffffu)return 2;a[8]=t;a[9]=!a[2]||t>4096;return 0;} 74 -: 70: if(mode==9){a[8]=a[0]&&(!a[1]||a[0]>4096);return 0;} 75 -: 71: if(mode==10){uint64_t p=a[0],hi=a[1],lo=0;if(a[2])hi=p+1;else if((int64_t)a[4]>=0)hi=p+a[4]+1;if(hi>a[1])hi=a[1];if((int64_t)a[3]>=0&&p>a[3])lo=p-a[3];if(lo>hi)lo=hi;a[8]=lo;a[9]=hi;return 0;} 76 -: 72: if(mode==11){uint64_t v=a[0]*a[1]*a[2]*a[3];if(2*v>UINT32_MAX)return 2;a[8]=v;a[9]=a[4]?a[4]:a[1]*a[2];a[10]=a[5]?a[5]:a[2];return 0;} 77 -: 73: if(mode==12){uint64_t n=a[0]=a[1]||a[2]=a[1]||a[0]*a[2]+(a[3]+1)*a[4]>a[5]?1:0; 82 -: 78: if(mode==17){a[8]=a[4]?a[0]*a[1]*a[2]*(a[3]+2)*4:4;a[9]=a[0]+a[1];return 0;} 83 -: 79: if(mode==18){uint64_t v=(a[0]?a[0]:1)*a[1];if(v>UINT32_MAX)return 2;a[8]=v;return 0;} 84 -: 80: if(mode==19)return !a[0]||!a[1]?1:0; 85 -: 81: if(mode==20){a[8]=a[0]>a[1]?a[0]:a[1];return 0;} 86 -: 82: if(mode==21){uint64_t v=a[0]==128?1ull<<(a[1]<2?a[1]:2):1;a[8]=v;a[9]=(3*v+1)*a[0]*4;return 0;} 87 -: 83: if(mode==22){float u;uint32_t bits=a[1];memcpy(&u,&bits,4);double v=1.`4426950408889634`/8.0; 88 -: 84: if(!a[2]){double x=(double)a[0],r=x;if(!(u>0)){for(int i=0;i<64;i++){double n=0.5*(r+x/r);if(!(n0?(double)u:1.0/r);} 89 -: 85: float f=(float)v;memcpy(&bits,&f,4);a[8]=bits;return 0;} 90 -: 86: if(mode==23){float f=(float)(1.`4426950408889634`/(a[0]==128?11.`313708498984761`:8.0));uint32_t b;memcpy(&b,&f,4);a[8]=b;return 0;} 91 -: 87: if(mode==24){a[8]=a[0]<=UINT32_MAX&&a[1]*a[0]+a[2]<=UINT32_MAX;return 0;} 92 -: 88: if(mode==25){a[8]=(uint32_t)((a[4]?a[0]%a[2]:a[0]/(a[1]/a[2]))*a[3]);return 0;} 93 -: 89: if(mode==26){if(!a[0]){if(a[1]>16||a[2]>6)return 1;if(a[3]!=64&&a[3]!=128)return 2;}else{if(a[1]>31||!a[3])return 1;if(a[3]>256)return 2;}return 0;} 94 -: 90: if(mode==27){a[8]=a[0]<=4?a[0]:UINT32_MAX;return 0;} 95 -: 91: break; 96 -: 92: case AP_EW: 97 -: 93: if(!mode){if(!a[0]||!a[1]||a[1]%128)return 1;if(a[1]>16384)return 2;} 98 -: 94: if(mode==1){if(!a[0]||a[1]<2||(a[1]&1))return 1;if(a[1]>2048)return 2;} 99 -: 95: if(mode<=1){uint64_t nr=a[0]<1024?a[0]:1024;a[8]=nr;a[9]=nr*a[1]*4;a[10]=a[1]/(mode?2:128); 100 -: 96: if(!mode){union{float f;uint32_t u;}v={.f=1.0f/(float)a[1]};a[11]=v.u;}return 0;} 101 -: 97: if(mode==2){if(!a[0])return 1;uint64_t n=a[0]<131072?a[0]:131072;a[8]=n;a[9]=(n+127)/128;a[10]=n*4;return 0;} 102 -: 98: if(mode==3)return !a[0]||a[0]%128?1:0; 103 -: 99: if(mode==4)return !a[0]||a[2]>a[3]?1:0; 104 -: 100: if(mode==5)return a[0]>3?1:0; 105 -: 101: if(mode==6){a[8]=!a[0]||a[0]>INT64_MAX?1:a[0]>3?3:a[0];return 0;} 106 -: 102: break; 107 -: 103: case AP_BF: 108 -: 104: if(!mode){uint64_t k=a[0],ks=k/256,w=16,d=ks;if(d)while(d>16||ks%d)d--; 109 -: 105: if(k%(32*w)||k>512*w)w=32; 110 -: 106: a[8]=a[1]?a[1]:1;a[9]=a[2]?a[2]:w;a[10]=a[3]?a[3]:d;a[11]=a[4]?a[4]:96;return 0;} 111 -: 107: if(mode==1){if(!a[1]||!a[2]||a[0]%a[1])return 3;uint64_t g=(uint32_t)(a[0]/a[1]+a[2]-1)/a[2];if(g>a[3])g=a[3];if(!g)g=1;a[8]=g;a[9]=a[0]/a[1];return 0;} 112 -: 108: if(mode==2){if(a[1]&&(!a[0]||a[1]>65535))return 1;if(a[4]&&(!a[0]||a[1]||a[2]>1||!a[5]))return 1; 113 -: 109: if(a[2]>1&&(!a[0]||a[1]||a[2]>4||a[3]1&&(a[0]>4||!a[1]))return 1;a[8]=a[0]<=1;return 0;} 116 -: 112: if(mode==4)return 32*a[0]*a[1]>65536?2:0; 117 -: 113: if(mode==5){if(!a[0])return 1;a[8]=a[0]==1;return 0;} 118 -: 114: if(mode==6){uint64_t r=a[5],s=0,xb=0,gy=1,nr=1;if(a[0]){s=a[4];gy=nr=a[0];}if(a[3])r=1;if(a[1]>1){xb=nr=a[1];s=a[2];}a[8]=r;a[9]=s;a[10]=xb;a[11]=gy;a[12]=a[4]*nr;return 0;} 119 -: 115: break; 120 -: 116: case AP_DA: 121 -: 117: if(!mode){uint64_t l=a[0],p=a[1];union{uint64_t u;double f;}t={.u=a[2]};if(!l||l>64||!p||p>131072||p%256||!(t.f>0))return 1; 122 -: 118: a[8]=p/256;a[9]=4*p*256+(4*8*256+64);a[10]=p*512;a[11]=l*2*128*4;a[12]=4*(p/256)*1040*4;return 0;} 123 -: 119: if(mode==1)return a[0]>a[2]||a[1]>a[2]-a[0]?1:0; 124 -: 120: if(mode==2){uint64_t p=a[1]?a[1]:256;if(p%256)return 1;uint64_t s=(a[0]+p)/p;if(s>a[2])return 2; 125 -: 121: a[8]=p;a[9]=s;a[10]=a[3]?a[3]:4;a[11]=2*4*(a[0]+1)*256;return 0;} 126 -: 122: if(mode==3)return a[0]>=a[1]||a[2]>=4||!a[4]||a[3]>a[5]||a[4]>a[5]-a[3]?1:0; 127 -: 123: if(mode==4)return a[0]*256>65536?2:0; 128 -: 124: break; 129 -: 125: case AP_RT: 130 -: 126: if(!mode){a[7]=0;if(!a[0]||a[0]>64)return 1;a[7]=1;uint64_t e=a[1]?a[1]:128;if((e!=128&&e!=256)||a[2]>1)return 1; 131 -: 127: a[8]=e;a[9]=e+a[2];a[10]=8+a[2];a[11]=a[2]?16656:16640;a[12]=a[2]?16800:16768; 132 -: 128: a[13]=a[0]*a[9]*4096;a[14]=a[0]*8192;a[15]=a[0]*a[9]*32;return 0;} 133 -: 129: if(mode==1){a[8]=a[0]?a[0]:32;a[9]=a[1]?a[1]:4;a[10]=a[2]==128?0:a[2];return 0;} 134 -: 130: if(mode==2){if(!a[0]||a[0]>64)return 1;if(a[0]>1&&(a[1]<8192||(a[1]&15)||a[2]=a[1])return 1;a[8]=a[9]=0;a[10]=1;if(a[2]>1){if(!a[3]||!a[4])return 1;a[8]=a[5];a[9]=a[6];a[10]=a[2];}return 0;} 136 -: 132: if(mode==4)return 32*a[0]*a[1]>65536?2:0; 137 -: 133: break; 138 -: 134: } 139 -: 135: return 1; 140 -: 136:} 141 -: 137:#endif 142 function ap_om called `16000424` returned 100% blocks executed 57% 143 `16000424`: 138:static inline int ap_om(unsigned f, uint64_t mode, uint64_t a[16]) { 144 `16000424`: 139: uint64_t rc=1;uint32_t st=OMEGA_BAD_ARG; 145 `16000424`: 140: switch(f){ 146 branch 0 taken 0 147 branch 1 taken `16000424` 148 branch 2 taken 0 149 branch 3 taken 0 150 branch 4 taken 0 151 branch 5 taken 0 152 branch 6 taken 0 153 #####: 141: case AP_MM:st=omega_api_mm_plan(&rc,mode,a,16);break; 154 call 0 never executed 155 `16000424`: 142: case AP_AT:st=omega_api_at_plan(&rc,mode,a,16);break; 156 call 0 returned `16000424` 157 #####: 143: case AP_EW:st=omega_api_ew_plan(&rc,mode,a,16);break; 158 call 0 never executed 159 #####: 144: case AP_BF:st=omega_api_bf_plan(&rc,mode,a,16);break; 160 call 0 never executed 161 #####: 145: case AP_DA:st=omega_api_da_plan(&rc,mode,a,16);break; 162 call 0 never executed 163 #####: 146: case AP_RT:st=omega_api_rt_plan(&rc,mode,a,16);break; 164 call 0 never executed 165 -: 147: } 166 `16000424`*: 148: return st==OMEGA_OK&&rc<=3?-(int)rc:-1; 167 branch 0 taken `16000424` (fallthrough) 168 branch 1 taken 0 169 branch 2 taken `16000424` (fallthrough) 170 branch 3 taken 0 171 -: 149:} 172 function ap_plan called `16000424` returned 100% blocks executed 100% 173 `16000424`: 150:static inline int ap_plan(unsigned f, uint64_t mode, uint64_t a[16]) { 174 -: 151:#if CUDAPP_MIGRATION_PENDING_C_API_PLAN 175 -: 152: return -(int)ap_c(f,mode,a); 176 -: 153:#else 177 `16000424`: 154: return ap_om(f,mode,a); 178 call 0 returned `16000424` 179 -: 155:#endif 180 -: 156:} 181 -: 157:#endif