[Core] Release NCCL communicator memory in sleep mode (#51485)
Signed-off-by: aoshen02 <aoshen02@users.noreply.github.com> Co-authored-by: aoshen02 <aoshen02@users.noreply.github.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
aoshen02
Claude Fable 5
parent
ec32f669bb
commit
4ac452ad98
@@ -27,6 +27,8 @@ logger = init_logger(__name__)
|
||||
|
||||
_NCCL_SYMM_OPS_REGISTERED = False
|
||||
|
||||
_NCCL_SUSPEND_MEM = 0x01
|
||||
|
||||
|
||||
def register_nccl_symmetric_ops(pynccl_comm):
|
||||
from vllm.distributed.device_communicators.pynccl_allocator import (
|
||||
@@ -105,6 +107,7 @@ class PyNcclCommunicator:
|
||||
|
||||
self.available = True
|
||||
self.disabled = False
|
||||
self._suspended = False
|
||||
|
||||
self.nccl_version = self.nccl.ncclGetRawVersion()
|
||||
if self.rank == 0:
|
||||
@@ -479,6 +482,27 @@ class PyNcclCommunicator:
|
||||
def deregister_comm_window(self, window):
|
||||
return self.nccl.ncclCommWindowDeregister(self.comm, window)
|
||||
|
||||
def suspend(self):
|
||||
"""Release comm GPU memory (collective, idempotent); keeps topology."""
|
||||
if self.disabled or self._suspended:
|
||||
return
|
||||
if not self.nccl.has_symbol("ncclCommSuspend"):
|
||||
logger.warning_once(
|
||||
"ncclCommSuspend is not available in the loaded NCCL/RCCL "
|
||||
"library (requires NCCL >= 2.29.7); skipping communicator "
|
||||
"memory suspension."
|
||||
)
|
||||
return
|
||||
self.nccl.ncclCommSuspend(self.comm, _NCCL_SUSPEND_MEM)
|
||||
self._suspended = True
|
||||
|
||||
def resume(self):
|
||||
"""Restore a suspended comm (collective); no-op unless suspended."""
|
||||
if self.disabled or not self._suspended:
|
||||
return
|
||||
self.nccl.ncclCommResume(self.comm)
|
||||
self._suspended = False
|
||||
|
||||
def batch_isend_irecv(self, p2p_ops: list, stream=None):
|
||||
if self.disabled:
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user