Repository navigation
feature: Add pseudo-GPU device compilation harness for pass verification - #550
Open
johnbowen42 wants to merge 7 commits into
Open
johnbowen42 wants to merge 7 commits into
johnbowen42 wants to merge 7 commits into
Conversation
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
force-pushed
the
feature/bowen/pseudo-gpu-harness
branch
from
October 15, 2026 20:11
960b12c to
8e4faee
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.