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 / om_qmd_mutants.sh
| 1 | #!/bin/sh |
| 2 | # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 3 | # Recompile seven semantic mutants of om/qmd/bw_qmd.om. Each must fail the sweep. |
| 4 | # Host only. Needs OMEGA_OMC (pinned e5b32567) and OMEGA_BRIDGE. |
| 5 | set -eu |
| 6 | ROOT=$(CDPATH= cd -- "$(dirname "$0")/.." && pwd) |
| 7 | OMC=${OMEGA_OMC:-$HOME/work/cudastack/omega-mv/seed/out/omc} |
| 8 | BRIDGE=${OMEGA_BRIDGE:-$HOME/work/cudastack/omega-bridge} |
| 9 | SRC=$ROOT/om/qmd/bw_qmd.om |
| 10 | OUT=$ROOT/build/om-qmd/mutants |
| 11 | mkdir -p "$OUT" |
| 12 | killed=0 |
| 13 | run_one() { |
| 14 | name=$1 |
| 15 | from=$2 |
| 16 | to=$3 |
| 17 | cp "$SRC" "$OUT/$name.om" |
| 18 | # The from-string must occur once. grep -c counts lines. |
| 19 | n=$(grep -c -F "$from" "$OUT/$name.om") |
| 20 | if [ "$n" != 1 ]; then |
| 21 | echo "FAIL $name site count $n" |
| 22 | exit 1 |
| 23 | fi |
| 24 | # Replace the one site. python keeps the rest byte-stable. |
| 25 | python3 - "$OUT/$name.om" "$from" "$to" <<'PY' |
| 26 | import pathlib, sys |
| 27 | path, old, new = sys.argv[1:] |
| 28 | text = pathlib.Path(path).read_text() |
| 29 | pathlib.Path(path).write_text(text.replace(old, new, 1)) |
| 30 | PY |
| 31 | OMEGA_SEEDED_OMC="$OMC" sh "$BRIDGE/tools/bridge-seeded" c "$OUT/$name.om" > "$OUT/$name.c" |
| 32 | gcc -std=gnu11 -O2 -Wall -Wextra -Werror -I"$ROOT/src" -o "$OUT/$name" \ |
| 33 | "$ROOT/tests/om_qmd_sweep_test.c" "$ROOT/src/omega_blackwell_qmd.c" "$OUT/$name.c" |
| 34 | set +e |
| 35 | # The caller runs this script under the bwrap/taskset wrapper; a nested bwrap |
| 36 | # can fail to create namespaces, and that failure would read as a kill. |
| 37 | "$OUT/$name" >"$OUT/$name.out" 2>"$OUT/$name.err" |
| 38 | rc=$? |
| 39 | set -e |
| 40 | if [ "$rc" = 0 ]; then |
| 41 | echo "SURVIVED $name" |
| 42 | exit 1 |
| 43 | fi |
| 44 | echo "KILLED $name rc=$rc" |
| 45 | killed=$((killed + 1)) |
| 46 | } |
| 47 | run_one m_qmd0_w4 'put q 4 8388610' 'put q 4 8388611' |
| 48 | run_one m_qmd1_w4 'put q 4 20905984' 'put q 4 20905985' |
| 49 | run_one m_qmd1_w14 'put q 14 793772964' 'put q 14 793772965' |
| 50 | run_one m_qmd1_offset 'put q 14 793772964' 'put q 13 793772964' |
| 51 | run_one m_cbank_w0 'put q 0 641859584' 'put q 0 641859585' |
| 52 | run_one m_cbank_w223 'put q 223 16776640' 'put q 223 16776641' |
| 53 | run_one m_shared_cap 'if gt sm 32768' 'if gt sm 16384' |
| 54 | echo "PASS $killed mutants killed" |