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 / platform_linux_effects.c
| 1 | /* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */ |
| 2 | /* Host differential: omega2_plat_ring_store matches memcpy; over 1048576 refuses. |
| 3 | * 1048576 = 2^20 (WolframLanguageEvaluator: 2^20 -> 1048576). No device is opened. */ |
| 4 | #include "cudapp_plat_effects.h" |
| 5 | #include <stdio.h> |
| 6 | #include <string.h> |
| 7 | #include <stdint.h> |
| 8 | |
| 9 | int main(void) { |
| 10 | unsigned char src[64], dst[64], oracle[64]; |
| 11 | uint64_t wrote = 0; |
| 12 | for (int i = 0; i < 64; i++) src[i] = (unsigned char)(i * 3 + 1); |
| 13 | memset(dst, 0x5a, sizeof dst); |
| 14 | memcpy(oracle, src, 64); |
| 15 | if (omega2_plat_ring_store(&wrote, dst, 64, src, 64, 64) != 0 || wrote != 64 || memcmp(dst, oracle, 64) != 0) { |
| 16 | fprintf(stderr, "FAIL ring-store differential\n"); |
| 17 | return 1; |
| 18 | } |
| 19 | uint64_t fenced = 0; |
| 20 | if (omega2_plat_fence(&fenced) != 0 || fenced != 1) { |
| 21 | fprintf(stderr, "FAIL fence\n"); |
| 22 | return 1; |
| 23 | } |
| 24 | wrote = 7; |
| 25 | if (omega2_plat_ring_store(&wrote, dst, 64, src, 64, 1048577ull) == 0 && wrote == 1048577ull) { |
| 26 | fprintf(stderr, "FAIL over-bound store accepted\n"); |
| 27 | return 1; |
| 28 | } |
| 29 | printf("PASS platform linux effects differential\n"); |
| 30 | return 0; |
| 31 | } |