summaryrefslogtreecommitdiffstats
path: root/tools/cuda-ab/p2/oracle.sh
diff options
context:
space:
mode:
authorArthur Hanson Rasmusson <arthur@vgpu.io>2026-10-08 04:15:24 -0400
committerArthur Hanson Rasmusson <arthur@vgpu.io>2026-10-08 04:15:24 -0400
commit5bb2d53ec14f0d802726bc879b994c0286f85415 (patch)
treea6b75f0fd7ab8dc21420041d282ea61049797713 /tools/cuda-ab/p2/oracle.sh
parent11820d73e35511a8dfe25c65ee2f81970f7ac757 (diff)
downloadopen-iov-5bb2d53ec14f0d802726bc879b994c0286f85415.tar.gz
open-iov-5bb2d53ec14f0d802726bc879b994c0286f85415.zip
vgsp+guest-diag: kcore-truth pin resolver (pool/pushbuffer/channel ring+userd) + GR ring userd-derived candidates
guest_pin_stream.py now resolves translations entirely from guest truth via /proc/kcore + a manual page-table walk (no QMP races): the CE semaphore pool and pushbuffer memory from the UVM rm_mem structures, and each channel's GPFIFO ring + GPPUT from the tracking semaphore's embedding uvm_channel_t (channel_info located by its gpFifoGpuVa value). This removes the watcher pipeline's flakiness on the cudaMalloc stall class (missing pool/pushbuffer pins). gsp_sema_service.c: svc_gr_ring_autopin tries the guest-registered USERD memdesc base as a ring candidate (the fixed FB convention only matches when the guest's VRAM allocator happens to reproduce the old layout), plus an optional (gsp_sema_dbg) one-shot FB scan + raw-word diagnostics when every candidate fails. tools/cuda-ab/p2: self-checking arbitrary-kernel acceptance suite (10 programs: sequential launches, shapes, params, smem/GEMM, streams, malloc churn, printf+error, FMA benchmark, mixed, managed probe) with host oracle expectations and a guest runner.
Diffstat (limited to 'tools/cuda-ab/p2/oracle.sh')
-rwxr-xr-xtools/cuda-ab/p2/oracle.sh77
1 files changed, 77 insertions, 0 deletions
diff --git a/tools/cuda-ab/p2/oracle.sh b/tools/cuda-ab/p2/oracle.sh
new file mode 100755
index 0000000..80cff94
--- /dev/null
+++ b/tools/cuda-ab/p2/oracle.sh
@@ -0,0 +1,77 @@
+#!/bin/bash
+# SPDX-License-Identifier: BSD-3-Clause
+#
+# p2/oracle.sh - build the P2 programs and record host-side reference output
+# into p2/expected/<name>.txt.
+#
+# Two modes:
+# GPU mode - nvidia-smi works: each program is run bare-metal; the stable
+# lines (RESULT/CHECK/ERR/STATUS/P2PRINT/PROBE/MAIL) are
+# filtered into expected/<name>.txt and the full output is
+# kept as expected/<name>.full.txt.
+# EMIT mode - no usable host GPU (e.g. the device is owned by a running
+# guest): each program is run with --emit-expected, a
+# deterministic CPU-only computation of the stable lines a
+# correct GPU run must produce. This fallback is what
+# distinguishes "oracle not available" from "oracle passed".
+#
+# The generation mode is recorded in expected/SOURCE.txt.
+#
+# Usage: ./oracle.sh
+set -e
+
+HERE="$(cd "$(dirname "$0")" && pwd)"
+EXP="$HERE/expected"
+FILTER='^(RESULT|CHECK|ERR|STATUS|P2PRINT|PROBE|MAIL)'
+
+"$HERE/build.sh"
+mkdir -p "$EXP"
+
+mode="emit"
+if nvidia-smi -L >/dev/null 2>&1; then
+ mode="gpu"
+fi
+
+FAIL=0
+for bin in "$HERE"/bin/p2_*; do
+ name="$(basename "$bin")"
+ out="$EXP/$name.full.txt"
+
+ if [ "$mode" = "gpu" ]; then
+ echo "[oracle] $name (bare-metal GPU)"
+ if ! timeout 300 "$bin" > "$out" 2>&1; then
+ echo "[oracle] FAIL: $name exited non-zero" >&2
+ FAIL=1
+ continue
+ fi
+ if ! grep -q '^STATUS OK$' "$out"; then
+ echo "[oracle] FAIL: $name did not print STATUS OK" >&2
+ FAIL=1
+ continue
+ fi
+ grep -E "$FILTER" "$out" > "$EXP/$name.txt"
+ else
+ echo "[oracle] $name (no host GPU: deterministic emit)"
+ "$bin" --emit-expected > "$out" 2>&1
+ grep -E "$FILTER" "$out" > "$EXP/$name.txt"
+ fi
+done
+
+if [ "$FAIL" -ne 0 ]; then
+ echo "[oracle] FAILED - expected/ is incomplete" >&2
+ exit 1
+fi
+
+{
+ echo "mode=$mode"
+ echo "date=$(date -u +%Y-%m-%dT%H:%M:%SZ)"
+ echo "host=$(hostname)"
+ if [ "$mode" = "gpu" ]; then
+ nvidia-smi --query-gpu=name,driver_version --format=csv,noheader | head -1
+ else
+ echo "deterministic CPU computation via --emit-expected"
+ echo "(no usable host GPU; rerun ./oracle.sh when one is available)"
+ fi
+} > "$EXP/SOURCE.txt"
+
+echo "[oracle] done ($mode) -> $EXP"