From 892b2e388d61e48d9b35b56f312653151b9c0176 Mon Sep 17 00:00:00 2001 From: Scott Cutler Date: Fri, 24 Apr 2026 14:38:06 -0700 Subject: [PATCH] minor simplifications --- ggml/src/ggml-cuda/allreduce.cu | 1 - ggml/src/ggml-cuda/allreduce.cuh | 5 +++-- ggml/src/ggml-cuda/ggml-cuda.cu | 7 +------ 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/ggml/src/ggml-cuda/allreduce.cu b/ggml/src/ggml-cuda/allreduce.cu index 4a72d91899..f5f3c53dd1 100644 --- a/ggml/src/ggml-cuda/allreduce.cu +++ b/ggml/src/ggml-cuda/allreduce.cu @@ -520,7 +520,6 @@ bool ggml_cuda_ar_allreduce( } const size_t max_chunk_elems = p->buf_bytes / type_size; - GGML_ASSERT(max_chunk_elems > 0); // Insert chunked kernels into each GPU's existing compute stream via events: // record(app, compute_stream) — capture "upstream done" diff --git a/ggml/src/ggml-cuda/allreduce.cuh b/ggml/src/ggml-cuda/allreduce.cuh index a30a4f8c28..fbf1152179 100644 --- a/ggml/src/ggml-cuda/allreduce.cuh +++ b/ggml/src/ggml-cuda/allreduce.cuh @@ -14,8 +14,9 @@ struct ggml_cuda_ar_pipeline; // Allocate a pipeline for n_devices GPUs. // devices[] holds the CUDA device IDs in rank order. -// max_bytes is the staging buffer size per device; must be at least as large -// as the largest tensor that will be reduced. +// max_bytes is the staging buffer size per device, which also bounds the +// per-launch chunk size; tensors larger than this are reduced via multiple +// chunked launches. // Returns nullptr on allocation failure. ggml_cuda_ar_pipeline * ggml_cuda_ar_pipeline_init( const int * devices, size_t n_devices, size_t max_bytes); diff --git a/ggml/src/ggml-cuda/ggml-cuda.cu b/ggml/src/ggml-cuda/ggml-cuda.cu index 6b6ca822a9..9bec84551b 100644 --- a/ggml/src/ggml-cuda/ggml-cuda.cu +++ b/ggml/src/ggml-cuda/ggml-cuda.cu @@ -1327,11 +1327,6 @@ static bool ggml_backend_cuda_comm_allreduce_nccl( } #endif // GGML_USE_NCCL -static bool ggml_backend_cuda_comm_allreduce_internal( - ggml_backend_cuda_comm_context * comm_ctx, struct ggml_tensor ** tensors) { - return ggml_cuda_ar_allreduce(comm_ctx->ar_pipeline, comm_ctx->backends.data(), tensors); -} - enum ggml_cuda_comm_allreduce_result { GGML_CUDA_COMM_ALLREDUCE_SUCCESS, GGML_CUDA_COMM_ALLREDUCE_UNSUPPORTED, @@ -1389,7 +1384,7 @@ static ggml_cuda_comm_allreduce_result ggml_backend_cuda_comm_try_allreduce_inte } } - return ggml_backend_cuda_comm_allreduce_internal(comm_ctx, tensors) + return ggml_cuda_ar_allreduce(comm_ctx->ar_pipeline, comm_ctx->backends.data(), tensors) ? GGML_CUDA_COMM_ALLREDUCE_SUCCESS : GGML_CUDA_COMM_ALLREDUCE_FAILED; }