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
CUDApp / evidence / attention-views / 2026-11-06 / omega_attn_views.h.gcov
| 1 | -: 0:Source:src/omega_attn_views.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_ATTN_VIEWS_H |
| 7 | -: 3:#define OMEGA_ATTN_VIEWS_H |
| 8 | -: 4:#include "cudapp_native.h" |
| 9 | -: 5:#include <stdint.h> |
| 10 | -: 6:#include <stddef.h> |
| 11 | -: 7:#include <string.h> |
| 12 | -: 8:#ifndef CUDAPP_MIGRATION_PENDING_ATTN_VIEWS |
| 13 | -: 9:#define CUDAPP_MIGRATION_PENDING_ATTN_VIEWS 0 |
| 14 | -: 10:#endif |
| 15 | -: 11:/* Only native pointers/counts cross this boundary. All data walks are Omega. |
| 16 | -: 12: * The C oracle is default-OFF and exists solely for differential/coverage gates. */ |
| 17 | function av_args called 32 returned 100% blocks executed 100% |
| 18 | 32: 13:static inline int av_args(uint32_t a[32],const uint64_t p[32],uint64_t na,uint64_t nw) { |
| 19 | -: 14:#if CUDAPP_MIGRATION_PENDING_ATTN_VIEWS |
| 20 | 32: 15: if(na>16 || nw>32 || 2*na>nw)return 1; |
| 21 | branch 0 taken 24 (fallthrough) |
| 22 | branch 1 taken 8 |
| 23 | branch 2 taken 16 (fallthrough) |
| 24 | branch 3 taken 8 |
| 25 | branch 4 taken 8 (fallthrough) |
| 26 | branch 5 taken 8 |
| 27 | 8: 16: memset(a,0,32*sizeof *a); |
| 28 | 80: 17: for(uint64_t i=0;i<na;i++){a[2*i]=(uint32_t)p[i];a[2*i+1]=(uint32_t)(p[i]>>32);} |
| 29 | branch 0 taken 72 |
| 30 | branch 1 taken 8 (fallthrough) |
| 31 | 64: 18: for(uint64_t i=0;i<nw-2*na;i++)a[2*na+i]=(uint32_t)p[na+i];return 0; |
| 32 | branch 0 taken 56 |
| 33 | branch 1 taken 8 (fallthrough) |
| 34 | -: 19:#else |
| 35 | -: 20: uint64_t r=1;return omega_av_pack(&r,p,32,a,32,na,nw)!=OMEGA_OK || r!=0; |
| 36 | -: 21:#endif |
| 37 | -: 22:} |
| 38 | function av_layout called 16 returned 100% blocks executed 100% |
| 39 | 16: 23:static inline int av_layout(uint32_t a[32],const uint64_t p[32],uint64_t mask) { |
| 40 | -: 24:#if CUDAPP_MIGRATION_PENDING_ATTN_VIEWS |
| 41 | 456: 25: for(uint64_t i=0;i<32;i++){a[i]=(uint32_t)p[i];if((mask>>i)&1){if(i==31)return 1;a[i+1]=(uint32_t)(p[i]>>32);i++;}}return 0; |
| 42 | branch 0 taken 72 (fallthrough) |
| 43 | branch 1 taken 376 |
| 44 | branch 2 taken 8 (fallthrough) |
| 45 | branch 3 taken 64 |
| 46 | branch 4 taken 448 |
| 47 | branch 5 taken 8 (fallthrough) |
| 48 | -: 26:#else |
| 49 | -: 27: uint64_t r=1;return omega_av_lay(&r,p,32,a,32,mask)!=OMEGA_OK || r!=0; |
| 50 | -: 28:#endif |
| 51 | -: 29:} |
| 52 | function av_memcpy called 24 returned 100% blocks executed 100% |
| 53 | 24: 30:static inline void *av_memcpy(void *d,const void *s,size_t n) { |
| 54 | -: 31:#if CUDAPP_MIGRATION_PENDING_ATTN_VIEWS |
| 55 | 24: 32: return memcpy(d,s,n); |
| 56 | -: 33:#else |
| 57 | -: 34: if(d==s)return d; |
| 58 | -: 35: uint64_t r=0; |
| 59 | -: 36: if(omega_av_copy(&r,s,n,d,n,n)!=OMEGA_OK || r)__builtin_trap(); |
| 60 | -: 37: return d; |
| 61 | -: 38:#endif |
| 62 | -: 39:} |
| 63 | function av_memset called 32 returned 100% blocks executed 100% |
| 64 | 32: 40:static inline void *av_memset(void *d,int v,size_t n) { |
| 65 | -: 41:#if CUDAPP_MIGRATION_PENDING_ATTN_VIEWS |
| 66 | 32: 42: return memset(d,v,n); |
| 67 | -: 43:#else |
| 68 | -: 44: uint64_t r=0;if(omega_av_set(&r,d,n,n,(uint8_t)v)!=OMEGA_OK || r)__builtin_trap();return d; |
| 69 | -: 45:#endif |
| 70 | -: 46:} |
| 71 | function av_fill32 called 16 returned 100% blocks executed 100% |
| 72 | 16: 47:static inline void av_fill32(uint32_t *d,size_t n,uint32_t v) { |
| 73 | -: 48:#if CUDAPP_MIGRATION_PENDING_ATTN_VIEWS |
| 74 | 16000064: 49: for(size_t i=0;i<n;i++)d[i]=v; |
| 75 | branch 0 taken 16000048 |
| 76 | branch 1 taken 16 (fallthrough) |
| 77 | -: 50:#else |
| 78 | -: 51: uint64_t r=0;if(omega_av_fill(&r,d,n,n,v)!=OMEGA_OK || r)__builtin_trap(); |
| 79 | -: 52:#endif |
| 80 | 16: 53:} |
| 81 | function av_fillf32 called 8 returned 100% blocks executed 100% |
| 82 | 8: 54:static inline void av_fillf32(float *d,size_t n,float v) { |
| 83 | -: 55:#if CUDAPP_MIGRATION_PENDING_ATTN_VIEWS |
| 84 | 8000032: 56: for(size_t i=0;i<n;i++)d[i]=v; |
| 85 | branch 0 taken 8000024 |
| 86 | branch 1 taken 8 (fallthrough) |
| 87 | -: 57:#else |
| 88 | -: 58: uint64_t r=0;if(omega_av_fillf(&r,d,n,n,v)!=OMEGA_OK || r)__builtin_trap(); |
| 89 | -: 59:#endif |
| 90 | 8: 60:} |
| 91 | function av_count32 called 16 returned 100% blocks executed 100% |
| 92 | 16: 61:static inline size_t av_count32(const uint32_t *s,size_t n,uint32_t v) { |
| 93 | 16: 62: uint64_t r=0; |
| 94 | -: 63:#if CUDAPP_MIGRATION_PENDING_ATTN_VIEWS |
| 95 | 16000064: 64: for(size_t i=0;i<n;i++)r+=s[i]==v; |
| 96 | branch 0 taken 16000048 |
| 97 | branch 1 taken 16 (fallthrough) |
| 98 | -: 65:#else |
| 99 | -: 66: if(omega_av_count(&r,s,n,n,v)!=OMEGA_OK)__builtin_trap(); |
| 100 | -: 67:#endif |
| 101 | 16: 68: return (size_t)r; |
| 102 | -: 69:} |
| 103 | function av_countf32 called 16 returned 100% blocks executed 100% |
| 104 | 16: 70:static inline size_t av_countf32(const float *s,size_t n,float v) { |
| 105 | 16: 71: uint64_t r=0; |
| 106 | -: 72:#if CUDAPP_MIGRATION_PENDING_ATTN_VIEWS |
| 107 | 16000064: 73: for(size_t i=0;i<n;i++)r+=s[i]==v; |
| 108 | branch 0 taken 16000048 |
| 109 | branch 1 taken 16 (fallthrough) |
| 110 | -: 74:#else |
| 111 | -: 75: if(omega_av_cntf(&r,s,n,n,v)!=OMEGA_OK)__builtin_trap(); |
| 112 | -: 76:#endif |
| 113 | 16: 77: return (size_t)r; |
| 114 | -: 78:} |
| 115 | function av_bfexpand called 8 returned 100% blocks executed 100% |
| 116 | 8: 79:static inline void av_bfexpand(float *d,const uint16_t *s,size_t n) { |
| 117 | -: 80:#if CUDAPP_MIGRATION_PENDING_ATTN_VIEWS |
| 118 | 8000032: 81: for(size_t i=0;i<n;i++){uint32_t b=(uint32_t)s[i]<<16;memcpy(d+i,&b,4);} |
| 119 | branch 0 taken 8000024 |
| 120 | branch 1 taken 8 (fallthrough) |
| 121 | -: 82:#else |
| 122 | -: 83: uint64_t r=0;if(omega_av_bfexp(&r,s,n,d,n,n)!=OMEGA_OK || r)__builtin_trap(); |
| 123 | -: 84:#endif |
| 124 | 8: 85:} |
| 125 | function av_bffinite called 16 returned 100% blocks executed 100% |
| 126 | 16: 86:static inline size_t av_bffinite(const uint16_t *s,size_t n) { |
| 127 | -: 87:#if CUDAPP_MIGRATION_PENDING_ATTN_VIEWS |
| 128 | 16000056: 88: for(size_t i=0;i<n;i++)if((s[i]&0x7f80u)==0x7f80u)return i+1;return 0; |
| 129 | branch 0 taken 8 (fallthrough) |
| 130 | branch 1 taken 16000040 |
| 131 | branch 2 taken 16000048 |
| 132 | branch 3 taken 8 (fallthrough) |
| 133 | -: 89:#else |
| 134 | -: 90: uint64_t r=0;if(omega_av_bffin(&r,s,n,n)!=OMEGA_OK)__builtin_trap();return (size_t)r; |
| 135 | -: 91:#endif |
| 136 | -: 92:} |
| 137 | function av_any32 called 8 returned 100% blocks executed 100% |
| 138 | 8: 93:static inline uint32_t av_any32(const uint32_t *s,size_t n) { |
| 139 | 8: 94: uint64_t r=0; |
| 140 | -: 95:#if CUDAPP_MIGRATION_PENDING_ATTN_VIEWS |
| 141 | 8000032: 96: for(size_t i=0;i<n;i++)r|=s[i]; |
| 142 | branch 0 taken 8000024 |
| 143 | branch 1 taken 8 (fallthrough) |
| 144 | -: 97:#else |
| 145 | -: 98: if(omega_av_any(&r,s,n,n)!=OMEGA_OK)__builtin_trap(); |
| 146 | -: 99:#endif |
| 147 | 8: 100: return (uint32_t)r; |
| 148 | -: 101:} |
| 149 | function av_compact32 called 8 returned 100% blocks executed 100% |
| 150 | 8: 102:static inline size_t av_compact32(uint32_t *d,const int32_t *s,size_t n) { |
| 151 | 8: 103: uint64_t r=0; |
| 152 | -: 104:#if CUDAPP_MIGRATION_PENDING_ATTN_VIEWS |
| 153 | 8000032: 105: for(size_t i=0;i<n;i++)if(s[i]>=0)d[r++]=(uint32_t)s[i]; |
| 154 | branch 0 taken 5333344 (fallthrough) |
| 155 | branch 1 taken 2666680 |
| 156 | branch 2 taken 8000024 |
| 157 | branch 3 taken 8 (fallthrough) |
| 158 | -: 106:#else |
| 159 | -: 107: if(omega_av_comp(&r,s,n,d,n,n)!=OMEGA_OK)__builtin_trap(); |
| 160 | -: 108:#endif |
| 161 | 8: 109: return (size_t)r; |
| 162 | -: 110:} |
| 163 | function av_routerpoison called 16 returned 100% blocks executed 100% |
| 164 | 16: 111:static inline size_t av_routerpoison(const float *w,const uint32_t *ids,size_t n,float pv,uint32_t pi) { |
| 165 | 16: 112: uint64_t r=0; |
| 166 | -: 113:#if CUDAPP_MIGRATION_PENDING_ATTN_VIEWS |
| 167 | 16000064: 114: for(size_t i=0;i<n;i++)r+=w[i]==pv || ids[i]==pi; |
| 168 | branch 0 taken 16 (fallthrough) |
| 169 | branch 1 taken 16000032 |
| 170 | branch 2 taken 8 (fallthrough) |
| 171 | branch 3 taken 8 |
| 172 | branch 4 taken 16000048 |
| 173 | branch 5 taken 16 (fallthrough) |
| 174 | -: 115:#else |
| 175 | -: 116: uint32_t bits;memcpy(&bits,&pv,4);uint64_t poison=bits|((uint64_t)pi<<32); |
| 176 | -: 117: if(omega_av_rpois(&r,w,n,ids,n,n,poison)!=OMEGA_OK)__builtin_trap(); |
| 177 | -: 118:#endif |
| 178 | 16: 119: return (size_t)r; |
| 179 | -: 120:} |
| 180 | function av_zero64 called 8 returned 100% blocks executed 100% |
| 181 | 8: 121:static inline size_t av_zero64(const uint64_t *s,size_t n) { |
| 182 | 8: 122: uint64_t r=0; |
| 183 | -: 123:#if CUDAPP_MIGRATION_PENDING_ATTN_VIEWS |
| 184 | 48: 124: for(size_t i=0;i<n;i++)r+=s[i]==0; |
| 185 | branch 0 taken 40 |
| 186 | branch 1 taken 8 (fallthrough) |
| 187 | -: 125:#else |
| 188 | -: 126: if(omega_av_z64(&r,s,n,n)!=OMEGA_OK)__builtin_trap(); |
| 189 | -: 127:#endif |
| 190 | 8: 128: return (size_t)r; |
| 191 | -: 129:} |
| 192 | function av_badids called 8 returned 100% blocks executed 100% |
| 193 | 8: 130:static inline size_t av_badids(const uint32_t *s,size_t n,uint32_t limit) { |
| 194 | 8: 131: uint64_t r=0; |
| 195 | -: 132:#if CUDAPP_MIGRATION_PENDING_ATTN_VIEWS |
| 196 | 8000032: 133: for(size_t i=0;i<n;i++)r+=s[i]>=limit; |
| 197 | branch 0 taken 8000024 |
| 198 | branch 1 taken 8 (fallthrough) |
| 199 | -: 134:#else |
| 200 | -: 135: if(omega_av_bids(&r,s,n,n,limit)!=OMEGA_OK)__builtin_trap(); |
| 201 | -: 136:#endif |
| 202 | 8: 137: return (size_t)r; |
| 203 | -: 138:} |
| 204 | function av_rowtab called 16 returned 100% blocks executed 100% |
| 205 | 16: 139:static inline void av_rowtab(uint32_t *d,size_t n,uint64_t base) { |
| 206 | -: 140:#if CUDAPP_MIGRATION_PENDING_ATTN_VIEWS |
| 207 | 64: 141: for(size_t i=0;i<n;i++){d[i]=0;d[n+i]=(uint32_t)(base+i+1);} |
| 208 | branch 0 taken 48 |
| 209 | branch 1 taken 16 (fallthrough) |
| 210 | -: 142:#else |
| 211 | -: 143: uint64_t r=0;if(omega_av_rows(&r,d,2*n,n,base)!=OMEGA_OK || r)__builtin_trap(); |
| 212 | -: 144:#endif |
| 213 | 16: 145:} |
| 214 | function av_context called 8 returned 100% blocks executed 100% |
| 215 | 8: 146:static inline void av_context(uint32_t *d,const int32_t *s,size_t n) { |
| 216 | -: 147:#if CUDAPP_MIGRATION_PENDING_ATTN_VIEWS |
| 217 | 72: 148: for(size_t i=0;i<n;i++)d[i]=s[i]>0?(uint32_t)s[i]:0; |
| 218 | branch 0 taken 64 |
| 219 | branch 1 taken 8 (fallthrough) |
| 220 | -: 149:#else |
| 221 | -: 150: uint64_t r=0;if(omega_av_ctx(&r,s,n,d,n,n)!=OMEGA_OK || r)__builtin_trap(); |
| 222 | -: 151:#endif |
| 223 | 8: 152:} |
| 224 | -: 153:#endif |