Skip to content

fix(examples): gate arch-dependent examples on compute capability - #658

Merged
nihalpasham merged 1 commit into
NVIDIA:mainfrom
vyncint:fix/example-capability-guards
Aug 5, 2026
Merged

nihalpasham merged 1 commit into
NVIDIA:mainfrom
vyncint:fix/example-capability-guards

Conversation

@vyncint

@vyncint vyncint commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Fixes the reporting half of #656.

Eleven examples in the standard smoketest category assume the device can run instructions above its architecture. On a Turing GPU (sm_75) that produced three distinct wrong verdicts, none of them reachable from CI, which compiles examples without executing them.

What was wrong

Two reported a full PASS having executed nothing. cp_async_small and cp_async_zfill print a capitalised Skipping:, which the case-sensitive check at smoketest.sh:333 does not match; they then satisfy the success check at :337 through the substring PASS inside their own message:

=== cp.async small-copy example (4-byte and 8-byte) ===

Skipping: cp.async requires sm_80+, device is sm_75 -- PASS (skipped)

Verdict: PASS, not PASS (skipped) — indistinguishable in the summary from an example that ran and validated results.

Two reported FAIL while behaving correctly. tma_copy and tma_multicast handle an unsupported device and exit 0, but printed no recognised marker. tma_multicast already carried the skipping: marker in its driver-error arm (main.rs:181), directly under a comment explaining it is there so "smoketest's failure-marker scan doesn't flag this as a regression" — but the capability arm at :154, which is the one that actually runs on pre-Blackwell hardware, omitted it.

Seven failed outright with DriverError(218, "a PTX JIT compilation failed"): barrier, future_apis, cvt_f16x2, generated_intrinsics, mcast_barrier_test and coop_groups_demo had no capability guard, and clc had one that only warned before continuing into the same panic.

What changed

Each example now takes the shape the thirteen already-correct examples use — check compute_capability(), print the documented lowercase skipping: marker, return. No harness changes; smoketest.sh is untouched.

Floors used: sm_80 for mbarrier (barrier, future_apis), packed f16 conversion (cvt_f16x2, matching the floor cvt_packed already gates on) and bf16 (generated_intrinsics); sm_90 for clusters (coop_groups_demo, mcast_barrier_test); sm_100 for CLC (clc).

Verification

Tesla T4 (sm_75), driver 595.71.05, CUDA 13.2, cargo oxide fmt --check clean:

FMT_EXIT=0
[ 1/13] barrier                          ... PASS (skipped) [99s]
[ 2/13] clc                              ... PASS (skipped) [3s]
[ 3/13] cluster                          ... PASS (skipped) [2s]
[ 4/13] coop_groups_demo                 ... PASS (skipped) [5s]
[ 5/13] cp_async_small                   ... PASS (skipped) [71s]
[ 6/13] cp_async_zfill                   ... PASS (skipped) [2s]
[ 7/13] cvt_f16x2                        ... PASS (skipped) [25s]
[ 8/13] future_apis                      ... PASS (skipped) [2s]
[ 9/13] generated_intrinsics             ... PASS (skipped) [22s]
[10/13] mcast_barrier_test               ... PASS (skipped) [3s]
[11/13] tma_copy                         ... PASS (skipped) [4s]
[12/13] tma_multicast                    ... PASS (skipped) [3s]
[13/13] vecadd                           ... PASS [2s]
Fail:    0 / 13

vecadd (executes) and cluster (already guarded) are unchanged controls. Before this change, the same selection on the same hardware gave nine failures and the two false passes.

The before-state came from a full 178-example run on sm_75: 11 failures, listed in #656.

Deliberately not included

Two items from #656 are left out rather than guessed at:

  • wgmma_mma_bf16 — it is compile-only but categorised standard. Moving it into WGMMA_EXAMPLES would not fix it: its output matches none of the non-Hopper markers at smoketest.sh:475, so it would fall through to :488 and report PASS (wgmma, executed), which is equally untrue. That needs a decision about whether a compile-only wgmma bucket should exist.
  • cutile_inter_kernel — fails on sm_75 inside the third-party toolchain (tileiras: Cannot find option named 'sm_75'). I do not know cuTile's actual floor, and an invented one is worse than none.

Also unaddressed here: the standard success check accepts SUCCESS|PASS|Complete anywhere in the output, which is what let the two false passes through in the first place. Tightening it is a harness change with blast radius across every example, so I would rather do it separately if you want it.

Eleven examples in the `standard` smoketest category assume the device can
run instructions above its architecture. On a Turing GPU (sm_75) that
produced three distinct wrong verdicts.

Two reported a full `PASS` having executed nothing: `cp_async_small` and
`cp_async_zfill` print a capitalised `Skipping:` that the case-sensitive
check at scripts/smoketest.sh:333 does not match, and then satisfy the
success check at :337 through the substring `PASS` inside their own
message.

Two reported `FAIL` while behaving correctly: `tma_copy` and
`tma_multicast` handle an unsupported device and exit 0, but printed no
recognised marker. `tma_multicast` already carried the `skipping:` marker
in its driver-error arm, under a comment explaining why it is there; the
capability arm that actually runs on pre-Blackwell hardware omitted it.

Seven failed outright with DriverError(218, "a PTX JIT compilation
failed"): `barrier`, `future_apis`, `cvt_f16x2`, `generated_intrinsics`,
`mcast_barrier_test` and `coop_groups_demo` had no capability guard, and
`clc` had one that only warned before continuing into the same panic.

Each now takes the shape the thirteen already-correct examples use: check
`compute_capability()`, print the documented lowercase `skipping:` marker,
and return.

Verified on a Tesla T4 (sm_75, driver 595.71.05, CUDA 13.2). The eleven go
from nine failures and two false passes to `PASS (skipped)`, with `vecadd`
and `cluster` unchanged as controls, and `cargo oxide fmt --check` passing.

Refs NVIDIA#656

Signed-off-by: Vyncint Ng <[email protected]>
@nihalpasham nihalpasham added build-related Build scripts, toolchain discovery, or compilation setup cuda-feature A CUDA hardware/toolkit feature (TMA, tcgen05, WGMMA) bug Something isn't working labels Aug 5, 2026
@nihalpasham

Copy link
Copy Markdown
Collaborator

Validated the half that needed newer hardware:

  • this machine is CC 12.0, where no guard should fire: all 11 touched examples ran their real paths (zero skipping: lines in any log) and every success marker printed. A guard that misfired here would have silently turned a real test into a skip, so this was the important half to confirm.
  • --compile-only over the same set mirrors the examples-compile CI job: green.
  • all 12 guard strings match the harness skip pattern, and the examples stay in the standard smoketest category.
  • one stale claim found for a separate follow-up, not this PR: the sm_100a tma_multicast PTX JIT-loads and passes on an RTX 5090, so the "consumer Blackwell does not support TMA multicast" fallback text is outdated.

Merging.

Partially addresses #656 (the examples half; the harness-side tightening stays open).

@nihalpasham
nihalpasham merged commit 3fb830a into NVIDIA:main Aug 5, 2026
33 checks passed
nihalpasham added a commit that referenced this pull request Aug 6, 2026
* fix(examples): future_apis needs sm_100, not sm_80

The guard added in #658 gates future_apis at sm_80 on the strength of its
mbarrier calls. Those would indeed run on Ampere, but the kernels also
construct `ManagedBarrier<_, TmaBarrier>`, and the backend detects that as a
TMA feature. Building for anything lower is refused outright:

  error: [rustc_codegen_cuda] Device codegen failed: PTX generation failed:
  CUDA target sm_86 cannot lower detected feature Tma + Sm80; cuda-oxide
  requires a target compatible with sm_100 for this module

Under an auto-detected target the build instead succeeds at .target sm_100 and
the module then fails to load, so the too-low floor surfaced as
DriverError(218, "a PTX JIT compilation failed") on every pre-Blackwell
device -- Ampere and Hopper alike, not just the pre-Ampere hardware the
original guard was aimed at. Both behaviours are the designed ones; only the
floor was wrong.

Raised to sm_100, matching clc and tma_multicast.

Verified on an NVIDIA A10G (sm_86): future_apis now reports
"skipping: TMA-typed barriers require sm_100+ (device is sm_86)" and the
smoketest passes 2/2 with vecadd as an executing control. Before this change
the same example failed with DriverError(218) on that device, including after
a forced full backend rebuild.

Refs #656

Signed-off-by: Vyncint Ng <[email protected]>

* review: the floor is sm_90 (fence.proxy.async), not sm_100

The requirement comes from fence.proxy.async, an sm_90 instruction that
ManagedBarrier::init_by emits for every barrier kind; the TmaBarrier
typestate parameter is inert PhantomData and detects nothing. On real
hardware the device hint resolves the target, so a Hopper box builds
and runs this example at sm_90; skipping below sm_100 would silently
drop coverage on exactly the generation these mbarrier/proxy-fence
APIs were built for. Guard at major < 9 and let the comment and skip
message carry the correct derivation.

Verified on an RTX 5090 (sm_120): all five tests execute and pass.

---------

Signed-off-by: Vyncint Ng <[email protected]>
Co-authored-by: nihalpasham <[email protected]>
nihalpasham pushed a commit that referenced this pull request Aug 6, 2026
…s a full PASS (#665)

verdict_standard decides a bare `PASS` from `grep -qE 'SUCCESS|PASS|Complete'`
over the whole log. Skip declarations routinely contain those words, so a skip
the function fails to recognise is not merely missing its "(skipped)"
annotation: it is promoted to a full execution PASS, indistinguishable in the
summary from an example that launched kernels and verified results.

Three cases all reported a clean `PASS`:

  * wgmma_mma_bf16's `main` only prints. Its module doc says "compilation and
    PTX generation only. Do not launch this kernel." It belongs in `standard`
    because the build and the host binary must both succeed, but that
    category's contract is that execution succeeds, so every GPU run counted
    it as an execution pass. Name it in NO_LAUNCH_EXAMPLES and report
    `PASS (compiled, no launch)`.
  * generated_ldmatrix prints `PASS (skipped): ...` below sm_75. The skip
    check matched only a leading lowercase `skipping:`, so that line fell
    through to the success grep, which then matched its own `PASS`.
  * A capitalised `Skipping:` did the same thing. #658 reworded the two
    examples that hit it, so nothing triggers this today; matching
    case-insensitively keeps the next one from reaching the success grep.

Compile-only runs collapse every category into verdict_compile, so the
GPU-less examples-compile lane is unaffected. This changes real-GPU runs.

Fixes #656

Signed-off-by: Vyncint Ng <[email protected]>
nihalpasham pushed a commit that referenced this pull request Aug 6, 2026
The example claimed, in both its module header and its runtime message, that
TMA multicast is "NOT supported on consumer Blackwell (sm_120)". Reviewing #658,
@nihalpasham measured the opposite: the sm_100a tma_multicast PTX JIT-loads and
the test passes on an RTX 5090.

Corrected to state the floor (sm_100a or later) without the false exclusion,
and to keep the accurate half -- Hopper and earlier really cannot run it.

I have no Blackwell hardware, so the positive claim is attributed rather than
re-measured: the header says sm_120 is reported to load and run, and the
runtime message names the floor instead of enumerating what does not work.

Refs #658

Signed-off-by: Vyncint Ng <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working build-related Build scripts, toolchain discovery, or compilation setup cuda-feature A CUDA hardware/toolkit feature (TMA, tcgen05, WGMMA)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants