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 / codegen_pf_diff.c
| 1 | /* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */ |
| 2 | #include "omega_blackwell_codegen_pf.h" |
| 3 | #include <stdio.h> |
| 4 | #include <string.h> |
| 5 | |
| 6 | static int same(const BlackwellIRProgram *a, const BlackwellIRProgram *b) { |
| 7 | if (a->count != b->count) return 0; |
| 8 | if (a->regalloc.num_vregs != b->regalloc.num_vregs) return 0; |
| 9 | if (a->regalloc.num_uvregs != b->regalloc.num_uvregs) return 0; |
| 10 | for (size_t i = 0; i < a->count; i++) { |
| 11 | if (memcmp(&a->insns[i], &b->insns[i], sizeof a->insns[i]) != 0) return 0; |
| 12 | } |
| 13 | return 1; |
| 14 | } |
| 15 | |
| 16 | int main(void) { |
| 17 | BlackwellIRProgram c, o, m; |
| 18 | if (omega_blackwell_codegen_pf_copy_prog_c(&c) != 0) { printf("FAIL c build\n"); return 1; } |
| 19 | if (omega_cg_pf_copy_from_omega(&o, 0) != 0) { printf("FAIL omega build\n"); return 1; } |
| 20 | if (!same(&c, &o)) { printf("FAIL bytes c=%zu o=%zu\n", c.count, o.count); return 1; } |
| 21 | if (omega_cg_pf_copy_from_omega(&m, 1) != 0) { printf("FAIL mutant build\n"); return 1; } |
| 22 | if (same(&c, &m)) { printf("FAIL mutant not caught\n"); return 1; } |
| 23 | printf("PASS pf copy byte-identical insns=%zu mutant caught\n", c.count); |
| 24 | return 0; |
| 25 | } |