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 / session_policy_test.c

27 lines · 1251 bytes Raw Blame History
1/* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */
2/* Boundary regressions for the exact argument layouts used by the C shells. */
3#include "cudapp_native.h"
4#include <stdint.h>
5#include <stdio.h>
6#define CHECK(c) do { if (!(c)) { printf("FAIL policy line %d: %s\n", __LINE__, #c); return 1; } } while (0)
7int main(void) {
8 uint64_t a[16] = {0}, o[4] = {0}, r = 0;
9 a[0] = 0; a[1] = 0; a[2] = 1; a[3] = 1;
10 CHECK(omega_book(&r, 0, a, 16, o, 4) == 0 && r == 0);
11 a[2] = 2;
12 CHECK(omega_book(&r, 0, a, 16, o, 4) == 0 && r == 1);
13 a[0] = 1; a[1] = 0;
14 CHECK(omega_book(&r, 1, a, 16, o, 4) == 0 && r == 1);
15 a[0] = 0;
16 CHECK(omega_book(&r, 1, a, 16, o, 4) == 0 && r == 0);
17 a[1] = UINT32_MAX;
18 CHECK(omega_book(&r, 1, a, 16, o, 4) == 0 && r == 1);
19 a[0] = UINT64_C(4294967296);
20 CHECK(omega_decide(&r, 1, a, 16, o, 4) == 0 && r == a[0]);
21 a[0] = 0; a[1] = 0; a[2] = 1;
22 CHECK(omega_decide(&r, 7, a, 16, o, 4) == 0 && r == 3);
23 a[0] = 64; a[1] = 4096; a[2] = 0; a[3] = 1; a[4] = 8192;
24 CHECK(omega_decide(&r, 6, a, 16, o, 4) == 0 && r == 0 && o[0] == 8192);
25 puts("PASS session policy: stale argument order, latch generation, size_t page and scratch high-water boundaries");
26 return 0;
27}