interplane.Get Omega
Read in your language

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

branch main Branches Tags History

CUDApp / tests / om_fixture_rest_test.c

37 lines · 1947 bytes Raw Blame History
1/* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */
2#include "omega_fixture_rest.h"
3#include <stdio.h>
4#include <inttypes.h>
5static const uint64_t edges[] = {
6 0,1,2,3,4,5,6,7,8,9,10,11,15,16,17,31,32,33,127,128,129,254,255,256,
7 1999,2000,2001,999999,1000000,1000001,999999999,1000000000,1000000001,
8 18446744072ull,18446744073ull,18446744074ull,709551614,709551615,709551616,
9 18446744073709550ull,18446744073709551ull,18446744073709552ull,
10 UINT32_MAX-1,UINT32_MAX,UINT32_MAX+1ull,INT64_MAX,1ull<<63,UINT64_MAX-1,UINT64_MAX
11};
12int main(void) {
13 for (uint32_t op = FR_NS; op <= FR_RESULT; ++op)
14 for (size_t i=0;i<sizeof edges/sizeof edges[0];++i)
15 for (size_t j=0;j<sizeof edges/sizeof edges[0];++j)
16 printf("c %u %zu %zu %" PRIu64 "\n",op,i,j,omega_fixture_calc(op,edges[i],edges[j],edges[j]));
17 for (size_t i=0;i<sizeof edges/sizeof edges[0];++i)
18 for (uint64_t j=0;j<12;++j)
19 printf("f %zu %" PRIu64 " %u\n",i,j,omega_fixture_flush(j,edges[i]));
20 for (size_t i=0;i<sizeof edges/sizeof edges[0];++i)
21 for(uint32_t k=0;k<2;++k) printf("s %zu %u %a\n",i,k,omega_fixture_scale(edges[i],k));
22 static const unsigned char pats[][32] = {"libcuda.so","libcudart.so","NV_ERR_NO_MEMORY","attempts","2 MiB blocks"};
23 static const uint64_t lens[] = {10,12,16,8,12};
24 for (size_t p=0;p<5;++p) {
25 for(size_t pos=0;pos<512;++pos) {
26 unsigned char buf[512]; memset(buf,'x',sizeof buf);
27 size_t n=(size_t)lens[p];
28 if(n<=512-pos) memcpy(buf+pos,pats[p],n);
29 printf("t %zu %zu %d\n",p,pos,omega_fixture_text(buf,pats[p],lens[p]));
30 buf[0]=0;
31 printf("z %zu %zu %d\n",p,pos,omega_fixture_text(buf,pats[p],lens[p]));
32 }
33 }
34 unsigned char empty[512]={0}, pat[32]={0};
35 printf("bad %d %d\n",omega_fixture_text(empty,pat,0),omega_fixture_text(empty,pat,33));
36 return 0;
37}