Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/CUDApp/blob/main/tests/streams_submit_mutants.sh # 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 Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `CUDApp / tests / streams_submit_mutants.sh` 49 lines · 2984 bytes Raw Blame History 1 #!/bin/sh 2 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 3 # Mutation test for native/streams/submit.om: each mutant is regenerated with the 4 # pinned AArch64 context toolchain (same variables as native/nvrm/units.sh), linked 5 # into the fake-device fixture, and must make the C-vs-Omega image compare (or the 6 # fixture's own asserts) fail. HOST_ONLY. 7 set -eu 8 ROOT=$(CDPATH= cd -- "$(dirname "$0")/.." && pwd) 9 BRIDGE=${OMEGA_NVRM_BRIDGE:?set OMEGA_NVRM_BRIDGE to the pinned hosted/context bridge} 10 : "${OMEGA_NATIVE_OMC:?}" "${OMEGA_NATIVE_OMC2:?}" 11 [ "$(uname -m)" = aarch64 ] || { echo "NOT_RUN: submit mutants regenerate AArch64 only" >&2; exit 3; } 12 OUT=${OUT_DIR:-build} 13 CC=${CC:-cc} 14 CFLAGS="-std=gnu11 -Wall -Wextra -Werror -D_GNU_SOURCE -O2 -Isrc -Im16 -Invrm -Ithird_party/nvidia-open-580.173.02/src/common/sdk/nvidia/inc -Ithird_party/nvidia-open-580.173.02/kernel-open/common/inc -Ithird_party/nvidia-open-580.173.02/kernel-open/nvidia-uvm -Ithird_party/nvidia-open-580.173.02/src/nvidia/arch/nvalloc/unix/include -Ithird_party/aien-gpu-abi1" 15 cd "$ROOT" 16 [ -f "$OUT/streams-submit-c.img" ] || { echo "run make test-streams-submit first" >&2; exit 2; } 17 # Same link providers as the make fixtures (mk/streams-submit.mk STREAMS_SUBMIT_LINK), so a missing provider fails the build, not a mutant. 18 SRCS=${STREAMS_SUBMIT_LINK:?run through make test-streams-submit-mutants (STREAMS_SUBMIT_LINK)} 19 T=$(mktemp -d) 20 trap 'rm -rf "$T"' EXIT 21 export OMEGA_NATIVE_OMC OMEGA_NATIVE_OMC2 22 caught=0 n=0 23 while IFS='|' read -r name from to; do 24 [ -n "$name" ] || continue 25 n=$((n + 1)) 26 [ "$(grep -cF -- "$from" native/streams/submit.om)" = 1 ] || { echo "FAIL mutant $name: site not unique" >&2; exit 1; } 27 awk -v f="$from" -v t="$to" '{ i = index($0, f); if (i) $0 = substr($0, 1, i - 1) t substr($0, i + length(f)); print }' \ 28 native/streams/submit.om > "$T/submit.om" 29 rm -rf "$T/gen" 30 "$BRIDGE/tools/native" --host --target aarch64linux "$T/gen" native/nvrm/transport.om "$T/submit.om" >/dev/null 31 cp "$T/gen/omega_native.h" "$T/cudapp_nvrm_native.h" 32 $CC -I"$T" $CFLAGS -DCUDAPP_MIGRATION_PENDING_C_NVRM=0 -DCUDAPP_MIGRATION_PENDING_C_SUBMIT=0 \ 33 -o "$T/m" nvrm/submit_test.c "$T/gen/omega_native.c" $SRCS 34 if "$T/m" "$T/m.img" >/dev/null 2>&1 && cmp -s "$OUT/streams-submit-c.img" "$T/m.img"; then 35 echo "FAIL mutant $name survived" 36 else 37 echo "mutant $name caught"; caught=$((caught + 1)) 38 fi 39 done <<'EOF' 40 valid-bit|shl ulong 1 41|shl ulong 1 40 41 address-mask|sub va and va 3|va 42 slot|mul slot 8 8|mul add slot 1 8 8 43 gpput-wrap|rem and add pos 1 `4294967295` entries|rem add pos 1 entries 44 gpput-stale|rem and add pos 1 `4294967295` entries|rem pos entries 45 doorbell-offset|ret mapset bell off 4 token|ret mapset bell 0 4 token 46 nwords-bound|gt nwords `2097151`|gt nwords `4294967295` 47 EOF 48 [ "$caught" = "$n" ] || { echo "STREAMS SUBMIT MUTANTS FAIL ($caught/$n caught)"; exit 1; } 49 echo "STREAMS SUBMIT MUTANTS PASS ($caught/$n caught)"