From 8dc1573e7b7e7fbd0677666a9cbcbc40ae640b8a Mon Sep 17 00:00:00 2001 From: EylonKrause Date: Fri, 26 Jun 2026 20:20:24 +0300 Subject: [PATCH] init: do not reject a config that sets only minCTAs or only maxCTAs The min/maxCTAs validation in parseCommConfig guards the <=0 checks with NCCL_CONFIG_UNDEF_INT but the minCTAs>maxCTAs check does not. Since unset fields are NCCL_CONFIG_UNDEF_INT (INT_MIN), setting only minCTAs (maxCTAs left unset) makes minCTAs>maxCTAs (>INT_MIN) true, so a valid config is rejected with ncclInvalidArgument. Guard the comparison with the same UNDEF checks used by the sibling clauses. Signed-off-by: EylonKrause --- src/init.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/init.cc b/src/init.cc index 0c4554b893..f417354b49 100644 --- a/src/init.cc +++ b/src/init.cc @@ -2324,7 +2324,8 @@ static ncclResult_t parseCommConfig(ncclComm_t comm, ncclConfig_t* config) { if ((internalConfigPtr->minCTAs != NCCL_CONFIG_UNDEF_INT && internalConfigPtr->minCTAs <= 0) || (internalConfigPtr->maxCTAs != NCCL_CONFIG_UNDEF_INT && internalConfigPtr->maxCTAs <= 0) || - (internalConfigPtr->minCTAs > internalConfigPtr->maxCTAs)) { + (internalConfigPtr->minCTAs != NCCL_CONFIG_UNDEF_INT && internalConfigPtr->maxCTAs != NCCL_CONFIG_UNDEF_INT && + internalConfigPtr->minCTAs > internalConfigPtr->maxCTAs)) { WARN("Invalid config min/max channels attribute value %d/%d", internalConfigPtr->minCTAs, internalConfigPtr->maxCTAs); ret = ncclInvalidArgument;