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/omega-gpu-driver/blob/main/tests/complete_diff.sh # omega-gpu-driver aien-dev/omega-gpu-driver 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 `omega-gpu-driver / tests / complete_diff.sh` 54 lines ยท 2464 bytes Raw Blame History 1 #!/bin/sh 2 # tests/complete_diff.sh: builds the .om completion trace (chan/dma.om + chan/gmmu.om + chan/mem.om + 3 # chan/chan.om + chan/sim.om + chan/complete.om + tests/complete_trace.om) and the C reference trace 4 # tests/complete_ref.c (compiled fresh into a temp dir against NVIDIA open-gpu-kernel-modules 580.173.02 5 # clc96f.h headers) and requires byte-identical stdout. Host only. 6 set -u 7 here=$(cd "$(dirname "$0")/.." && pwd) 8 OMC=${OMC:-$here/build/omc} 9 COMPLETE_OM=${COMPLETE_OM:-$here/chan/complete.om} 10 OGKM_SRC=${OGKM_SRC:-/home/drakestapleton/workspace/_ext/open-gpu-kernel-modules-580.173.02/src} 11 COMPLETE_REF=${COMPLETE_REF:-} 12 OMC_SHA=$(sed -n 's/^OMC_SHA256=//p' "$here/tools/omc.pin") 13 run() { nice -n 19 taskset -c "${AIEN_TEST_CPUS:-0-9,15-19}" "$@"; } 14 15 got=$(sha256sum "$OMC" | cut -d' ' -f1) 16 if [ "$got" != "$OMC_SHA" ]; then 17 echo "complete_diff: FAIL omc sha256 $got, pinned $OMC_SHA"; exit 2 18 fi 19 20 t=$(mktemp -d /tmp/complete_diff.XXXXXX) || exit 2 21 trap 'rm -rf "$t"' EXIT 22 23 if [ -n "$COMPLETE_REF" ]; then 24 [ -s "$COMPLETE_REF" ] || { echo "complete_diff: FAIL COMPLETE_REF $COMPLETE_REF missing or empty"; exit 2; } 25 cp "$COMPLETE_REF" "$t/c.txt" || exit 2 26 else 27 S=$OGKM_SRC 28 if ! run cc -std=c11 -O1 -Wall -Werror \ 29 -I"$S/common/sdk/nvidia/inc" -I"$S/nvidia/arch/nvalloc/common/inc" -I"$S/common/uproc/os/common/include" \ 30 -I"$S/nvidia/inc/kernel" -I"$S/nvidia/inc" -I"$S/nvidia/generated" -I"$S/common/shared/msgq/inc" \ 31 -I"$S/nvidia/interface" -I"$S/common/inc" -o "$t/cref" "$here/tests/complete_ref.c"; then 32 echo "complete_diff: FAIL C reference build"; exit 2 33 fi 34 run "$t/cref" > "$t/c.txt" || { echo "complete_diff: FAIL C reference run"; exit 2; } 35 fi 36 37 if ! cat "$here/chan/dma.om" "$here/chan/gmmu.om" "$here/chan/mem.om" "$here/chan/chan.om" "$here/chan/sim.om" "$COMPLETE_OM" "$here/tests/complete_trace.om" | run "$OMC" > "$t/omtrace"; then 38 echo "complete_diff: FAIL omc build"; exit 3 39 fi 40 chmod +x "$t/omtrace" 41 run "$t/omtrace" > "$t/om.txt" 42 rc=$? 43 if [ "$rc" -ne 0 ]; then 44 echo "complete_diff: FAIL om trace exit $rc"; exit 1 45 fi 46 n=$(wc -l < "$t/c.txt") 47 if [ "$n" -eq 0 ]; then 48 echo "complete_diff: FAIL empty C trace"; exit 2 49 fi 50 if ! cmp -s "$t/c.txt" "$t/om.txt"; then 51 echo "complete_diff: FAIL traces differ ($(diff "$t/c.txt" "$t/om.txt" | grep -c '^[<>]') differing lines; C $n lines, om $(wc -l < "$t/om.txt"))" 52 exit 1 53 fi 54 echo "complete_diff: PASS ($n lines identical, .om vs C reference)"