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 / tests / nvrm_policy_mutants.sh

33 lines · 1350 bytes Raw Blame History
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.
5set -eu
6cd "$(dirname "$0")/.."
7OMC="${OMEGA_OMC:-$HOME/work/cudastack/omega-mv/seed/out/omc}"
8BRIDGE="${OMEGA_BRIDGE:-$HOME/work/cudastack/omega-bridge}"
9POL=native/nvrm/policy.om
10cp "$POL" /tmp/policy.om.good
11restore() { cp /tmp/policy.om.good "$POL"; OMEGA_OMC="$OMC" OMEGA_BRIDGE="$BRIDGE" sh om/units.sh >/dev/null; }
12trap restore EXIT
13
14kill_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
27kill_one nrstat "eq st 81" "eq st 82"
28kill_one hnext "eq cls 65" "eq cls 66"
29kill_one pspan "gt nwords 2097151" "gt nwords 2097150"
30kill_one gpentry "shl nw 42" "shl nw 41"
31kill_one mthd "shl subc 13" "shl subc 12"
32kill_one pfull "sub entries 1 4294967295" "sub entries 0 4294967295"
33echo "NVRM POLICY MUTANTS PASS (6 killed)"