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/aienux/blob/main/evidence/own-gpu-driver/rung1/contract_mutants.sh # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. 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 `aienux / evidence / own-gpu-driver / rung1 / contract_mutants.sh` 40 lines ยท 2401 bytes Raw Blame History 1 #!/usr/bin/env bash 2 # contract_mutants.sh DEVC_BIN KERNEL_DIR OUT: wrong-but-well-formed edits of gb10_chan.devc. The checker accepts each 3 # (they break no ordering rule); the generated twin must then FAIL test_gpu_sim or differ in the differential trace. 4 # A mutant that passes both = a hole in the tests. Exit 0 only if every mutant is killed. 5 set -u 6 DEVC=$1 K=$2 OUT=$3 7 src=$K/gpu/contract/gb10_chan.devc 8 work=$(mktemp -d); trap 'rm -rf "$work"' EXIT 9 mkdir -p "$work/gpu/contract/gen" 10 cp "$src" "$work/orig.devc" 11 muts=( 12 "TARGET=TARGET_SYS_COH|TARGET=1" 13 "BIG_PAGE_64K=1|BIG_PAGE_64K=0" 14 "LENGTH=nwords LEVEL=1|LENGTH=nwords LEVEL=0" 15 "const USERD_GPPUT 0x8C|const USERD_GPPUT 0x88" 16 "const RAMIN_PDB_WORD 128|const RAMIN_PDB_WORD 130" 17 "format TOKEN 32 RUNLIST_ID 22:16|format TOKEN 32 RUNLIST_ID 23:17" 18 "reg vf DOORBELL 0x30090 4 wo|reg vf DOORBELL 0x30094 4 wo" 19 "LENGTH 62:42|LENGTH 63:43" 20 "PTR_HI 51:32 place|PTR_HI 51:32" 21 " fence\n bind| bind\n fence\n bind" 22 ) 23 killed=0 total=0 24 for m in "${muts[@]}"; do 25 from=${m%%|*} to=${m#*|}; total=$((total + 1)) 26 if ! grep -qF "$(printf '%b' "$from" | head -1)" "$work/orig.devc"; then echo "MUTANT TEXT MISSING: $from"; exit 2; fi 27 awk -v f="$(printf '%b' "$from")" -v t="$(printf '%b' "$to")" 'BEGIN{RS="\0"} {i=index($0,f); if(i) $0=substr($0,1,i-1) t substr($0,i+length(f)); printf "%s", $0}' "$work/orig.devc" > "$work/gb10_chan.devc" 28 if ! "$DEVC" gen "$work/gb10_chan.devc" "$work/gen" > "$work/gen.log" 2>&1; then 29 echo "mutant killed (checker): $from -> $to"; killed=$((killed + 1)); continue 30 fi 31 make -s -C "$K" OUT="$OUT" GPU_CONTRACT_C="$work/gen/gch_contract.c" \ 32 "$OUT/host/test_gpu_sim_contract" "$OUT/host/gpu_chan_trace_hand" "$OUT/host/gpu_chan_trace_contract" -B > "$work/mk.log" 2>&1 \ 33 || { echo "mutant killed (does not compile): $from -> $to"; killed=$((killed + 1)); continue; } 34 if ! "$OUT/host/test_gpu_sim_contract" > /dev/null 2>&1; then echo "mutant killed (test_gpu_sim): $from -> $to"; killed=$((killed + 1)); continue; fi 35 "$OUT/host/gpu_chan_trace_hand" > "$work/h.txt"; "$OUT/host/gpu_chan_trace_contract" > "$work/c.txt" 36 if ! cmp -s "$work/h.txt" "$work/c.txt"; then echo "mutant killed (trace differs): $from -> $to"; killed=$((killed + 1)); continue; fi 37 echo "MUTANT SURVIVED: $from -> $to" 38 done 39 echo "contract mutants: $killed of $total killed" 40 test "$killed" -eq "$total"