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

33 lines · 1608 bytes Raw Blame History
1/* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */
2/* Reuse the established C-vs-Omega partition, adding explicit target ABI edges. */
3#define main no_posix_cubin_sweep
4#include "om_cubin_sweep_test.c"
5#undef main
6
7int main(void) {
8 if (no_posix_cubin_sweep()) return 1;
9 /* WolframLanguageEvaluator: {86+{-1,0,1},121+{-1,0,1},2^32-1}
10 * -> {{85,86,87},{120,121,122},4294967295}. */
11 static const uint32_t targets[] = {0,85,86,87,120,121,122,UINT32_MAX};
12 for (size_t i = 0; i < sizeof targets / sizeof targets[0]; i++) {
13 uint8_t *out = NULL;
14 size_t len = 0;
15 char err[256];
16 uint32_t sm = targets[i];
17 int expected = sm == OMEGA_CUBIN_SM_86 || sm == OMEGA_CUBIN_SM_121
18 ? OMEGA_CUBIN_OK : OMEGA_CUBIN_E_TARGET;
19 int rc = omega_cubin_pack_target(sm, "target_edge", text, 16, NULL, 0,
20 1024, 1, 0, &out, &len, err, sizeof err);
21 if (rc != expected || (rc == 0 && (!out || !len)) || (rc != 0 && (out || len))) return 2;
22 omega_cubin_free(out);
23 }
24 uint8_t *out = NULL;
25 size_t len = 0;
26 int rc = omega_cubin_pack_target(OMEGA_CUBIN_SM_121, "null_params", text, 16,
27 NULL, 1, 1024, 1, 0, &out, &len, NULL, 0);
28 if (rc != OMEGA_CUBIN_E_ARG || out || len) return 3;
29 for (int status = OMEGA_CUBIN_OK; status <= OMEGA_CUBIN_E_TARGET; status++)
30 if (!omega_cubin_rc_name(status)) return 4;
31 puts("PASS explicit sm_86/sm_121 image differential, target boundaries and null parameter refusal");
32 return 0;
33}