Repository navigation
fix(examples): future_apis needs sm_90, not sm_80 - #666
Conversation
The guard added in NVIDIA#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 NVIDIA#656 Signed-off-by: Vyncint Ng <[email protected]>
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.
|
Heads-up for review: the description above documents the superseded first revision. The head of this branch is I confirmed the sm_90 floor independently today, arriving at it from the other direction, and it can be pinned with no GPU by rewriting only the cd crates/rustc-codegen-cuda/examples/future_apis
for arch in sm_86 sm_90; do
sed "s/^\.target .*/.target $arch/" future_apis.ptx > /tmp/fa_$arch.ptx
printf '%-8s : ' "$arch"; ptxas -arch=$arch /tmp/fa_$arch.ptx -o /dev/null 2>&1 | head -1; echo
doneThe module contains no actual TMA — I also verified on an A10G (sm_86, driver 595.71.05) that the One question, which I raised on #676 before closing that as a duplicate too: |
|
Good catch on the symptom; the floor needed one correction, which I pushed on top:
Verified on RTX 5090 (sm_120):
Closes #676. The compiler-side question it leaves open (a bare sm_90 fence classified as Tma with an sm_100 no-hint default) is split into its own issue. |
…time gate (#1017) * docs(examples): three READMEs state a minimum GPU below their own runtime gate Fourteen examples gate `main` on compute capability. Three of them also state a **Minimum GPU** in their README, and all three state one lower than the gate they ship with -- so the README says the example runs on hardware where it prints `skipping:` and returns: example README said gate in main() gate's own message future_apis Volta (sm_70) major < 9 "fence.proxy.async ... requires sm_90+" coop_groups_demo Volta (sm_70+) major < 9 "thread block clusters require sm_90+" barrier Volta (sm_70) major < 8 "mbarrier requires sm_80+" `future_apis` is the one with history: 8615368 corrected that gate to `major < 9` during the #666 review -- the requirement is `fence.proxy.async`, emitted by `ManagedBarrier::init_by` for every barrier kind, which ptxas rejects below sm_90, and the `TmaBarrier` typestate is inert `PhantomData` that detects nothing. The gate moved; the README did not. In all three cases the sm_70 figure is not invented -- it is the floor of *one* instruction family the example touches (mbarrier, or `match.any.sync`) rather than the floor for running the example. Each entry now states the real floor, cites the gate that enforces it, and keeps the sm_70 fact as the aside it always was, so the next reader does not have to reconcile them. Every gate here is in `main()` and returns immediately, so this is the whole example's floor, not one test's. Verified: swept all 215 example READMEs -- these three were the only ones whose stated Minimum GPU did not match a gate in their own `main`, and after this change none do. check-error-example-status and check-example-smoketest-contract pass. Signed-off-by: Vyncint Ng <[email protected]> * docs(examples): fix mbarrier floor asides and unreachable gate text The three README floors from the parent commit were right, but four asides still contradicted the runtime gates: - barrier: the sm_70 mbarrier claim is libcu++'s software fallback, not the PTX instructions this example emits (those need sm_80+, matching cuda-device's barrier support notes) - barrier: drop the Pre-Volta troubleshooting row; the sm_80 gate in main skips before any kernel could hit it - coop_groups_demo: pre-Hopper devices never reach the combined cluster+cooperative message; main exits at its sm_90 skip line first - future_apis: mbarrier instructions need sm_80+, and fence.proxy.async is what sets the sm_90 floor --------- Signed-off-by: Vyncint Ng <[email protected]> Co-authored-by: nihalpasham <[email protected]>
Follow-up to #658, which I got wrong for this one example.
What was wrong
#658 gated
future_apisat sm_80, reasoning from itsmbarrier_{init,arrive,test_wait,inval}calls. Those really are sm_80 instructions and they are the only arch-sensitive ones the emitted PTX contains — but the kernels also constructManagedBarrier<_, TmaBarrier>, and the backend detects that as a TMA feature. Asking for anything lower is refused outright: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 did not present as a clean skip — it presented asDriverError(218, "a PTX JIT compilation failed")on every pre-Blackwell device, Ampere and Hopper alike, not merely the pre-Ampere hardware #658 was aimed at.Both compiler behaviours are the designed ones: fail closed on an explicit low
--arch, raise the target when it is auto-detected. Only the floor in the example was wrong.The change
major < 8→major < 10, matchingclcandtma_multicast, with the compiler's own diagnostic quoted in the comment so the floor is not re-derived from the visible instructions next time. That was exactly my mistake: the instructions in the PTX say sm_80, and they are not what sets the requirement.Verification
NVIDIA A10G (
compute_cap 8.6):Before this change, the same example on the same device failed with
DriverError(218)— including aftertouch crates/*/src/lib.rsto force a full backend rebuild, so it was not a stale-artifact effect.cargo fmt --checkclean.How this went unnoticed in #658
@nihalpasham validated #658 on CC 12.0, where sm_100 ≤ the device and the example runs its real path correctly — so nothing there could have shown it. I validated on sm_75, where the guard fires and the example skips, which also hides it. The failure only appears in the band between the two, on Ampere and Hopper, and that is where I found it: running the full suite on an A10G, which sits inside the documented
sm_80+support floor.Worth noting for the target-selection discussion in #656:
Tma + Sm80resolving to a requirement of sm_100 rather than sm_90 is the part I do not understand, since TMA itself is Hopper. I have not investigated whether that mapping is intentional and am not proposing a change to it here — this PR only corrects the example's floor to match whatever the backend requires today.