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/tests/omega/binding_portable_test.c # 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 / tests / omega / binding_portable_test.c` 54 lines · 1842 bytes Raw Blame History 1 /* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */ 2 /* Revision and epoch vectors on the generated freestanding units. */ 3 #include "cudapp_native.h" 4 5 #include 6 #include 7 8 static int expect_u(const char *name, uint32_t st, uint64_t got, uint32_t want_st, uint64_t want) 9 { 10 if (st == want_st && got == want) 11 return 0; 12 fprintf(stderr, "FAIL %s st=%u got=%llu want_st=%u want=%llu\n", name, st, 13 (unsigned long long)got, want_st, (unsigned long long)want); 14 return 1; 15 } 16 17 int main(void) 18 { 19 int bad = 0; 20 uint64_t r = 42; 21 uint32_t st; 22 st = omega_native_revision(&r, 0); 23 bad |= expect_u("rev0", st, r, OMEGA_OK, 1); 24 st = omega_native_revision(&r, 1); 25 bad |= expect_u("rev1", st, r, OMEGA_OK, 2); 26 st = omega_native_revision(&r, UINT64_MAX - 1); 27 bad |= expect_u("revmax-1", st, r, OMEGA_OK, UINT64_MAX); 28 st = omega_native_revision(&r, UINT64_MAX); 29 bad |= expect_u("revmax", st, r, OMEGA_OK, 0); 30 if (omega_native_revision(0, 0) != OMEGA_BAD_ARG) { 31 fprintf(stderr, "FAIL revnull\n"); 32 bad = 1; 33 } 34 if (omega_native_revision((uint64_t *)(uintptr_t)1, 0) != OMEGA_BAD_ARG) { 35 fprintf(stderr, "FAIL revmisaligned\n"); 36 bad = 1; 37 } 38 st = omega_native_epoch(&r, 0); 39 bad |= expect_u("ep0", st, r, OMEGA_OK, 1); 40 st = omega_native_epoch(&r, 3); 41 bad |= expect_u("ep3", st, r, OMEGA_OK, 4); 42 st = omega_native_epoch(&r, UINT64_MAX - 1); 43 bad |= expect_u("epmax-1", st, r, OMEGA_OK, UINT64_MAX); 44 st = omega_native_epoch(&r, UINT64_MAX); 45 bad |= expect_u("epmax", st, r, OMEGA_OK, UINT64_MAX); 46 if (omega_native_epoch(0, 0) != OMEGA_BAD_ARG) { 47 fprintf(stderr, "FAIL epnull\n"); 48 bad = 1; 49 } 50 if (bad) 51 return 1; 52 puts("binding-portable: PASS"); 53 return 0; 54 }