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
CUDApp / tools / sm121dis / om_vs_c.sh
| 1 | #!/bin/sh |
| 2 | # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 3 | # om_vs_c.sh <om-sm121dis> <c-sm121dis> <kernel-dir> <work-dir>: the .om decoder (default build) against the |
| 4 | # migration-pending C decoder (CUDAPP_DISASM=c build) on every <kernel-dir>/*.bin. Both print --pairs; the two |
| 5 | # texts must be byte for byte the same, exit status included. No NVIDIA tool is used. Exit 0 only when every |
| 6 | # kernel is identical; 2 when a decoder or the kernels are missing. |
| 7 | set -u |
| 8 | OM=$1; C=$2; DIR=$3; WORK=$4 |
| 9 | [ -x "$OM" ] && [ -x "$C" ] || { echo "VERDICT NOT_RUN: decoder missing"; exit 2; } |
| 10 | ls "$DIR"/*.bin >/dev/null 2>&1 || { echo "VERDICT NOT_RUN: no kernels in $DIR"; exit 2; } |
| 11 | mkdir -p "$WORK" |
| 12 | k=0; bad=0; words=0 |
| 13 | for f in "$DIR"/*.bin; do |
| 14 | b=$(basename "$f" .bin) |
| 15 | k=$((k + 1)) |
| 16 | ro=0; rc=0 |
| 17 | "$OM" --pairs "$f" > "$WORK/$b.om" 2>&1 || ro=$? |
| 18 | "$C" --pairs "$f" > "$WORK/$b.c" 2>&1 || rc=$? |
| 19 | words=$((words + $(wc -l < "$WORK/$b.c"))) |
| 20 | if [ "$ro" -ne "$rc" ] || ! cmp -s "$WORK/$b.om" "$WORK/$b.c"; then |
| 21 | bad=$((bad + 1)) |
| 22 | echo "[FAIL] $b: om exit $ro, C exit $rc" |
| 23 | diff "$WORK/$b.c" "$WORK/$b.om" | head -6 |
| 24 | fi |
| 25 | rm -f "$WORK/$b.om" "$WORK/$b.c" |
| 26 | done |
| 27 | echo "om vs C: kernels: $k, words: $words, differing kernels: $bad" |
| 28 | [ $bad = 0 ] && { echo "VERDICT PASS"; exit 0; } |
| 29 | echo "VERDICT FAIL"; exit 1 |