From c8ccdd772c7650f19d14f143f34b700813575746 Mon Sep 17 00:00:00 2001 From: Arthur Hanson Rasmusson Date: Thu, 8 Oct 2026 04:15:24 -0400 Subject: 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. --- tools/cuda-ab/p2/oracle.sh | 77 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100755 tools/cuda-ab/p2/oracle.sh (limited to 'tools/cuda-ab/p2/oracle.sh') 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/.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/.txt and the full output is +# kept as expected/.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" -- cgit v1.2.3