Repository navigation
fix(nvvm): lower legacy floating atomic add - #381
Merged
nihalpasham merged 5 commits intoJul 23, 2026
Merged
nihalpasham merged 5 commits into
nihalpasham merged 5 commits into
Conversation
nihalpasham
force-pushed
the
codex/upstream-legacy-nvvm-atomic-fadd
branch
from
July 22, 2026 08:38
9256984 to
bd67285
Compare
Signed-off-by: nik <[email protected]>
Route the new example through the legacy NVVM lane in both GPU and compile-only smoke tests, use the atomic wrapper's documented pointer constructor, and require the exact six intrinsic calls in the unit regression. Refresh the standalone lockfile against current main. Signed-off-by: nihalp <[email protected]>
Restore the exact scalar typed-pointer signatures required by LLVM 7 NVVM and reject every conflicting top-level symbol before legalization mutates the module. Strengthen old-value coverage and launch the smoke example through atomic wrapper slices. Signed-off-by: nihalp <[email protected]>
PTX atom.add.f64 needs sm_60 hardware. The legacy legalizer accepted an f64 atomicrmw fadd for any capability, so an sm_5x NVVM build failed later inside libNVVM/ptxas with an opaque error on the emitted intrinsic. Thread the build target's compute capability into the legalizer and reject the rewrite up front, before any mutation, in the same fail-closed style as the ordering and scope checks. f32 stays accepted on every target.
nihalpasham
force-pushed
the
codex/upstream-legacy-nvvm-atomic-fadd
branch
from
July 23, 2026 10:30
bd67285 to
ff9cd04
Compare
Collaborator
|
Thanks for the PR. I layered maintainer commits on top:
Validated: nvvm-transforms, llvm-export, and codegen suites; GPU run on an RTX 5090; the libNVVM verify lane compiles all six signatures in CI without a GPU. Closes #380. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #380.
Summary
Lower relaxed, device-scoped f32/f64 atomic add to the six dedicated intrinsics accepted by the legacy LLVM 7 NVVM dialect. Reject operations whose type, address space, ordering, scope, or declaration ABI cannot be represented without weakening semantics.
What changed
Legacy atomic-add legalization
AtomicRmwOpfadd operations after existing NVVM atomic lowering.syncscope("device"), module placement, and pre-existing intrinsic declarations in the module-wide prepass.Correctness and fail-closed behavior
Known separate limitations
Testing
cargo oxide fmt --checkcargo test -p nvvm-transforms— 18 tests passedcargo clippy -p nvvm-transforms --all-targets -- -D warningscargo clippy --manifest-path crates/rustc-codegen-cuda/examples/legacy_atomic_fadd/Cargo.toml --all-targets -- -D warningsatomicrmwsm_86): optimized andCUDA_OXIDE_NO_OPT=1legacy NVVM runs both reportlegacy_atomic_fadd: PASS (f32=256, f64=256)Checklist
upstream/main