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/rmchan_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 / rmchan_diff.sh` 57 lines ยท 2630 bytes Raw Blame History 1 #!/bin/sh 2 # tests/rmchan_diff.sh: builds the .om RM channel trace (gsp/rpc.om + gsp/sysinfo.om + chan/params.om + 3 # gsp/boot.om + chan/dma.om + chan/gmmu.om + chan/mem.om + chan/chan.om + chan/sim.om + chan/complete.om + 4 # chan/rmchan.om + tests/rmchan_trace.om) and the C reference trace tests/rmchan_ref.c (compiled fresh 5 # against NVIDIA open-gpu-kernel-modules 580.173.02 headers) and requires byte-identical stdout. Host only. 6 set -u 7 here=$(cd "$(dirname "$0")/.." && pwd) 8 OMC=${OMC:-$here/build/omc} 9 RMCHAN_OM=${RMCHAN_OM:-$here/chan/rmchan.om} 10 OGKM_SRC=${OGKM_SRC:-/home/drakestapleton/workspace/_ext/open-gpu-kernel-modules-580.173.02/src} 11 RMCHAN_REF=${RMCHAN_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 "rmchan_diff: FAIL omc sha256 $got, pinned $OMC_SHA"; exit 2 18 fi 19 20 t=$(mktemp -d /tmp/rmchan_diff.XXXXXX) || exit 2 21 trap 'rm -rf "$t"' EXIT 22 23 if [ -n "$RMCHAN_REF" ]; then 24 [ -s "$RMCHAN_REF" ] || { echo "rmchan_diff: FAIL RMCHAN_REF $RMCHAN_REF missing or empty"; exit 2; } 25 cp "$RMCHAN_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/rmchan_ref.c"; then 32 echo "rmchan_diff: FAIL C reference build"; exit 2 33 fi 34 run "$t/cref" > "$t/c.txt" || { echo "rmchan_diff: FAIL C reference run"; exit 2; } 35 fi 36 37 if ! cat "$here/gsp/rpc.om" "$here/gsp/replay.om" "$here/gsp/sysinfo.om" "$here/chan/params.om" "$here/gsp/boot.om" \ 38 "$here/chan/dma.om" "$here/chan/gmmu.om" "$here/chan/mem.om" "$here/chan/chan.om" \ 39 "$here/chan/sim.om" "$here/chan/complete.om" "$RMCHAN_OM" "$here/tests/rmchan_trace.om" \ 40 | run "$OMC" > "$t/omtrace"; then 41 echo "rmchan_diff: FAIL omc build"; exit 3 42 fi 43 chmod +x "$t/omtrace" 44 run "$t/omtrace" > "$t/om.txt" 45 rc=$? 46 if [ "$rc" -ne 0 ]; then 47 echo "rmchan_diff: FAIL om trace exit $rc"; exit 1 48 fi 49 n=$(wc -l < "$t/c.txt") 50 if [ "$n" -eq 0 ]; then 51 echo "rmchan_diff: FAIL empty C trace"; exit 2 52 fi 53 if ! cmp -s "$t/c.txt" "$t/om.txt"; then 54 echo "rmchan_diff: FAIL traces differ ($(diff "$t/c.txt" "$t/om.txt" | grep -c '^[<>]') differing lines; C $n lines, om $(wc -l < "$t/om.txt"))" 55 exit 1 56 fi 57 echo "rmchan_diff: PASS ($n lines identical, .om vs C reference)"