Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions projects/rccl/src/gin/gin_plugin_anvil_sdma.cc
Original file line number Diff line number Diff line change
Expand Up @@ -723,14 +723,21 @@ static ncclResult_t ginAnvilRegisterLsaSignals(ginAnvilGinCtx* ctx, void* lsaSel
(unsigned long)hostAddrs[ctx->rank], (unsigned long)selfExpected, (unsigned long)lsaSelf, (long)stride);
}

uintptr_t* gatheredLocalBases = (uintptr_t*)calloc((size_t)ctx->nRanks, sizeof(uintptr_t));
// bootstrapAllGather writes one slot per world rank (bootstrap state->nranks).
// Under NCCL_GIN_CONNECTION_RAIL, ctx->nRanks/ctx->rank are the GIN team, so a
// team-sized buffer is overrun and the local VA must be published at comm->rank.
const int worldRanks = comm->nRanks;
uintptr_t* gatheredLocalBases =
(worldRanks > 0) ? (uintptr_t*)calloc((size_t)worldRanks, sizeof(uintptr_t)) : nullptr;
if (gatheredLocalBases) {
gatheredLocalBases[ctx->rank] = (uintptr_t)lsaSelf;
if (ginAnvilBootstrapAllgather(comm->bootstrap, gatheredLocalBases, sizeof(uintptr_t)) != 0) {
WARN("GIN anvil-sdma: signal local-base allgather failed");
} else if (gatheredLocalBases[ctx->rank] != (uintptr_t)lsaSelf) {
WARN("GIN anvil-sdma: signal local-base allgather mismatch rank=%d got=%#lx expect=%#lx", ctx->rank,
(unsigned long)gatheredLocalBases[ctx->rank], (unsigned long)lsaSelf);
if (comm->rank >= 0 && comm->rank < worldRanks) {
gatheredLocalBases[comm->rank] = (uintptr_t)lsaSelf;
if (ginAnvilBootstrapAllgather(comm->bootstrap, gatheredLocalBases, sizeof(uintptr_t)) != 0) {

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.

Medium

No test can observe this fix: the stub bootstrapAllGather at gin_anvil_plugin_test_stubs.cc:103 returns early for any element size other than sizeof(int), and this call passes sizeof(uintptr_t), so rccl-UnitTestsGinAnvilPlugin passes bit-identically with the fix reverted. ConnCheck_SkippedOnRailConnection at GinAnvilPlugin_test.cpp:526 already builds comm->rank=1 against ctx->rank=0, so the divergence is one fixture away. Could the stub record the buffer and size, the way bootstrapIntraNodeAllGather already records ranks at gin_anvil_plugin_test_stubs.cc:144, so the published slot becomes assertable?

WARN("GIN anvil-sdma: signal local-base allgather failed");
} else if (gatheredLocalBases[comm->rank] != (uintptr_t)lsaSelf) {
WARN("GIN anvil-sdma: signal local-base allgather mismatch rank=%d got=%#lx expect=%#lx", comm->rank,
(unsigned long)gatheredLocalBases[comm->rank], (unsigned long)lsaSelf);
}
}

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.

Nit

Suggested change
}
uintptr_t* gatheredLocalBases = (uintptr_t*)calloc((size_t)comm->nRanks, sizeof(uintptr_t));
if (gatheredLocalBases) {
gatheredLocalBases[comm->rank] = (uintptr_t)lsaSelf;
if (ginAnvilBootstrapAllgather(comm->bootstrap, gatheredLocalBases, sizeof(uintptr_t)) != 0) {
WARN("GIN anvil-sdma: signal local-base allgather failed");
} else if (gatheredLocalBases[comm->rank] != (uintptr_t)lsaSelf) {
WARN("GIN anvil-sdma: signal local-base allgather mismatch rank=%d got=%#lx expect=%#lx", comm->rank,
(unsigned long)gatheredLocalBases[comm->rank], (unsigned long)lsaSelf);
}

free(gatheredLocalBases);
}
Expand Down
Loading