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/no_posix_session.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 / no_posix_session.c` 74 lines · 3732 bytes Raw Blame History 1 /* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */ 2 /* Verification-only transport: identical bytes from hosted and freestanding ABI. */ 3 #include 4 #include 5 #include "omega_native.h" 6 static uint64_t idx[512], gen[512]; 7 static int record(uint32_t status, uint64_t r, const uint64_t *o, unsigned n) { 8 if (fwrite(&status, sizeof status, 1, stdout) != 1 || fwrite(&r, sizeof r, 1, stdout) != 1) return 1; 9 return n && fwrite(o, sizeof *o, n, stdout) != n; 10 } 11 int main(void) { 12 /* admit: uint32 truncation; alignment 8/page4096; gpr64; hook8; 13 * sign-bit marker subtraction; uint64 epoch exhaustion and address carry. */ 14 const uint64_t v[] = {0,1,2,3,4,7,8,9,31,32,33,63,64,65,255,256,257, 15 351,352,353,895,896,897,4095,4096,4097,8191,8192,8193, 16 `2147483647`,`2147483648`,`2147483649`,`4294967294`,`4294967295`,`4294967296`, 17 UINT64_MAX-1,UINT64_MAX}; 18 for (uint64_t op = 0; op < 16; ++op) { 19 for (unsigned slot = 0; slot < 5; ++slot) for (unsigned k = 0; k < sizeof v / sizeof *v; ++k) { 20 uint64_t a[16] = {1,1,1,1,1}, o[32] = {0}, r = 0; 21 a[slot] = v[k]; 22 uint32_t s = omega2_decide(&r,op,a,16,o,4); 23 if (record(s,r,o,4)) return 1; 24 } 25 for (unsigned mask = 0; mask < 32; ++mask) { 26 uint64_t a[16] = {0}, o[4] = {0}, r = 0; 27 for (unsigned j = 0; j < 5; ++j) a[j] = (mask >> j) & 1; 28 uint32_t s = omega2_decide(&r,op,a,16,o,4); 29 if (record(s,r,o,4)) return 2; 30 } 31 } 32 /* Packet op dispatch, uint32 low/high carries, inline field truncation. */ 33 for (uint64_t op = 0; op < 9; ++op) for (unsigned slot = 0; slot < 3; ++slot) 34 for (unsigned k = 0; k < sizeof v / sizeof *v; ++k) { 35 uint64_t a[16] = {0}, o[32] = {0}, r = 0; 36 a[slot] = v[k]; 37 uint32_t s = omega2_emit(&r,op,a,16,o,32); 38 if (record(s,r,o,32)) return 3; 39 } 40 /* book: matching/stale generations, epoch mismatch, successor wrap. */ 41 for (uint64_t op = 0; op < 4; ++op) for (unsigned k = 0; k < sizeof v / sizeof *v; ++k) 42 for (unsigned j = 0; j < sizeof v / sizeof *v; ++j) { 43 uint64_t a[16] = {v[k],v[j],v[k],v[j]}, o[4] = {0}, r = 0; 44 uint32_t s = omega2_book(&r,op,a,16,o,4); 45 if (record(s,r,o,4)) return 4; 46 } 47 /* scan: empty, first/second/last slot, duplicate index wrong generation. */ 48 for (unsigned p = 0; p < 512; ++p) { 49 uint64_t r = 0; 50 idx[p] = UINT32_MAX; gen[p] = 1; 51 uint32_t s = omega2_scan(&r,idx,512,gen,512,UINT32_MAX,1); 52 if (record(s,r,0,0) || s || r != 1) return 5; 53 s = omega2_scan(&r,idx,512,gen,512,UINT32_MAX,2); 54 if (record(s,r,0,0) || s || r != 0) return 6; 55 idx[p] = gen[p] = 0; 56 } 57 /* op 6 (xq_admit) moved to om/streams/xq.om; streams_words now refuses it. Kept as a refusal differential. */ 58 for (unsigned mask = 0; mask < 8; ++mask) for (unsigned k = 0; k < sizeof v / sizeof *v; ++k) { 59 uint64_t a[16] = {v[k],mask&1,(mask>>1)&1,(mask>>2)&1}, o[32] = {0}, r = 0; 60 uint32_t s = omega2_streams_words(&r,6,a,16,o,32); 61 if (record(s,r,o,32)) return 7; 62 } 63 /* Negative ABI controls must refuse without touching the caller's result. */ 64 uint64_t a[16] = {0}, o[32] = {0}, r = 99; 65 if (omega2_decide(&r,0,a,15,o,4) != OMEGA_BAD_ARG || r != 99) return 8; 66 if (omega2_emit(&r,0,a,16,o,31) != OMEGA_BAD_ARG || r != 99) return 9; 67 if (omega2_book(&r,0,a,16,o,3) != OMEGA_BAD_ARG || r != 99) return 10; 68 if (omega2_scan(&r,idx,511,gen,512,0,1) != OMEGA_BAD_ARG || r != 99) return 11; 69 #ifdef NO_POSIX_SESSION_RED 70 return 90; 71 #else 72 return 0; 73 #endif 74 }