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 / tests / test_graph_table_perm.c
| 1 | /* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */ |
| 2 | #include "cudapp_native.h" |
| 3 | #include <stdint.h> |
| 4 | #include <stdio.h> |
| 5 | static uint32_t perm(uint32_t i) { uint32_t p=32; if(i<128)return i<p?i:64+i-p; return i-128<p?p+i-128:i; } |
| 6 | int main(void) { |
| 7 | uint32_t tab[14336]; |
| 8 | const uint32_t heads[]={16,24}; |
| 9 | for(unsigned h=0;h<2;h++) { |
| 10 | uint32_t q=heads[h],qn=q*256,kn=1024,n=(q+4)*512; uint64_t r=0; |
| 11 | if(omega_grtable(&r,1,q,4,tab,n)||r!=1)return 1; |
| 12 | for(uint32_t i=0;i<n;i++) { |
| 13 | uint32_t s; |
| 14 | if(i<qn)s=i/256*512+perm(i%256); |
| 15 | else if(i<qn+kn)s=q*512+(i-qn)/256*256+perm(i%256); |
| 16 | else if(i<qn+2*kn)s=q*512+i-qn; |
| 17 | else s=(i-qn-2*kn)/256*512+256+(i-qn-2*kn)%256; |
| 18 | if(tab[i]!=s)return 2; |
| 19 | } |
| 20 | } |
| 21 | puts("PASS graph table rotary tail and complete q/k/v/gate mapping");return 0; |
| 22 | } |