Skip to content

feature: Add pseudo-GPU device compilation harness for pass verification - #550

Open
johnbowen42 wants to merge 7 commits into
mainfrom
feature/bowen/pseudo-gpu-harness
Open

johnbowen42 wants to merge 7 commits into
mainfrom
feature/bowen/pseudo-gpu-harness

Conversation

@johnbowen42

Copy link
Copy Markdown
Collaborator

Drive the real HIP device pipeline (clang -x hip targeting amdgcn) on machines without ROCm or a GPU. A minimal hip/hip_runtime.h stub plus -nogpuinc -nogpulib --offload-device-only lets unmodified GPU tests compile with ProteusPass loaded, so lambda kernel-arg and clobbering analysis decisions are verifiable ahead of time from the PROTEUS_DEBUG_OUTPUT pass trace. Verified against Homebrew LLVM 19 and 22: lambda_clobber_shapes reproduces all 12 expected decisions.

Known quirk handled by the driver: upstream clang registers -fpass-plugin pipeline callbacks twice for HIP device compiles (ROCm clang does not), so the second ProteusPass run dies on the duplicate _jit_bitcode global after analysis completes; the script treats exactly that fatal as benign.

johnbowen42 and others added 7 commits October 15, 2026 13:11
Drive the real HIP device pipeline (clang -x hip targeting amdgcn) on
machines without ROCm or a GPU. A minimal hip/hip_runtime.h stub plus
-nogpuinc -nogpulib --offload-device-only lets unmodified GPU tests
compile with ProteusPass loaded, so lambda kernel-arg and clobbering
analysis decisions are verifiable ahead of time from the
PROTEUS_DEBUG_OUTPUT pass trace. Verified against Homebrew LLVM 19 and
22: lambda_clobber_shapes reproduces all 12 expected decisions.

Known quirk handled by the driver: upstream clang registers
-fpass-plugin pipeline callbacks twice for HIP device compiles (ROCm
clang does not), so the second ProteusPass run dies on the duplicate
_jit_bitcode global after analysis completes; the script treats exactly
that fatal as benign.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
cmake -DPROTEUS_PSEUDO_GPU=ON (GPU toolchains off) adds a <test>.HIP target
per GPU test that drives the real HIP device pipeline -- clang -x hip
targeting amdgcn with ProteusPass loaded -- and emits the post-pass LLVM
module to pseudo-gpu/<test>.device.ll, requiring no ROCm or GPU. The pass
objects are built HIP-flavored and with PROTEUS_PSEUDO_GPU, which downgrades
the duplicate _jit_bitcode fatal to a debug-logged skip: upstream clang
registers pass-plugin pipeline callbacks twice for HIP device compiles, so
the pass legitimately re-runs there; production builds keep the fatal.

Includes the stub HIP header and standalone driver script (tools/pseudo-gpu)
previously developed on feature/bowen/pseudo-gpu-harness, now with forced
stub inclusion and a hipLaunchKernelGGL macro so all registered lambda tests
compile.
tests/gpu/lambda-spec-groundtruth.json records per-test
specialize/decline decisions parsed from the ProteusPass debug trace;
tools/lambda-spec-ci/lambda_spec_ci.py captures, checks, and renders it.
The trace lines are identical for ROCm and pseudo-GPU runs, so one truth
file serves both; CI can fail on any decision drift. Initial capture is
from the pseudo-GPU pipeline and is marked as requiring ROCm re-capture
before being treated as hardware ground truth.
Adopts the newer decision map and doc from the analysis branch:
lambda_interior_slot_overwrite is gone from the GPU suite there (its shape
becomes a frontend error), and the metadata records the removal. The JSON
remains pseudo-GPU provenance and must be re-captured -- against main for
this branch's standalone PR, against ROCm before being treated as hardware
truth.
The JSON now records main's decisions over main's lambda suite (23 tests,
44 decisions) rather than a snapshot from the analysis feature branch, so
this tooling PR is self-consistent and the feature branch's PR can show its
behavioral delta as a diff against this file.
tools/lambda-spec-ci/run_sweep.sh drives the pseudo-GPU device pipeline
over every lambda GPU test and checks the resulting specialize/decline
decisions against the committed ground truth; the new
ci-lambda-spec.yml workflow runs it in a plain ubuntu:24.04 container
with apt.llvm.org clang -- no GPU, ROCm, or conda -- failing on decision
drift and uploading the pass traces on failure. Tests absent from the
ground truth (expected not to compile in this pipeline) are skipped with
a note; a traceless test that IS in the ground truth fails the job.
@johnbowen42
johnbowen42 force-pushed the feature/bowen/pseudo-gpu-harness branch from 960b12c to 8e4faee Compare October 15, 2026 20:11

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant