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 / nvrm_policy_mutants.sh
| 1 | #!/bin/sh |
| 2 | # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 3 | # Kills policy.om mutants: each one changes one constant, regenerates the Omega |
| 4 | # unit, and must make the C-oracle differential fail. HOST_ONLY, no device. |
| 5 | set -eu |
| 6 | cd "$(dirname "$0")/.." |
| 7 | OMC="${OMEGA_OMC:-$HOME/work/cudastack/omega-mv/seed/out/omc}" |
| 8 | BRIDGE="${OMEGA_BRIDGE:-$HOME/work/cudastack/omega-bridge}" |
| 9 | POL=native/nvrm/policy.om |
| 10 | cp "$POL" /tmp/policy.om.good |
| 11 | restore() { cp /tmp/policy.om.good "$POL"; OMEGA_OMC="$OMC" OMEGA_BRIDGE="$BRIDGE" sh om/units.sh >/dev/null; } |
| 12 | trap restore EXIT |
| 13 | |
| 14 | kill_one() { |
| 15 | name=$1; from=$2; to=$3 |
| 16 | cp /tmp/policy.om.good "$POL" |
| 17 | sed -i "s/$from/$to/" "$POL" |
| 18 | OMEGA_OMC="$OMC" OMEGA_BRIDGE="$BRIDGE" sh om/units.sh >/dev/null |
| 19 | cc -std=gnu11 -O2 -D_GNU_SOURCE -Invrm -Isrc -o /tmp/nvrm-policy-mut nvrm/policy_test.c src/cudapp_om_nvrm_policy.c |
| 20 | if /tmp/nvrm-policy-mut >/dev/null 2>&1; then |
| 21 | echo "FAIL mutant $name: differential still passed" |
| 22 | exit 1 |
| 23 | fi |
| 24 | echo "killed $name" |
| 25 | } |
| 26 | |
| 27 | kill_one nrstat "eq st 81" "eq st 82" |
| 28 | kill_one hnext "eq cls 65" "eq cls 66" |
| 29 | kill_one pspan "gt nwords 2097151" "gt nwords 2097150" |
| 30 | kill_one gpentry "shl nw 42" "shl nw 41" |
| 31 | kill_one mthd "shl subc 13" "shl subc 12" |
| 32 | kill_one pfull "sub entries 1 4294967295" "sub entries 0 4294967295" |
| 33 | echo "NVRM POLICY MUTANTS PASS (6 killed)" |