Repository navigation
fix(rccl): probe fabric APIs with plain compiler in topo_expl - #11657
Conversation
✅ All Policy Checks Passed
📖 Need help? See the Policy FAQ for details on every check and how to fix failures. |
There was a problem hiding this comment.
ARGUS
Bottom line: Worth settling before approval: PROBE_CXX at Makefile:12 has no existence check, so a missing amdclang++ silently answers no from both probes and re-creates the amdsmi_wrap.h collision this PR fixes.
Comment @argus review to re-run, or @argus re-review after pushing.
There was a problem hiding this comment.
ARGUS
Findings
1 finding(s) that could not be posted as inline comments
projects/rccl/tools/topo_expl/Makefile:53(Low) PROBE_TMP has no emptiness guard, so a failed mktemp makes both probe commands unparseable and drops both fabric definesPROBE_TMPgets no emptiness guard, so a failingmktempturns both probe commands into a redirection with no target (> && $(PROBE_CXX) ...), which the shell refuses to parse.HAVE_HIP_FABRIC_APIandHAVE_AMDSMI_FABRIC_APIthen come back empty instead ofno,AMDSMI_FABRIC_DIRECTstays undefined, and the compat type collision returns with only a bare shell syntax error to explain it. Same guard shape as lines 14-16:
Bottom line: LGTM once the PROBE_TMP emptiness guard at Makefile:53 is added; that one is mechanical. The PROBE_CXX executability guard at Makefile:17 rewrites a conditional, so it is worth another look.
Comment @argus review to re-run, or @argus re-review after pushing.
…_expl The topo_expl tool bypasses RCCL's CMake configuration and reproduces the HIP/amdsmi fabric feature probes in its own Makefile. Those probes piped a snippet through hipcc, i.e. hipcc's HIP driver mode. On recent ROCm toolchains hipcc's HIP driver pulls in cuda_wrappers/bits/c++config.h, which clashes with a recent system libstdc++ (redeclaration of __glibcxx_assert_fail). That makes the otherwise-valid probe fail to compile; the '&& echo yes || echo no' guard swallows the error and returns 'no', so AMDSMI_FABRIC_DIRECT is left undefined. With AMDSMI_FABRIC_DIRECT unset, amdsmi_wrap.h compiles its compat copies of the UALoE fabric types. On base images whose amd_smi/amdsmi.h now defines those types natively (ROCm 10.2.0 / TheRock main), the compat definitions collide with the real header and the topo_expl target fails to build, breaking the whole extra build. The main librccl build was unaffected because CMake probes with the plain compiler (check_cxx_source_compiles), which does not go through the HIP driver and correctly detected the API. Probe the fabric APIs the same way CMake does: compile a real temp file with the plain compiler (amdclang++, overridable via PROBE_CXX) instead of piping through hipcc's HIP driver. Both probes now agree with the CMake build, so AMDSMI_FABRIC_DIRECT is set correctly and the compat block is skipped when the real header provides the fabric API. Co-authored-by: Pi Agent
…tion Locate the probe compiler across bin/ and llvm/bin/ like toolchain-linux.cmake and fail loudly when none is executable, so a missing compiler no longer degrades a probe to "no". Gate each probe compile on a successful temp-file write and assign the cleanup shell call to a variable. Co-authored-by: Pi Agent
The previous guard tested existence via $(wildcard) and nested the command -v check, so a PROBE_CXX that exists but is not runnable skipped the check and the not-executable error never fired. Resolve PROBE_CXX and test -x on the resolved path so the exists-but-not-runnable case is caught. Co-authored-by: Pi Agent
…cm_smi topo_expl still included rocm_smi/rocm_smi.h and defined legacy rocm_smi_* discovery stubs, while the main RCCL build long ago migrated to amd_smi and forces USE_AMDSMI ON. On newer base images (ROCm >= 10.2 / TheRock main) the rocm_smi header no longer exists, so once the fabric-probe fix let the compile advance past the UALoE compat-type collision it failed with 'rocm_smi/rocm_smi.h file not found'. Align topo_expl with the library build: define USE_AMDSMI in the Makefile so the staged xml.cc/rccl_wrap.cc take the amd_smi discovery path, replace the rocm_smi include with amdsmi_wrap.h, and swap the rocm_smi_* stubs for the amd_smi_* entry points those sources call (init, getNumDevice, getDevicePciBusIdString, getDeviceIndexByPciBusId, getLinkInfo, getFabricDeviceInfo, getFirmwareVersion). The stubs report "no devices" so model-driven discovery falls through exactly as before. Testing: with rocm_smi/rocm_smi.h hidden to mimic the CI base image, all translation units now compile (-fsyntax-only exit 0) whereas pristine develop reproduces the original failure. Co-authored-by: Pi Agent
9d3c623 to
eccab55
Compare
There was a problem hiding this comment.
ARGUS
Bottom line: 4 new finding(s) below High not posted this round (@argus re-review full for a full pass); still open from earlier: Makefile:54. Worth clearing before approval.
Comment @argus review to re-run, or @argus re-review after pushing.
… guards Treat an explicitly empty PROBE_CXX override as unset so detection still runs, and fail loudly if mktemp cannot create the feature-probe temp file instead of silently degrading both probes. Co-authored-by: Pi Agent
cc3d58b to
cc701d6
Compare
|
@argus re-review full |
alex-breslow-amd
left a comment
There was a problem hiding this comment.
LGTM. Thank you sir for the fix.
TheRock Submodule Bump ActivityNewest first
|
Extra gfx90a compile failed because tests still used the pre-2.31 CE arity and a removed GDR flush inject helper. ## Motivation The NCCL 2.31 sync changed CE and GDR test APIs. Unit tests on develop still used the old signatures, causing extra’s gfx90a compile failed. The extra issues were: - CE tests — ncclCeAvailable / ncclHierCeAvailable still called with 5 args; 2.31 needs 7. - GDR tests — gdrSupported() is gone; RunRecvFlushBurst no longer takes forceWrite. - topo_expl / amdsmi — fabric enums redefined vs ROCm 7.0.2; already probed on develop (#11657), not in this PR. - DDA duplicate helper — already gone on develop. ## Technical Details - Pass `nullptr, nullptr` into `ncclCeAvailable` / `ncclHierCeAvailable` so calls match the 7-arg 2.31 API (`sendWin`, `recvWin`). - Match the host CE fake `ncclHierCeAvailable` in `ce_fakes.cc` to that 7-arg signature. - Replace `gdrSupported()` with `gdrPtrSupport()` and stop calling the removed 4-arg `RunRecvFlushBurst(..., forceWrite, ...)`. - `topo_expl` / amdsmi fabric-enum redefinition is already handled on `develop` by the Makefile probe in #11657; this PR does not change that path. ## Issue Tracking JIRA ID: AICOMRCCL-1982 Follow-up to #10785 (extra gfx90a compile). ## Test Plan - Compile `CeAlltoAllvEligibilityTests.cpp`, `GdrFlushTests.cpp`, and `ce_fakes.cc` for gfx90a (`--offload-arch=gfx90a`, `ENABLE_FAULT_INJECTION`) against the 2.31 headers. - Confirm unpatched `CeAlltoAllvEligibilityTests.cpp` still fails with extra’s `no matching function for call to 'ncclHierCeAvailable'` / `ncclCeAvailable`. - After merge, extra: Compile ubuntu24-therock && gfx90a (including `topo_expl`). ## Test Result - gfx90a object compile succeeded for the three patched TUs in Docker (`rocm/dev-ubuntu-22.04:7.2`). - Unpatched CE test still reproduced extra’s 5-vs-7-arg errors. - Extra gfx90a / `topo_expl` on the internal ROCm 7.0.2 image is not re-run in this PR until extra CI picks up the branch. ## Submission Checklist - [ ] Look over the contributing guidelines at https://github.com/ROCm/rocm-systems/blob/develop/CONTRIBUTING.md.
The topo_expl tool bypasses RCCL's CMake configuration and reproduces the HIP/amdsmi fabric feature probes in its own Makefile. Those probes piped a snippet through hipcc's HIP driver mode. On recent ROCm toolchains hipcc's HIP driver pulls in cuda_wrappers/bits/c++config.h, which clashes with a recent system libstdc++ (redeclaration of __glibcxx_assert_fail). That makes the otherwise-valid probe fail; the '&& echo yes || echo no' guard swallows the error and returns 'no', so AMDSMI_FABRIC_DIRECT is left undefined and amdsmi_wrap.h compiles its compat copies of the UALoE fabric types. On base images whose amd_smi/amdsmi.h now defines those types natively (ROCm 10.2.0 / TheRock main), the compat definitions collide with the real header and the topo_expl target fails to build, breaking the whole extra build. The main librccl build was unaffected because CMake probes with the plain compiler, which does not go through the HIP driver. This is not PR-specific: it fails identically on extra/rccl/develop and multiple unrelated PRs since the math-ci base-image bump to TheRock main. Fix: probe the fabric APIs the same way CMake does — compile a real temp file with the plain compiler (amdclang++, overridable via PROBE_CXX) instead of piping through hipcc's HIP driver. Both probes now agree with the CMake build. Testing: verified locally that the old hipcc probe returns 'no' (reproducing the misfire) and the new plain-compiler probe returns 'yes' for both the HIP and amdsmi fabric probes; `make -p` confirms FEATURE_DEFINES now includes -DAMDSMI_FABRIC_DIRECT. JIRA ID : AICOMRCCL-2359
The topo_expl tool bypasses RCCL's CMake configuration and reproduces the HIP/amdsmi fabric feature probes in its own Makefile. Those probes piped a snippet through hipcc's HIP driver mode. On recent ROCm toolchains hipcc's HIP driver pulls in cuda_wrappers/bits/c++config.h, which clashes with a recent system libstdc++ (redeclaration of __glibcxx_assert_fail). That makes the otherwise-valid probe fail; the '&& echo yes || echo no' guard swallows the error and returns 'no', so AMDSMI_FABRIC_DIRECT is left undefined and amdsmi_wrap.h compiles its compat copies of the UALoE fabric types. On base images whose amd_smi/amdsmi.h now defines those types natively (ROCm 10.2.0 / TheRock main), the compat definitions collide with the real header and the topo_expl target fails to build, breaking the whole extra build. The main librccl build was unaffected because CMake probes with the plain compiler, which does not go through the HIP driver. This is not PR-specific: it fails identically on extra/rccl/develop and multiple unrelated PRs since the math-ci base-image bump to TheRock main. Fix: probe the fabric APIs the same way CMake does — compile a real temp file with the plain compiler (amdclang++, overridable via PROBE_CXX) instead of piping through hipcc's HIP driver. Both probes now agree with the CMake build. Testing: verified locally that the old hipcc probe returns 'no' (reproducing the misfire) and the new plain-compiler probe returns 'yes' for both the HIP and amdsmi fabric probes; `make -p` confirms FEATURE_DEFINES now includes -DAMDSMI_FABRIC_DIRECT. JIRA ID : AICOMRCCL-2359
The topo_expl tool bypasses RCCL's CMake configuration and reproduces the HIP/amdsmi fabric feature probes in its own Makefile. Those probes piped a snippet through hipcc's HIP driver mode. On recent ROCm toolchains hipcc's HIP driver pulls in cuda_wrappers/bits/c++config.h, which clashes with a recent system libstdc++ (redeclaration of __glibcxx_assert_fail). That makes the otherwise-valid probe fail; the '&& echo yes || echo no' guard swallows the error and returns 'no', so AMDSMI_FABRIC_DIRECT is left undefined and amdsmi_wrap.h compiles its compat copies of the UALoE fabric types. On base images whose amd_smi/amdsmi.h now defines those types natively (ROCm 10.2.0 / TheRock main), the compat definitions collide with the real header and the topo_expl target fails to build, breaking the whole extra build. The main librccl build was unaffected because CMake probes with the plain compiler, which does not go through the HIP driver. This is not PR-specific: it fails identically on extra/rccl/develop and multiple unrelated PRs since the math-ci base-image bump to TheRock main. Fix: probe the fabric APIs the same way CMake does — compile a real temp file with the plain compiler (amdclang++, overridable via PROBE_CXX) instead of piping through hipcc's HIP driver. Both probes now agree with the CMake build. Testing: verified locally that the old hipcc probe returns 'no' (reproducing the misfire) and the new plain-compiler probe returns 'yes' for both the HIP and amdsmi fabric probes; `make -p` confirms FEATURE_DEFINES now includes -DAMDSMI_FABRIC_DIRECT. JIRA ID : AICOMRCCL-2359
The topo_expl tool bypasses RCCL's CMake configuration and reproduces the HIP/amdsmi fabric feature probes in its own Makefile. Those probes piped a snippet through hipcc's HIP driver mode. On recent ROCm toolchains hipcc's HIP driver pulls in cuda_wrappers/bits/c++config.h, which clashes with a recent system libstdc++ (redeclaration of __glibcxx_assert_fail). That makes the otherwise-valid probe fail; the '&& echo yes || echo no' guard swallows the error and returns 'no', so AMDSMI_FABRIC_DIRECT is left undefined and amdsmi_wrap.h compiles its compat copies of the UALoE fabric types. On base images whose amd_smi/amdsmi.h now defines those types natively (ROCm 10.2.0 / TheRock main), the compat definitions collide with the real header and the topo_expl target fails to build, breaking the whole extra build. The main librccl build was unaffected because CMake probes with the plain compiler, which does not go through the HIP driver.
This is not PR-specific: it fails identically on extra/rccl/develop and multiple unrelated PRs since the math-ci base-image bump to TheRock main.
Fix: probe the fabric APIs the same way CMake does — compile a real temp file with the plain compiler (amdclang++, overridable via PROBE_CXX) instead of piping through hipcc's HIP driver. Both probes now agree with the CMake build.
Testing: verified locally that the old hipcc probe returns 'no' (reproducing the misfire) and the new plain-compiler probe returns 'yes' for both the HIP and amdsmi fabric probes;
make -pconfirms FEATURE_DEFINES now includes -DAMDSMI_FABRIC_DIRECT.JIRA ID : AICOMRCCL-2359