From 5d1b22ab3d7ad6c953000f2dc939ef01408c6483 Mon Sep 17 00:00:00 2001 From: Scott Cutler Date: Mon, 4 May 2026 20:15:22 -0700 Subject: [PATCH] allreduce: assert n_backends == 2 instead of soft-fallback ar_pipeline_init already requires n_devices == 2 and bails before any AR can get here, so by the time we reach try_allreduce_internal we know we have exactly two backends. Replace the runtime-debug-log fallback with a hard assert. Co-Authored-By: Claude Opus 4.7 (1M context) NCCL is in use. Co-Authored-By: Claude Opus 4.7 (1M context) --- ggml/src/ggml-cuda/ggml-cuda.cu | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/ggml/src/ggml-cuda/ggml-cuda.cu b/ggml/src/ggml-cuda/ggml-cuda.cu index 826977e77d..e9233a3e96 100644 --- a/ggml/src/ggml-cuda/ggml-cuda.cu +++ b/ggml/src/ggml-cuda/ggml-cuda.cu @@ -1287,10 +1287,7 @@ static bool ggml_backend_cuda_comm_try_allreduce_internal( const int64_t ne = ggml_nelements(tensors[0]); const ggml_type type = tensors[0]->type; - if (n_backends != 2) { - GGML_LOG_DEBUG("%s: internal unsupported: n_backends=%zu\n", __func__, n_backends); - return false; - } + GGML_ASSERT(n_backends == 2); if (type != GGML_TYPE_F32 && type != GGML_TYPE_F16 && type != GGML_TYPE_BF16) { GGML_LOG_DEBUG("%s: internal unsupported: type=%d\n", __func__, (int) type); return false;