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/om_eng_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 / om_eng_mutants.sh` 89 lines · 4767 bytes Raw Blame History 1 #!/bin/sh 2 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 3 # Recompile semantic mutants of om/engine/eng.om. Each mutant breaks one decision, 4 # is regenerated through the pinned seeded bridge and linked in place of 5 # src/cudapp_om_eng.c into two oracles: 6 # diff the om-vs-C engine differential (tests/om_eng_diff_test.c); its record 7 # must differ from the C oracle transcript build/om-qmd/eng_c.txt 8 # be the Blackwell backend host test (tests/test_omega_blackwell_engine.c 9 # against tests/fake_m16_native.c); it must print [FAIL] 10 # A mutant is KILLED when at least one oracle catches it; SURVIVED fails the sweep. 11 # The BE_* and WRAP_* rows are the backend-mutation rows of 12 # tools/gpu_engine_backend_mutations.sh whose decisions moved into eng.om. 13 # Host only, no device. Needs OMEGA_OMC (pinned `e5b32567`), OMEGA_BRIDGE and 14 # build/om-qmd/eng_c.txt (make test-om-eng-diff). Run under the bwrap wrapper. 15 set -eu 16 ROOT=$(CDPATH= cd -- "$(dirname "$0")/.." && pwd) 17 OMC=${OMEGA_OMC:-$HOME/work/cudastack/omega-mv/seed/out/omc} 18 BRIDGE=${OMEGA_BRIDGE:-$HOME/work/cudastack/omega-bridge} 19 SRC=$ROOT/om/engine/eng.om 20 OUT=$ROOT/build/om-qmd/eng-mutants 21 REF=$ROOT/build/om-qmd/eng_c.txt 22 [ -f "$REF" ] || { echo "FAIL om eng mutants: $REF missing (run make test-om-eng-diff)"; exit 2; } 23 ENG=${OM_ENG_BUILD_LINE:?OM_ENG_BUILD_LINE (set by make test-om-eng-mutants)} 24 TP=$ROOT/third_party/nvidia-open-580.173.02 25 INC="-I$ROOT/m16 -I$ROOT/nvrm -I$TP/src/common/sdk/nvidia/inc -I$TP/kernel-open/common/inc -I$TP/kernel-open/nvidia-uvm -I$TP/src/nvidia/arch/nvalloc/unix/include" 26 BESRCS="src/omega_blackwell_submit.c src/omega_blackwell_engine.c src/omega_gpu_engine.c src/omega_blackwell_matmul.c src/omega_blackwell_codegen.c src/omega_blackwell_encoder.c src/omega_blackwell_qmd.c src/omega_blackwell_realize.c src/omega_vector.c src/omega_core.c src/omega_canonical.c src/sha256.c" 27 BESRCS="$BESRCS ${OM_ENG_BE_BINDING:?OM_ENG_BE_BINDING (set by make test-om-eng-mutants)} src/omega_gpu_om_ir.c" 28 rm -rf "$OUT" 29 mkdir -p "$OUT" 30 killed=0 31 total=0 32 run_one() { 33 name=$1 34 from=$2 35 to=$3 36 total=$((total + 1)) 37 m=$OUT/$name 38 mkdir -p "$m" 39 # The from-string (it may span lines) must occur exactly once. 40 n=$(python3 -c 'import sys; print(open(sys.argv[1]).read().count(sys.argv[2]))' "$SRC" "$from") 41 if [ "$n" != 1 ]; then 42 echo "FAIL $name site count $n" 43 exit 1 44 fi 45 python3 -c 'import sys; p,a,b=sys.argv[1:]; t=open(p).read(); open(p+".mut","w").write(t.replace(a,b,1))' "$SRC" "$from" "$to" 46 mv "$SRC.mut" "$m/eng.om" 47 cat "$ROOT/om/engine/fixture_rest.om" "$m/eng.om" > "$m/unit.om" 48 OMEGA_SEEDED_OMC="$OMC" sh "$BRIDGE/tools/bridge-seeded" c "$m/unit.om" > "$m/eng.c" 49 (cd "$ROOT" && $ENG "$m/eng.c" -o "$m/eng_om") 50 (cd "$ROOT" && gcc -std=gnu11 -O2 -Wall -Wextra -Werror -D_GNU_SOURCE -DOMEGA_BLACKWELL_HOST_SIMULATOR -pthread \ 51 -ffunction-sections -fdata-sections -Isrc -Itests $INC -o "$m/be" tests/test_omega_blackwell_engine.c \ 52 tests/fake_m16_native.c $BESRCS "$m/eng.c" -Wl,--gc-sections -lm) 53 set +e 54 "$m/eng_om" "$m/eng_om.txt" 2>"$m/eng_om.ops" 55 "$m/eng_om" --compare "$m/eng_om.txt" "$REF" >"$m/diff.out" 2>&1 56 drc=$? 57 "$m/be" >"$m/be.out" 2>&1 58 if grep -q '\[FAIL\]' "$m/be.out"; then brc=1; else brc=0; fi 59 set -e 60 if [ "$drc" = 0 ] && [ "$brc" = 0 ]; then 61 echo "SURVIVED $name" 62 exit 1 63 fi 64 echo "KILLED $name diff=$drc be=$brc ($(head -n 1 "$m/diff.out"))" 65 killed=$((killed + 1)) 66 } 67 # wait and gate decisions 68 run_one m_seqge_bit 'h = and shr d 31 1' 'h = and shr d 30 1' 69 run_one m_wrest_stale_stall 'if ge now get w 2' 'if ge now get m 12' 70 run_one m_mmshape_no_u32 'gx = and div c 8 `4294967295`' 'gx = div c 8' 71 run_one m_cache_page 'put w 1 and add get m 1 4095 `18446744073709547520`' 'put w 1 and add get m 1 4096 `18446744073709547520`' 72 run_one m_life_floor 'bv gt b `274877906944`' 'bv ge b `274877906944`' 73 run_one m_reqf_sign 'z = and bv ne a 0 bv eq shr a 63 0' 'z = bv ne a 0' 74 # relocated tools/gpu_engine_backend_mutations.sh rows 75 run_one BE_ROUND_PAGES_ZERO_ACCEPTED 'if eq k 0 76 if eq a 0 77 put w 0 1' 'if eq k 0 78 if eq a 1 79 put w 0 1' 80 run_one BE_ROUND_PAGES_NO_ROUNDING 'v = and add a 4095 `18446744073709547520`' 'v = a' 81 run_one BE_BUILD_COUNT_OVERFLOW 'if gt a `4294967232`' 'if gt a `4294967295`' 82 run_one BE_THREADS_WRONG 'put w 2 64' 'put w 2 32' 83 run_one BE_GRID_ROUNDS_DOWN 'put w 1 div add a 63 64' 'put w 1 div a 64' 84 run_one BE_QMD_RELEASE_CHECK 'put w 0 and z bv eq get m 6 `2172715008`' 'put w 0 1' 85 run_one WRAP_MARKER_TIMEOUT 'put w 0 5000' 'put w 0 6000' 86 run_one WRAP_SEMAPHORE_TIMEOUT 'put w 1 5000' 'put w 1 6000' 87 run_one WRAP_MARKER2_TIMEOUT 'put w 2 5000' 'put w 2 6000' 88 run_one WRAP_VISIBILITY_TIMEOUT 'put w 3 5000' 'put w 3 6000' 89 echo "PASS om eng mutants: $killed/$total killed"