Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions python/sglang/srt/environ.py
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,7 @@ class Envs:
SGLANG_HICACHE_HOST_REGISTER_CHUNK_GB = EnvInt(256)
SGLANG_HICACHE_HF3FS_CONFIG_PATH = EnvStr(None)
SGLANG_HICACHE_DECODE_OFFLOAD_STRIDE = EnvInt(None)
SGLANG_HICACHE_SKIP_HOST_DUPLICATE_RECLAIM = EnvBool(False)
SGLANG_HICACHE_FILE_BACKEND_STORAGE_DIR = EnvStr(None)
# File-backend LRU eviction (opt-in; sizes accept SI/IEC suffixes, "0" disables).
SGLANG_HICACHE_FILE_BACKEND_MAX_SIZE = EnvStr(None)
Expand Down
10 changes: 8 additions & 2 deletions python/sglang/srt/mem_cache/unified_cache/unified_tree_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import torch

from sglang.srt.disaggregation.kv_events import StorageMedium
from sglang.srt.environ import envs
from sglang.srt.mem_cache.base_prefix_cache import (
DecLockRefParams,
DecLockRefResult,
Expand Down Expand Up @@ -1490,11 +1491,16 @@ def drive_host_eviction(
self, component_type: ComponentType, num_tokens: int
) -> DriveHostEvictionResult:
"""Evict a component's host-side resources; no-op if absent. Under
write_back, FULL pressure reclaims redundant Full host copies first."""
write_back, FULL pressure reclaims redundant Full host copies first
(skipped if SGLANG_HICACHE_SKIP_HOST_DUPLICATE_RECLAIM=1)."""
result = DriveHostEvictionResult()
comp = self.components_by_type.get(component_type)
if comp is not None:
if self.is_write_back and component_type == BASE_COMPONENT_TYPE:
if (
not envs.SGLANG_HICACHE_SKIP_HOST_DUPLICATE_RECLAIM.get()
and self.is_write_back
and component_type == BASE_COMPONENT_TYPE
):
self._reclaim_full_host_duplicates(
num_tokens,
result.tracker,
Expand Down
Loading