[Core] Make sleep-mode backend capability flags communicator-agnostic (#47243)

This commit is contained in:
Nils Matteson
2026-07-01 07:17:44 +00:00
committed by GitHub
parent 4470ae84de
commit a461070d1c
2 changed files with 15 additions and 14 deletions
+5 -5
View File
@@ -23,13 +23,13 @@ def test_cumem_is_the_default_registered_backend():
def test_cumem_capability_flags():
# cumem leaves NCCL untouched but does not preserve compiled artifacts,
# graphs, or durable state - these flags are what the executor and /health
# introspect to decide reinit / persistence behavior.
# cumem leaves communicators untouched but does not preserve compiled
# artifacts, graphs, or durable state - these flags are what the executor and
# /health introspect to decide reinit / persistence behavior.
assert CuMemBackend.is_supported() is True
assert CuMemBackend.preserves_nccl() is True
assert CuMemBackend.preserves_communicators() is True
assert CuMemBackend.preserves_compiled_artifacts() is False
assert CuMemBackend.preserves_graphs_with_nccl() is False
assert CuMemBackend.preserves_graphs_with_communicators() is False
assert CuMemBackend.supports_durable_storage() is False
+10 -9
View File
@@ -81,9 +81,9 @@ class SleepModeBackend(ABC):
return True
@classmethod
def preserves_nccl(cls) -> bool:
"""If False, NCCL communicators are destroyed by ``suspend`` and the
executor must re-initialize them on ``resume``."""
def preserves_communicators(cls) -> bool:
"""If False, collective communicators (e.g. NCCL) are destroyed by
``suspend`` and the executor must re-initialize them on ``resume``."""
return False
@classmethod
@@ -93,9 +93,10 @@ class SleepModeBackend(ABC):
return False
@classmethod
def preserves_graphs_with_nccl(cls) -> bool:
"""If True, CUDA graphs containing NCCL collectives stay valid after
resume. False when NCCL is rebuilt (embedded comm handles go stale)."""
def preserves_graphs_with_communicators(cls) -> bool:
"""If True, CUDA graphs containing collective communicators (e.g. NCCL)
stay valid after resume. False when communicators are rebuilt (embedded
comm handles go stale)."""
return False
@classmethod
@@ -132,9 +133,9 @@ class CuMemBackend(SleepModeBackend):
self._state = "RUNNING"
@classmethod
def preserves_nccl(cls) -> bool:
# NCCL buffers live outside CuMemAllocator's pool, so an allocator-level
# sleep leaves the communicators intact (no reinit needed on resume).
def preserves_communicators(cls) -> bool:
# Communicator buffers (e.g. NCCL) live outside CuMemAllocator's pool, so
# an allocator-level sleep leaves them intact (no reinit needed on resume).
return True