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 / tools / sm121dis / corpus_selftest.sh

30 lines · 1728 bytes Raw Blame History
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.
5set -eu
6HERE=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
7WORK=$(mktemp -d "${TMPDIR:-/tmp}/sm121dis-corpus-control.XXXXXX")
8trap 'rm -rf "$WORK"' EXIT HUP INT TERM
9mkdir "$WORK/bin" "$WORK/missing" "$WORK/failing" "$WORK/partial"
10rc=0
11sh "$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}
15printf '#!/bin/sh\necho deliberate-producer-failure\nexit 42\n' > "$WORK/bin/gpu_matmul_api_test"
16chmod +x "$WORK/bin/gpu_matmul_api_test"
17rc=0
18sh "$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)
24printf '#!/bin/sh\necho "omega_kernel_dump: write failed, removed /x/k.bin" >&2\nexit 0\n' > "$WORK/bin/gpu_matmul_api_test"
25rc=0
26sh "$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}
30echo 'PASS: missing and failing corpus producers are refused'