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/src/common.h | 66 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 tools/cuda-ab/p2/src/common.h (limited to 'tools/cuda-ab/p2/src/common.h') diff --git a/tools/cuda-ab/p2/src/common.h b/tools/cuda-ab/p2/src/common.h new file mode 100644 index 0000000..e1e3137 --- /dev/null +++ b/tools/cuda-ab/p2/src/common.h @@ -0,0 +1,66 @@ +// SPDX-License-Identifier: BSD-3-Clause +/* + * common.h - shared conventions for the P2 "arbitrary CUDA kernels" suite. + * + * Line conventions (p2/run_guest.sh filters on these): + * + * compared (stable) RESULT / CHECK / ERR / STATUS / P2PRINT / PROBE / MAIL + * informational DEVICE / INFO / TIMING / MEMINFO (ignored by compare) + * + * Every program accepts --emit-expected: it prints the deterministic + * machine-checkable lines a correct GPU run must produce, computed on the + * CPU only, without touching CUDA. p2/oracle.sh uses this fallback when the + * host has no usable GPU (e.g. the device is owned by a running guest), so + * the expected/ references are a documented deterministic computation + * rather than a captured bare-metal run. + * + * All verification in this suite is exact (integers, or bit-identical + * float/integer arithmetic and correctly-rounded fmaf), so `bad=0` is + * meaningful and no tolerances are used. + */ +#ifndef P2_COMMON_H +#define P2_COMMON_H + +#include +#include +#include +#include +#include + +#define P2_CHECK(call) \ + do { \ + cudaError_t e_ = (call); \ + if (e_ != cudaSuccess) { \ + printf("ERR cuda=%s code=%d line=%d\n", \ + cudaGetErrorString(e_), (int)e_, __LINE__); \ + printf("STATUS FAIL\n"); \ + fflush(stdout); \ + return 1; \ + } \ + } while (0) + +static inline int p2_emit_mode(int argc, char **argv) +{ + return (argc > 1 && strcmp(argv[1], "--emit-expected") == 0) ? 1 : 0; +} + +static inline void p2_device_info(void) +{ + cudaDeviceProp prop; + + if (cudaGetDeviceProperties(&prop, 0) == cudaSuccess) + printf("DEVICE %s cc=%d.%d sm=%d mem=%llu\n", prop.name, + prop.major, prop.minor, prop.multiProcessorCount, + (unsigned long long)prop.totalGlobalMem); + else + printf("DEVICE unavailable\n"); +} + +static inline int p2_status(int bad) +{ + printf("STATUS %s\n", bad == 0 ? "OK" : "FAIL"); + fflush(stdout); + return bad == 0 ? 0 : 1; +} + +#endif /* P2_COMMON_H */ -- cgit v1.2.3