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 / mk / omega-gpu-wait.mk

26 lines · 1794 bytes Raw Blame History
1# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2# Shared GPU completion wait primitive (src/omega_gpu_wait.c): host unit test with
3# fake memory and a fake clock, plus a naive wall-clock mutant that must be
4# caught. Picked up by `-include mk/*.mk`. Host only: opens no device, needs no
5# physics headers, takes no chip lock.
6.PHONY: test-gpu-wait
7build/test_omega_gpu_wait: tests/test_omega_gpu_wait.c src/omega_gpu_wait.c src/omega_gpu_wait.h src/cudapp_om_eng.c src/omega_eng_dec.h src/omega_fixture_rest.h
8 @mkdir -p build
9 gcc -std=gnu11 -O2 -Wall -Wextra -Werror -D_GNU_SOURCE -Isrc -o $@ tests/test_omega_gpu_wait.c src/omega_gpu_wait.c src/cudapp_om_eng.c
10test-gpu-wait: build/test_omega_gpu_wait
11 ./build/test_omega_gpu_wait
12
13# Real-code mutants: src/omega_gpu_wait.c carries one-line compile-flag mutants.
14# Each flagged build of the real primitive must FAIL the suite; the unflagged
15# build must PASS. A mutant that does not compile is an error, not a kill.
16GPU_WAIT_MUTANTS := OMEGA_GPU_WAIT_MUTANT_STALL_NO_RESET OMEGA_GPU_WAIT_MUTANT_PROGRESS_EXTENDS_HARD OMEGA_GPU_WAIT_MUTANT_NO_READ_BARRIER
17.PHONY: test-gpu-wait-mutants
18test-gpu-wait-mutants: build/test_omega_gpu_wait
19 @./build/test_omega_gpu_wait >/dev/null || { echo "unflagged build FAILED"; exit 1; }
20 @echo "unflagged: PASS"
21 @set -e; for m in $(GPU_WAIT_MUTANTS); do \
22 gcc -std=gnu11 -O2 -Wall -Wextra -Werror -D_GNU_SOURCE -D$$m -Isrc -o build/test_omega_gpu_wait_$$m tests/test_omega_gpu_wait.c src/omega_gpu_wait.c src/cudapp_om_eng.c; \
23 if ./build/test_omega_gpu_wait_$$m >build/test_omega_gpu_wait_$$m.log 2>&1; then echo "MUTANT SURVIVED: $$m"; exit 1; fi; \
24 echo "$$m: killed ($$(grep -c 'FAIL' build/test_omega_gpu_wait_$$m.log) failing checks)"; \
25 done
26 @echo "OMEGA_GPU_WAIT_MUTANTS PASS"