Repository navigation
Conversation
Contributor
|
@r-barnes has exported this pull request. If you are a Meta employee, you can view the originating Diff in D126816956. |
r-barnes
added a commit
to r-barnes/torchcomms
that referenced
this pull request
Oct 23, 2026
Summary: Two macro patterns in RCCL produce comparisons whose result is fixed at compile time once the hipify pipeline expands them, which `-Wtautological-compare` rejects. - `NCCL_CONVERT_ORDER` tested its argument against each `std::memory_order` enumerator, so every call site passing a literal became `x == x`. `std::memory_order` and the `__ATOMIC_*` constants share the same underlying values, so the conversion is now a cast, with `static_assert`s pinning the correspondence. A `constexpr` helper would not fold at `-O0` and would emit a runtime switch on every atomic op; the cast keeps the argument an integer constant expression and generates identical IR. - On AMD builds before ROCm 7.12, `CU_MEM_LOCATION_TYPE_HOST_NUMA` is a sentinel (`3`) that `hipMemLocationType` cannot represent, so comparing a memory-location type against it is always false. A new `ncclMemLocationIsHostNuma` predicate in `hip_compat.h` is statically false where the sentinel is in use and a plain comparison everywhere else; `gin__funcs.h`, `dev_runtime.cc` and `dev_runtime_segments.cc` call it instead of comparing directly. - The development tree and the stable snapshot tree get the same changes. No warning is suppressed. Differential Revision: D126816956
r-barnes
force-pushed
the
export-D126816956
branch
from
October 23, 2026 22:21
5a0214e to
b55ec10
Compare
Summary: Two macro patterns in RCCL produce comparisons whose result is fixed at compile time once the hipify pipeline expands them, which `-Wtautological-compare` rejects. - `NCCL_CONVERT_ORDER` tested its argument against each `std::memory_order` enumerator, so every call site passing a literal became `x == x`. `std::memory_order` and the `__ATOMIC_*` constants share the same underlying values, so the conversion is now a cast, with `static_assert`s pinning the correspondence. A `constexpr` helper would not fold at `-O0` and would emit a runtime switch on every atomic op; the cast keeps the argument an integer constant expression and generates identical IR. - On AMD builds before ROCm 7.12, `CU_MEM_LOCATION_TYPE_HOST_NUMA` is a sentinel (`3`) that `hipMemLocationType` cannot represent, so comparing a memory-location type against it is always false. A new `ncclMemLocationIsHostNuma` predicate in `hip_compat.h` is statically false where the sentinel is in use and a plain comparison everywhere else; `gin__funcs.h`, `dev_runtime.cc` and `dev_runtime_segments.cc` call it instead of comparing directly. - The development tree and the stable snapshot tree get the same changes. No warning is suppressed. Differential Revision: D126816956
r-barnes
force-pushed
the
export-D126816956
branch
from
October 27, 2026 20:50
b55ec10 to
0c49d02
Compare
This branch has not been deployed
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.
Summary:
Two macro patterns in RCCL produce comparisons whose result is fixed at compile time once the hipify pipeline expands them, which
-Wtautological-comparerejects.NCCL_CONVERT_ORDERtested its argument against eachstd::memory_orderenumerator, so every call site passing a literal becamex == x.std::memory_orderand the__ATOMIC_*constants share the same underlying values, so the conversion is now a cast, withstatic_asserts pinning the correspondence. Aconstexprhelper would not fold at-O0and would emit a runtime switch on every atomic op; the cast keeps the argument an integer constant expression and generates identical IR.CU_MEM_LOCATION_TYPE_HOST_NUMAis a sentinel (3) thathipMemLocationTypecannot represent, so comparing a memory-location type against it is always false. A newncclMemLocationIsHostNumapredicate inhip_compat.his statically false where the sentinel is in use and a plain comparison everywhere else;gin__funcs.h,dev_runtime.ccanddev_runtime_segments.cccall it instead of comparing directly.No warning is suppressed.
Differential Revision: D126816956