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 / dagsim / mutant_predict.sh
| 1 | #!/bin/sh |
| 2 | # Drop the unsupported-return and refused checks. Leave the p.known test in |
| 3 | # place. The named assertions must fail: a prediction can be marked known and |
| 4 | # still be a refusal. |
| 5 | set -eu |
| 6 | ROOT=$(CDPATH= cd -- "$(dirname "$0")/../.." && pwd) |
| 7 | cd "$ROOT" |
| 8 | src=tools/dagsim/dagsim.c |
| 9 | grep -q 'PREDICT_REFUSAL_CHECK' "$src" |
| 10 | tmp=$(mktemp -d) |
| 11 | trap 'rm -rf "$tmp"' EXIT |
| 12 | sed '/PREDICT_REFUSAL_CHECK/s/st == RX_CM_ERR_UNSUPPORTED || p->refused || //' "$src" > "$tmp/dagsim.c" |
| 13 | grep -q 'PREDICT_REFUSAL_CHECK' "$tmp/dagsim.c" || { echo "mutant: deleted the check tag"; exit 1; } |
| 14 | grep -q 'RX_CM_ERR_UNSUPPORTED' "$tmp/dagsim.c" && { echo "mutant: unsupported check still present"; exit 1; } |
| 15 | grep -q 'predict_unusable' "$tmp/dagsim.c" || { echo "mutant: deleted the call"; exit 1; } |
| 16 | |
| 17 | CC=${CC:-cc} |
| 18 | # -Wno-unused-parameter: dropping the use of st must not die at compile time. |
| 19 | # The kill is the named assertion, not a warning. |
| 20 | cflags="-std=gnu11 -Wall -Wextra -Werror -Wno-unused-parameter -D_GNU_SOURCE -O2 -ffp-contract=off -DCUDAPP_MIGRATION_PENDING_C_TOOLS -DCUDAPP_MIGRATION_PENDING_C_DAGSIM_RESOLVE=1 -Isrc -Itools/dagsim" |
| 21 | $CC $cflags -c -o "$tmp/dagsim.o" "$tmp/dagsim.c" |
| 22 | $CC $cflags -ffp-contract=off -c -o "$tmp/rx_costmodel.o" src/runtime/rx_costmodel.c |
| 23 | # CUDA++ has no src/omega_om_units.c; src/sha256.c is sha256_hash on every host and calls the core_sha unit (Makefile DS_SHA_SRC). |
| 24 | sha=src/sha256.c |
| 25 | $CC $cflags -o "$tmp/unit" tests/dagsim/dagsim_unit.c "$tmp/dagsim.o" "$tmp/rx_costmodel.o" "$sha" src/cudapp_om_core_sha.c src/cudapp_om_cm_sort.c src/cudapp_om_cm_math.c src/cudapp_om_cm_fit.c src/cudapp_om_cm_stats.c src/cudapp_om_cm_features.c src/cudapp_om_cm_quantile.c src/cudapp_om_cm_decision.c src/cudapp_om_cm_prediction.c src/cudapp_om_cm_calibration.c src/cudapp_om_cm_blob.c src/cudapp_om_cm_digest.c src/cudapp_om_cm_route.c src/cudapp_om_dag_parse.c src/cudapp_om_dag_fmt.c -Wl,--wrap=rx_cm_predict -lm |
| 26 | set +e |
| 27 | "$tmp/unit" > "$tmp/out" 2>&1 |
| 28 | rc=$? |
| 29 | set -e |
| 30 | if [ "$rc" -eq 0 ]; then |
| 31 | echo "mutant survived: unit suite passed after dropping the predict refusal check" |
| 32 | exit 1 |
| 33 | fi |
| 34 | if ! grep -q 'predict_unsupported_despite_known' "$tmp/out"; then |
| 35 | echo "mutant did not fail named assertion predict_unsupported_despite_known" |
| 36 | cat "$tmp/out" |
| 37 | exit 1 |
| 38 | fi |
| 39 | if ! grep -q 'predict_refused_despite_known' "$tmp/out"; then |
| 40 | echo "mutant did not fail named assertion predict_refused_despite_known" |
| 41 | cat "$tmp/out" |
| 42 | exit 1 |
| 43 | fi |
| 44 | echo "mutant killed: predict_unsupported_despite_known predict_refused_despite_known" |