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/src/omega_attn_views.h # 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 / src / omega_attn_views.h` 153 lines · 5342 bytes Raw Blame History 1 /* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */ 2 #ifndef OMEGA_ATTN_VIEWS_H 3 #define OMEGA_ATTN_VIEWS_H 4 #include "cudapp_native.h" 5 #include 6 #include 7 #include 8 #ifndef CUDAPP_MIGRATION_PENDING_ATTN_VIEWS 9 #define CUDAPP_MIGRATION_PENDING_ATTN_VIEWS 0 10 #endif 11 /* Only native pointers/counts cross this boundary. All data walks are Omega. 12 * The C oracle is default-OFF and exists solely for differential/coverage gates. */ 13 static inline int av_args(uint32_t a[32],const uint64_t p[32],uint64_t na,uint64_t nw) { 14 #if CUDAPP_MIGRATION_PENDING_ATTN_VIEWS 15 if(na>16 || nw>32 || 2*na>nw)return 1; 16 memset(a,0,32*sizeof *a); 17 for(uint64_t i=0;i>32);} 18 for(uint64_t i=0;i>i)&1){if(i==31)return 1;a[i+1]=(uint32_t)(p[i]>>32);i++;}}return 0; 26 #else 27 uint64_t r=1;return omega_av_lay(&r,p,32,a,32,mask)!=OMEGA_OK || r!=0; 28 #endif 29 } 30 static inline void *av_memcpy(void *d,const void *s,size_t n) { 31 #if CUDAPP_MIGRATION_PENDING_ATTN_VIEWS 32 return memcpy(d,s,n); 33 #else 34 if(d==s)return d; 35 uint64_t r=0; 36 if(omega_av_copy(&r,s,n,d,n,n)!=OMEGA_OK || r)__builtin_trap(); 37 return d; 38 #endif 39 } 40 static inline void *av_memset(void *d,int v,size_t n) { 41 #if CUDAPP_MIGRATION_PENDING_ATTN_VIEWS 42 return memset(d,v,n); 43 #else 44 uint64_t r=0;if(omega_av_set(&r,d,n,n,(uint8_t)v)!=OMEGA_OK || r)__builtin_trap();return d; 45 #endif 46 } 47 static inline void av_fill32(uint32_t *d,size_t n,uint32_t v) { 48 #if CUDAPP_MIGRATION_PENDING_ATTN_VIEWS 49 for(size_t i=0;i=0)d[r++]=(uint32_t)s[i]; 106 #else 107 if(omega_av_comp(&r,s,n,d,n,n)!=OMEGA_OK)__builtin_trap(); 108 #endif 109 return (size_t)r; 110 } 111 static inline size_t av_routerpoison(const float *w,const uint32_t *ids,size_t n,float pv,uint32_t pi) { 112 uint64_t r=0; 113 #if CUDAPP_MIGRATION_PENDING_ATTN_VIEWS 114 for(size_t i=0;i=limit; 134 #else 135 if(omega_av_bids(&r,s,n,n,limit)!=OMEGA_OK)__builtin_trap(); 136 #endif 137 return (size_t)r; 138 } 139 static inline void av_rowtab(uint32_t *d,size_t n,uint64_t base) { 140 #if CUDAPP_MIGRATION_PENDING_ATTN_VIEWS 141 for(size_t i=0;i0?(uint32_t)s[i]:0; 149 #else 150 uint64_t r=0;if(omega_av_ctx(&r,s,n,d,n,n)!=OMEGA_OK || r)__builtin_trap(); 151 #endif 152 } 153 #endif