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 / om_fixture_verify_test.c
| 1 | /* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */ |
| 2 | #include "omega_fixture_verify.h" |
| 3 | #include <inttypes.h> |
| 4 | #include <stdio.h> |
| 5 | int main(void) { |
| 6 | static const uint64_t edge[] = {0,1,2,3,7,8,15,16,17,31,32,33,255,256,262143,262144,262145,67108863,67108864,67108865,2147483647,2147483648,4294967294,4294967295,4294967296,9223372036854775807ull,9223372036854775808ull,UINT64_MAX}; |
| 7 | static const unsigned shift[] = {0,1,15,16,17,23,24,25,31,32,63}; |
| 8 | for (unsigned i=0;i<sizeof edge/sizeof edge[0];++i) { |
| 9 | uint32_t w[4]={(uint32_t)edge[i],(uint32_t)edge[i],(uint32_t)edge[i],(uint32_t)edge[i]}; |
| 10 | for (unsigned mask=0;mask<16;++mask) for (unsigned word=0;word<4;++word) for(unsigned mode=0;mode<3;++mode) { |
| 11 | uint32_t x[4]; memcpy(x,w,sizeof x); x[word] += mode; |
| 12 | printf("words %u %u %u %u %d %d\n",i,mask,word,mode,omega_fv_words(w,x[0],x[1],x[2],x[3],mask),omega_fv_optional(w,x[0],x[1],x[2],x[3])); |
| 13 | printf("pair %d %d %d\n",omega_fv_pair(w,x,0),omega_fv_pair(w,x,1),omega_fv_bfly(w,x)); |
| 14 | } |
| 15 | uint32_t pair[4]; memcpy(pair,w,sizeof pair); pair[2]^=0x40000; |
| 16 | printf("bf16 %d\n",omega_fv_pair(w,pair,0)); |
| 17 | memcpy(pair,w,sizeof pair); pair[1] |= 0x04000000; |
| 18 | printf("bfly %d\n",omega_fv_bfly(pair,w)); |
| 19 | for(unsigned j=0;j<sizeof edge/sizeof edge[0];++j) { |
| 20 | printf("error %u %u %d\n",i,j,omega_fv_error(edge[i],edge[j])); |
| 21 | printf("choose %u %u %u\n",i,j,omega_fv_choose((uint32_t)edge[i],(uint32_t)edge[j],17,33)); |
| 22 | for(unsigned k=0;k<sizeof shift/sizeof shift[0];++k) |
| 23 | printf("bits %u %u %u %" PRIu64 "\n",i,j,k,omega_fv_ask(5,edge[i],edge[j],shift[k],edge[i],shift[k])); |
| 24 | } |
| 25 | printf("status %d %d\n",omega_fv_status((int)(uint32_t)edge[i],0),omega_fv_status((int)(uint32_t)edge[i],1)); |
| 26 | printf("bits-wrapper %u\n",omega_fv_bits((uint32_t)edge[i],(uint32_t)edge[i],16,(uint32_t)edge[i],24)); |
| 27 | } |
| 28 | puts("PASS codegen fixture source partitions"); |
| 29 | return 0; |
| 30 | } |