From 9d9dcd23ce4358ae2369eee09f3cedd6ef24dd85 Mon Sep 17 00:00:00 2001 From: Ziyue Yang Date: Thu, 27 Jul 2023 04:24:49 +0800 Subject: [PATCH] Fix MSCCL proxy number of chunks calculation (#821) Current number of transmissions parsed from MSCCL algorithm is 1-based value, but when calculating proxy number of chunks, it's taken as 0-based value. This commit fixes this issue. [ROCm/rccl commit: f7dc7b7e6a35b4cb09e31eaeaec6cbbe050997a7] --- projects/rccl/src/misc/msccl/msccl_parser.cc | 2 +- projects/rccl/src/misc/msccl/msccl_setup.cc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/rccl/src/misc/msccl/msccl_parser.cc b/projects/rccl/src/misc/msccl/msccl_parser.cc index 423593b8f2..e810682a12 100644 --- a/projects/rccl/src/misc/msccl/msccl_parser.cc +++ b/projects/rccl/src/misc/msccl/msccl_parser.cc @@ -658,7 +658,7 @@ ncclResult_t mscclGetAlgoFromXmlFile(const char* str, struct mscclAlgo* algo, in // finish up mscclChannel calculation - for (int c = 0; c < MSCCL_MAX_COUNT; c++) { + for (int c = 1; c <= MSCCL_MAX_COUNT; c++) { struct mscclChannelPeerInfo* sendPeer = &mscclChannel->sendPeerInfo[mscclChannel->nSendPeers]; if (sendPeer->nTransmissionsOfCount[c] > 0) { sendPeer->existingCounts[sendPeer->nExistingCounts] = c; diff --git a/projects/rccl/src/misc/msccl/msccl_setup.cc b/projects/rccl/src/misc/msccl/msccl_setup.cc index c8ddbe477c..947b1b7ba3 100644 --- a/projects/rccl/src/misc/msccl/msccl_setup.cc +++ b/projects/rccl/src/misc/msccl/msccl_setup.cc @@ -118,7 +118,7 @@ ncclResult_t mscclSetupProxy(struct mscclAlgo* hostAlgo, ncclComm_t comm) { int nRecvs = 0; for (int j = 0; j < recvPeer->nExistingCounts; j++){ int c = recvPeer->existingCounts[j]; - int nStepsInCount = DIVUP(c+1, status.maxAllowedCount); + int nStepsInCount = DIVUP(c, status.maxAllowedCount); nRecvs += recvPeer->nTransmissionsOfCount[c] * nStepsInCount; } proxyOp.nsteps = nLoopsChunkSteps * nRecvs; @@ -131,7 +131,7 @@ ncclResult_t mscclSetupProxy(struct mscclAlgo* hostAlgo, ncclComm_t comm) { int nSends = 0; for (int j = 0; j < sendPeer->nExistingCounts; j++){ int c = sendPeer->existingCounts[j]; - int nStepsInCount = DIVUP(c+1, status.maxAllowedCount); + int nStepsInCount = DIVUP(c, status.maxAllowedCount); nSends += sendPeer->nTransmissionsOfCount[c] * nStepsInCount; } proxyOp.nsteps = nLoopsChunkSteps * nSends;