Skip to content

Commit 16cd393

Browse files
youkaichaoshreyankg
authored andcommitted
[sleep mode] error out with expandable_segments (vllm-project#14189)
Signed-off-by: youkaichao <[email protected]>
1 parent c9189cd commit 16cd393

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

vllm/device_allocator/cumem.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
# not sure why, they are created from a different context.
99
# the only successful approach is to call cuda driver API in C.
1010
import dataclasses
11+
import os
1112
from contextlib import contextmanager
1213
from typing import Any, Callable, Dict, Optional, Tuple, Union
1314

@@ -140,6 +141,12 @@ def get_instance() -> "CuMemAllocator":
140141
return CuMemAllocator.instance
141142

142143
def __init__(self):
144+
conf = os.environ.get("PYTORCH_CUDA_ALLOC_CONF", "")
145+
assert "expandable_segments:True" not in conf, \
146+
("Expandable segments are not compatible with memory pool. "
147+
"Please track https://github.com/pytorch/pytorch/issues/147851 "
148+
"for the latest updates.")
149+
143150
self.pointer_to_data: Dict[int, AllocationData] = {}
144151
self.current_tag: str = CuMemAllocator.default_tag
145152
self.allocator_and_pools: Dict[str, Any] = {}

0 commit comments

Comments
 (0)