[misc] Rename SGLANG_OPT_SWA_RELEASE_LEAF_LOCK_AFTER_WINDOW to SGLANG_OPT_RELEASE_PREFILL_SWA (#42657)

This commit is contained in:
Liangsheng Yin
2026-10-05 17:24:15 -07:00
committed by GitHub
parent 4409d2fd22
commit f3fe753475
4 changed files with 12 additions and 11 deletions
+5 -1
View File
@@ -691,7 +691,11 @@ class Envs:
# - Source builds with a missing or unusable Rust toolchain.
# This also applies when Rust is explicitly selected.
SGLANG_UNIFIED_RADIX_TREE_CORE_BACKEND = EnvStr("rust")
SGLANG_OPT_SWA_RELEASE_LEAF_LOCK_AFTER_WINDOW = EnvBool(False)
# Once decode passes the sliding window, drop the SWA part of the prefill's
# tree lock; its SWA KV becomes evictable rather than freed.
SGLANG_OPT_RELEASE_PREFILL_SWA = EnvBoolWithAlias(
False, deprecated_name="SGLANG_OPT_SWA_RELEASE_LEAF_LOCK_AFTER_WINDOW"
)
# ===================================================================
# PD disaggregation runtime
+4 -7
View File
@@ -3919,9 +3919,8 @@ class ScheduleBatch(ScheduleBatchDisaggregationDecodeMixin):
# Auxiliary windows check their own cursors and prefix locks.
has_auxiliary_swa = self.tree_cache.supports_auxiliary_swa()
release_leaf_lock = (
envs.SGLANG_OPT_SWA_RELEASE_LEAF_LOCK_AFTER_WINDOW.get()
and hasattr(self.tree_cache, "dec_swa_lock_only")
release_leaf_lock = envs.SGLANG_OPT_RELEASE_PREFILL_SWA.get() and hasattr(
self.tree_cache, "dec_swa_lock_only"
)
eviction_interval = max(1, envs.SGLANG_SWA_EVICTION_INTERVAL.get())
@@ -3949,10 +3948,8 @@ class ScheduleBatch(ScheduleBatchDisaggregationDecodeMixin):
),
)
# Once the decode position has moved past the sliding window,
# the SWA portion of the prefill-time tree lock is no longer
# needed by this request. Convert it from protected to
# evictable so SWA LRU can reclaim it under pressure.
# Past the window the request no longer reads its prefill's SWA;
# release that part of the tree lock so SWA LRU can reclaim it.
if (
release_leaf_lock
and not req.swa_prefix_lock_released