Repository navigation
Conversation
The example skipped when `major < 8`, on the basis that the mbarrier APIs it
exercises need sm_80. That is true of the APIs and not of the code generated for
them: `ManagedBarrier::init` pairs every `mbarrier.init` with a
`fence.proxy.async.shared::cta`, and `ptxas` rejects that `.async` modifier
below sm_90:
ptxas fatal : Modifier '.async' requires .target sm_90 or higher
So on sm_80..sm_89 the gate passed and the example went on to fail in the
driver, which rejects the whole module before any kernel starts:
Error: DriverError(218, "a PTX JIT compilation failed")
Gate on sm_90 instead, so those devices take `verdict_standard`'s `skipping:`
path and report PASS (skipped), as `cluster` already does for pre-Hopper. On an
A10G (sm_86) this turns the only failure in a 185-example run into a skip.
The floor is reproducible without a GPU: rewrite the `.target` line of the
generated PTX and ask ptxas. sm_86 is rejected for the reason above, sm_90 is
accepted.
This corrects the gate rather than the emission. The fence is currently emitted
for every `ManagedBarrier::init` regardless of `Kind`, and its purpose is to
make generic-proxy writes visible to the async proxy, so a
`ManagedBarrier<_, GeneralBarrier>` that never feeds an async copy may not need
it. Predicating it on `Kind` would keep plain barriers working on Ampere as the
old sm_80 comment intended; that is a memory-model question raised in NVIDIA#676
rather than guessed at here.
Refs NVIDIA#676
Signed-off-by: Vyncint Ng <[email protected]>
|
Closing as a duplicate of #666 — my mistake, I opened this without checking the open PR list first. #666 already makes the same #666's in-code comment is also better informed than mine — it notes that the One thing from here that may be worth folding into #666: the floor can be pinned with no GPU at all, 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
doneHappy to add that to #666's description if useful. |
Problem
future_apisself-gates on compute capability, but at the floor of the mbarrierAPI rather than the floor of the PTX cuda-oxide emits for it:
ManagedBarrier::initpairs everymbarrier.initwith a proxy fence(
crates/cuda-device/src/barrier.rs:417), which is visible in the generated PTX:ptxasrejects that.asyncmodifier below sm_90, so on sm_80..sm_89 the gatepasses and the example goes on to fail in the driver, which rejects the whole
module before any kernel starts:
It was the only failure in an otherwise-green 185-example run on an A10G
(sm_86), where it reported
[85/185] future_apis ... FAIL (exit=1).Reproduction
The floor needs no GPU — rewrite only the
.targetline of the generated PTXand ask
ptxaswhere it stops being valid:Fix
Gate on sm_90, so sub-floor devices take
verdict_standard'sskipping:pathand report
PASS (skipped)— the same graceful opt-outclusteralready usesfor pre-Hopper. The comment now records why the floor is sm_90 rather than the
sm_80 the APIs suggest, so the next reader does not "correct" it back.
Verification on hardware
NVIDIA A10G (sm_86), 23028 MiB, driver 595.71.05, nvcc 13.2—cargo oxide run future_apisWith this change, the same device that previously failed now skips cleanly:
verdict_standardmatches thatskipping:line and reportsPASS (skipped).Before the change, on the same box:
Error: DriverError(218, "a PTX JIT compilation failed"), exit 1, counted asFAIL (exit=1)by the suite.I have not been able to execute the sm_90+ path — I have no Hopper or Blackwell
hardware — so this PR verifies the skip, not the run. The gate's upper side is
unchanged in shape from the sm_80 version it replaces, and
clusteruses thesame
major < 9comparison for the same reason.Scope
This corrects the gate, not the emission, and deliberately so.
The fence is emitted for every
ManagedBarrier::initregardless ofKind, andits purpose is to make generic-proxy writes visible to the async proxy. A
ManagedBarrier<_, GeneralBarrier>that never feeds an async copy may not needit, and the typestate already distinguishes
GeneralBarrierfromTmaBarrier.If the fence can be predicated on
Kind, plain barriers would keep working onAmpere exactly as the old sm_80 comment intended, instead of the whole API being
Hopper+. That is a memory-model question I did not want to answer by inference,
so it is raised in #676 rather than guessed at here. Happy to implement it if
you confirm the ordering requirement.
Refs #676