Skip to content

test(examples): check the smoketest contract a new example cannot see - #683

Merged
nihalpasham merged 1 commit into
NVIDIA:mainfrom
vyncint:test/guard-smoketest-example-contract
Aug 7, 2026
Merged

nihalpasham merged 1 commit into
NVIDIA:mainfrom
vyncint:test/guard-smoketest-example-contract

Conversation

@vyncint

@vyncint vyncint commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Fixes #682. Three files, no overlap with #679, #680, or #681.

Why

smoketest.sh assumes two things about the examples that nothing verified, and neither is reachable without a GPU — the compile-only lane collapses every category into verdict_compile, so it exercises neither classify() nor the standard-category success marker.

A standard example that prints no marker is a false FAIL. verdict_standard requires SUCCESS/PASS/Complete; an example that launches kernels, verifies against exact expectations and returns is reported FAIL (no success marker). That landed two days ago — 981b9eb0 added a marker to disjoint_from_raw_parts on main:

Merging #670 (new example) and #665 (stricter smoketest verdicts) in the same batch left this example failing the standard-category check: both kernels verify to exact match but nothing prints SUCCESS/PASS/Complete, and the stricter harness rightly no longer rescues such a log.

A new example is where this bites: nothing in its own directory says a marker is required, and its author cannot see the consequence without hardware.

A typo in a *_EXAMPLES array silently mis-categorises. classify() falls through to standard for anything its seven arrays do not claim, so a misspelled or renamed entry does not fail — it matches nothing and the example gets the wrong verdict rules. For a tcgen05/wgmma example that loses the "PTX compiled on non-Hopper" path and starts reporting FAIL on hardware it was never meant to run on. All 45 entries across the 11 arrays are valid today, so this half is preventive; it is included because it is the same shape and free to check alongside.

What this adds

scripts/check-example-smoketest-contract.sh, run from status-guard.yml as a second job — next to the existing guard that keeps ERROR_EXAMPLES and STATUS.md in step, which exists for exactly this class. Sources only: no cargo, no toolkit, no LLVM.

The guard duplicates two of verdict_standard's greps, so it pins that coupling: if smoketest.sh stops grepping SUCCESS|PASS|Complete, or changes the skip pattern, the guard fails with "verdict_standard's contract changed; update this guard" rather than quietly checking a contract that no longer exists. Same trick as #648, where two hygiene fixtures had silently decoupled from the constant they pinned.

Verification

CPU-only, no GPU.

# Scenario Expected Result
1 Current main pass exit 0 — "11 arrays name only real examples, and all 159 standard examples print a success marker"
2 Revert 981b9eb0's marker line fail exit 1, names disjoint_from_raw_parts
3 Typo entry added to WGMMA_EXAMPLES fail exit 1, names the phantom entry
4 Both restored pass exit 0
5 verdict_standard's success pattern changed fail exit 1, "update this guard"
6 Its skip pattern changed fail exit 1, same
7 *_EXAMPLES arrays removed fail exit 1 via parse self-test
8 python3 absent from PATH fail exit 1, "refusing to report success from a check that cannot run"
9 Control: all tools present pass exit 0

Row 2 is the one that matters: it reproduces the real regression and names the same example you had to patch.

5–8 follow #643, where a guard reported success for three months because rg ... || true turned a missing binary into an empty result set.

One thing worth knowing about how this was built

The counts the guard reports (11 arrays, 159 standard examples) match an independent scan I ran separately, and that cross-check earned its keep: my first attempt used a quote-pairing regex to extract string literals, which silently captured only 8 of generated_ldmatrix's literals and produced 11 bogus "missing marker" hits — including that example, which visibly prints PASS: all …. The shipped version is line-based for that reason. Given the guard's whole job is to not be silently wrong, it seemed worth saying that the first draft was.

scripts/check-error-example-status.sh and both halves of check-dependency-licenses.sh still pass on this branch. bash -n is clean and the workflow YAML parses.

@vyncint vyncint closed this Aug 6, 2026
@vyncint
vyncint force-pushed the test/guard-smoketest-example-contract branch from e5b43ff to 981b9eb Compare August 6, 2026 16:27
scripts/smoketest.sh assumes two things about the examples that nothing
verified, and neither is reachable without a GPU: the compile-only lane
collapses every category into verdict_compile, so it exercises neither
classify() nor the standard-category success marker.

A `standard` example that verifies its results but prints no
SUCCESS/PASS/Complete marker is reported as FAIL (no success marker). That
landed two days ago: 981b9eb added a marker to disjoint_from_raw_parts on
main after NVIDIA#670 (the new example) and NVIDIA#665 (stricter verdicts) merged in one
batch. Nothing in an example's own directory says a marker is required, and
its author cannot see the consequence without hardware.

Separately, classify() falls through to `standard` for anything its seven
arrays do not claim, so a misspelled or renamed entry does not fail -- it
matches nothing and the example quietly gets the wrong verdict rules. All 45
entries across the 11 arrays are valid today, so that half is preventive.

Add scripts/check-example-smoketest-contract.sh and run it from
status-guard.yml, next to the existing guard that keeps ERROR_EXAMPLES and
STATUS.md in step. It reads sources only: no cargo, no toolkit, no LLVM.

The guard duplicates two of verdict_standard's greps, so it pins that
coupling: if smoketest.sh stops grepping SUCCESS|PASS|Complete, or changes
the skip pattern, the guard says so instead of quietly checking a contract
that no longer exists. Following NVIDIA#643 it also fails closed on a missing
python3 and on a parse self-test, rather than reporting success from a check
that could not run.

Fixes NVIDIA#682

Signed-off-by: Vyncint Ng <[email protected]>
@vyncint vyncint reopened this Aug 6, 2026
@nihalpasham nihalpasham added QoL-improvement Quality-of-life improvement; not a correctness fix build-related Build scripts, toolchain discovery, or compilation setup examples Example kernels and host harnesses under crates/rustc-codegen-cuda/examples labels Aug 7, 2026
@nihalpasham

Copy link
Copy Markdown
Collaborator

Gist: #670 and #665 were individually green and jointly produced the false-FAIL this guard catches (patched on main as 981b9eb).

  • category arrays and the standard-marker rule are now checked at PR time, CPU-only, sources only;
  • the fail-closed engineering held up under review: parse self-tests, the python3 refusal, and the verdict-pattern coupling checks that fail with "update this guard";
  • reproduced the verification table here: exit 0 with 11 arrays / 159 standard examples on today's tree, and loud named failures for a stripped marker, a phantom array entry, a changed verdict pattern, and removed arrays.

Closes #682.

Merging.

@nihalpasham
nihalpasham merged commit cf4f4e1 into NVIDIA:main Aug 7, 2026
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build-related Build scripts, toolchain discovery, or compilation setup examples Example kernels and host harnesses under crates/rustc-codegen-cuda/examples QoL-improvement Quality-of-life improvement; not a correctness fix

Projects

None yet

2 participants