Repository navigation
Description
Description
future_apis self-gates on compute capability, but one generation too low. It
skips when major < 8, on the basis that the mbarrier APIs need sm_80 — true of
the APIs, but not of the PTX cuda-oxide emits for them. ManagedBarrier::init
also emits fence.proxy.async.shared::cta, whose .async modifier ptxas
rejects below sm_90. So on sm_80..sm_89 the gate lets the example through and it
fails in the driver with DriverError(218, "a PTX JIT compilation failed")
before any kernel starts.
It was the only failure in an otherwise-green 185-example run on an A10G (sm_86).
Root cause
ManagedBarrier::init_by emits the fence unconditionally
(crates/cuda-device/src/barrier.rs:417):
pub unsafe fn init_by(self, count: u32, init_thread: u32) -> ManagedBarrier<Ready, Kind, ID> {
if crate::thread::threadIdx_x() == init_thread {
unsafe {
mbarrier_init(self.ptr as *mut Barrier, count);
fence_proxy_async_shared_cta(); // <-- requires sm_90In the generated PTX every init is paired with it:
mbarrier.init.shared.b64 [__shared_mem_0], %r2;
// begin inline asm
fence.proxy.async.shared::cta;
// end inline asm
That is also why the module is compiled .target sm_100:
contains_tma_features treats a bare fence.proxy.async as a TMA feature
(crates/cuda-oxide-codegen/src/target.rs:420), and with no usable device hint
select_target maps plain Tma to sm_100 (target.rs:1183). Hopper itself is
fine, since arch_satisfies_feature maps Tma to major >= 9 (target.rs:1590)
so an sm_90 hint is compatible and wins — I have no Hopper to confirm that and
am going on the code.
Minimal reproducer
The floor needs no GPU:
cargo oxide build future_apis
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
donesm_86 : ptxas fatal : Modifier '.async' requires .target sm_90 or higher
sm_90 :
The module contains no actual TMA — cp.async.bulk., expect_tx,
.sync_restrict, tcgen05 and clusterlaunchcontrol. are all absent; the
proxy fence is the only trigger.
Expected behavior
The gate matches the floor of the emitted PTX, so the example reports
PASS (skipped) on sm_80..sm_89 via verdict_standard's skipping: path,
as cluster already does for pre-Hopper.
Actual behavior
=== Future APIs Test (Unified) ===
Error: DriverError(218, "a PTX JIT compilation failed")
Failed with exit code: Some(1)
and in a full run: [85/185] future_apis ... FAIL (exit=1) [2s].
Environment
- GPU: NVIDIA A10G (sm_86, 23028 MiB), driver 595.71.05
- CUDA:
Build cuda_13.2.r13.2/compiler.37434383_0(PTX also checked with 13.3) - Rust toolchain:
nightly-2026-04-03(perrust-toolchain.toml) - Source revision:
cd5ef394(also reproduces with perf(mir-lower): type an enum's unclaimed bytes as one integer #675 applied)
Additional context
I confirmed this is not a regression from anything in flight by rebuilding the
same tree with my only outstanding change reverted and seeing the identical
failure.
Correcting the gate to major < 9 is the minimal fix and I am happy to send it.
But there may be a better one, which is really a question about the memory model:
the fence is emitted for every ManagedBarrier::init regardless of Kind, and
the proxy fence exists to make generic-proxy writes visible to the async
proxy. A ManagedBarrier<_, GeneralBarrier> that never feeds an async copy
arguably does not need it, and the typestate already distinguishes
GeneralBarrier from TmaBarrier. If the fence can be predicated on Kind,
plain barriers would keep working on Ampere as the sm_80 comment intends,
instead of the whole API being Hopper+. I did not want to guess at the ordering
requirement, so I have not attempted that. Which would you prefer?
Activity
[-]future_apis is not compute-capability gated: FAILs instead of SKIPs below sm_90[/-][+]future_apis self-gates at sm_80 but its PTX needs sm_90: FAILs instead of skipping[/+]vyncint commentedon Aug 6, 2026
Correcting my own report: the original text said the example had no compute-capability gate and proposed a
floor=90entry insmoketest.sh'srequired_cc. Both were wrong.required_cconly raises the compile arch; it does not gate execution. Andfuture_apisdoes already self-gate — atmajor < 8. The real defect is narrower and more interesting: the gate matches the mbarrier API floor (sm_80) while the emitted PTX floor is sm_90, becauseManagedBarrier::initunconditionally appendsfence.proxy.async.shared::cta.Body updated with the root cause, the
ptxasevidence, and theKind-predication question.vyncint commentedon Aug 6, 2026
Closing this as a duplicate — I filed it without checking that the instance was already handled.
8615368f).standardexamples not gated by compute capability — is already tracked in smoketest:standardexamples are not gated by compute capability (2 false PASS, 2 false FAIL, 8 failures on sm_75) #656.Tma + Sm80→ sm_100 target-selection question for smoketest:standardexamples are not gated by compute capability (2 false PASS, 2 false FAIL, 8 failures on sm_75) #656, which is the part I thought was new.The one thing here that I do not think is covered anywhere:
ManagedBarrier::init_byemitsfence.proxy.asyncfor every barrier kind, and that fence is what forces the sm_90 floor. Its purpose is to make generic-proxy writes visible to the async proxy, so aManagedBarrier<_, GeneralBarrier>that never feeds an async copy plausibly does not need it — and if it can be predicated onKind, plain barriers would keep working on Ampere, which is what the original sm_80 comment intended. I have not attempted it because I do not want to guess at the ordering requirement. I will raise that as a question on #666 where the context lives rather than keep a duplicate issue open for it.