Skip to content

fix(rccl): add weak stubs for ppc64le TOC-surviving symbols - #14913

Merged
erman-gurses merged 1 commit into
developfrom
users/benrichard-amd/rccl-ppc64le-toc-stubs
Nov 5, 2026
Merged

erman-gurses merged 1 commit into
developfrom
users/benrichard-amd/rccl-ppc64le-toc-stubs

Conversation

@benrichard-amd

Copy link
Copy Markdown
Contributor

Motivation

Part of work for ROCm/TheRock#5518

Replaces #13502 which is now stale (upstream changes caused conflicts and a duplicate symbol).

On ppc64le, the POWER ABI's TOC (Table of Contents) keeps references to extern symbols alive through --gc-sections, even when the code path referencing them is dead. This causes undefined-symbol link errors in host-only micro test binaries that link production source files (topo.cc, rome_models.cc) but not the GPU/network libraries that provide the symbols.

Technical Details

Add weak stub definitions guarded by __powerpc64__ / __PPC64__ in two test fake files:

nccl_fakes.cc: topoPathTypeStr[] (referenced by rome_models.cc). Guarded by RCCL_NCCL_FAKES_OMIT_GRAPH so it only applies when the graph fakes are excluded (e.g. rccl-UnitTestsMicroGraph).

transport_stubs.cc: Plugin device-count and network functions referenced as function pointers in topo.cc:

  • ncclNetIb_devices, ncclNetGdrCopy_devices, ncclNetSocket_devices
  • ncclGinDeviceCount, ncclGinCustomAllReduceDeviceCount
  • ncclNetGetDevCount, ncclCollNetGetDevCount, ncclGinGetDevCount, ncclRmaGetDevCount
  • ncclNetSetVirtDevCount, ncclCollNetSetVirtDevCount

All stubs use __attribute__((weak)) so tests that supply their own strong definitions (e.g. gin-plugin-init-test, graph_fakes.cc) win without duplicate-symbol errors.

x86_64 builds are unaffected — the #if defined(__powerpc64__) guard ensures the stubs are only compiled on POWER.

Test Plan

Built RCCL on a POWER10 ppc64le machine via TheRock. Ran the host microtest suites (ctest -R "Micro|HostOnly|MicroTopo").

Test Result

All micro test binaries link and run. 137/153 ctest targets pass. Remaining failures are pre-existing and unrelated (divide-by-zero death test on POWER, groupJob logic bug).

…ests

On ppc64le, TOC references to extern symbols survive --gc-sections even
when the code path referencing them is dead. Add weak stub definitions
for topoPathTypeStr, network device-count functions, and GIN plugin
functions so host-only test binaries link without GPU/network libraries.

Co-Authored-By: Claude <noreply@anthropic.com>
@benrichard-amd
benrichard-amd requested review from a team November 3, 2026 14:56
@therock-pr-bot

therock-pr-bot Bot commented Nov 3, 2026

Copy link
Copy Markdown

✅ All Policy Checks Passed

Check Status Details
📝 PR Description ✅ Pass —
⛔ Forbidden Files ✅ Pass —
🧪 Unit Test ⚠️ Warning Error: Source/code files changed without an accompanying unit test.
Expected: add at least one test file named like test_<name>.py / test_<name>.cpp (or <name>_test.*).
Current: code file(s) changed: projects/rccl/test/host/fakes/nccl_fakes.cc, projects/rccl/test/host/fakes/transport_stubs.cc; no test file found
🚫 Draft PR 🔜 To Be Enabled —
🚩 Feature Flag 🔜 To Be Enabled —
📊 Code Coverage 🔜 To Be Enabled —

🎉 All policy checks passed!

📖 Need help? See the Policy FAQ for details on every check and how to fix failures.

🙋 Wish to Override Policy?

@amd-argus amd-argus Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ARGUS

Findings

3 more finding(s), not posted inline
  • projects/rccl/test/host/fakes/nccl_fakes.cc:658 (Low) #ifndef RCCL_NCCL_FAKES_OMIT_GRAPH excludes MicroGraph, the opposite of the description, and every other binary using topoPathTypeStr already links a strong copy, so this weak copy looks unused; drop it or name the target that needs it.
  • projects/rccl/test/host/fakes/transport_stubs.cc:389 (Low) The five extern "C" stubs (ncclNetIb_devices and the rest) name symbols nothing in projects/rccl references, topo.cc included; remove the block.
  • projects/rccl/test/host/fakes/transport_stubs.cc:399 (Low) Dev-count stubs return success with 0 devices in a fail-loud stub file (lines 7-11), and lines 394-397 exceed 120 columns; call FailLoudUnfaked instead.

Bottom line: Looks approval ready; the inline notes are small cleanups to the new ppc64le stubs.

Comment @argus review to re-run, or @argus re-review after pushing.

// topo.cc stores ncclNetGetDevCount / ncclGinGetDevCount / etc. as function
// pointers in netInfo; the TOC entry survives --gc-sections on POWER even
// when the code path is dead. Weak stubs let MicroGraph (which links the
// real topo.cc but not graph_fakes.cc) resolve them.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Low

Lines 390-393 restate the TOC note at lines 375-379, so they can go.

Suggested change
// real topo.cc but not graph_fakes.cc) resolve them.

@erman-gurses
erman-gurses merged commit 69606e6 into develop Nov 5, 2026
94 of 101 checks passed
@erman-gurses
erman-gurses deleted the users/benrichard-amd/rccl-ppc64le-toc-stubs branch November 5, 2026 21:38
@systems-assistant

Copy link
Copy Markdown
Contributor

TheRock Submodule Bump Activity

Newest first

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants