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 / tools / sm121dis / corpus_selftest.sh
| 1 | #!/bin/sh |
| 2 | # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 3 | # A missing or failing producer, or one that exits 0 after a kernel could not be dumped whole, must invalidate the |
| 4 | # disassembler corpus. |
| 5 | set -eu |
| 6 | HERE=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) |
| 7 | WORK=$(mktemp -d "${TMPDIR:-/tmp}/sm121dis-corpus-control.XXXXXX") |
| 8 | trap 'rm -rf "$WORK"' EXIT HUP INT TERM |
| 9 | mkdir "$WORK/bin" "$WORK/missing" "$WORK/failing" "$WORK/partial" |
| 10 | rc=0 |
| 11 | sh "$HERE/corpus.sh" "$WORK/bin" "$WORK/missing" > "$WORK/missing.log" 2>&1 || rc=$? |
| 12 | [ "$rc" -eq 127 ] && grep -q 'VERDICT FAIL: corpus producer failed:' "$WORK/missing.log" || { |
| 13 | echo 'FAIL: a missing producer did not invalidate the corpus'; exit 1; |
| 14 | } |
| 15 | printf '#!/bin/sh\necho deliberate-producer-failure\nexit 42\n' > "$WORK/bin/gpu_matmul_api_test" |
| 16 | chmod +x "$WORK/bin/gpu_matmul_api_test" |
| 17 | rc=0 |
| 18 | sh "$HERE/corpus.sh" "$WORK/bin" "$WORK/failing" > "$WORK/failing.log" 2>&1 || rc=$? |
| 19 | [ "$rc" -eq 42 ] && grep -q 'deliberate-producer-failure' "$WORK/failing.log" && |
| 20 | grep -q 'VERDICT FAIL: corpus producer failed:' "$WORK/failing.log" || { |
| 21 | echo 'FAIL: a failing producer did not invalidate the corpus'; exit 1; |
| 22 | } |
| 23 | # exit 0, but omega_kernel_dump reported a kernel it could not write whole (src/omega_blackwell_codegen.c) |
| 24 | printf '#!/bin/sh\necho "omega_kernel_dump: write failed, removed /x/k.bin" >&2\nexit 0\n' > "$WORK/bin/gpu_matmul_api_test" |
| 25 | rc=0 |
| 26 | sh "$HERE/corpus.sh" "$WORK/bin" "$WORK/partial" > "$WORK/partial.log" 2>&1 || rc=$? |
| 27 | [ "$rc" -eq 1 ] && grep -q 'VERDICT FAIL: kernels not captured whole:' "$WORK/partial.log" || { |
| 28 | echo 'FAIL: a kernel not captured whole did not invalidate the corpus'; exit 1; |
| 29 | } |
| 30 | echo 'PASS: missing and failing corpus producers are refused' |