[Scheduler] Keep the running request's Mamba prefix checkpoint referenced until it finishes
In Mamba align mode a state block leaves the block table once the request has computed one block past it. When that block is hashed it is the request's prefix checkpoint, and releasing it let a long concurrent session evict it, so the next turn re-prefilled the whole conversation. The manager now keeps the newest hashed checkpoint referenced until the request finishes, and admission reserves that block. VLLM_E2_MAMBA_RETAIN_CHECKPOINT (default 1) switches it off. Scheduler tests cover eviction, admission, preemption and freeing. Co-Authored-By: Hinata <hinata@idihore.id> Signed-off-by: MOVZX <movzx@yahoo.com>
This commit is contained in:
+22
-3
@@ -450,6 +450,14 @@ if TYPE_CHECKING:
|
||||
# AOT: no. CAPTURE: no -- strictly host-side. off|warn|raise (1 = warn).
|
||||
# the mamba slot-ownership check, v1/worker/mamba_utils.py:74.
|
||||
VLLM_E2_MAMBA_SLOT_OWNERSHIP: str = "off"
|
||||
# v2.5: keep each running request's newest hashed align-mode Mamba
|
||||
# state (its prefix-cache checkpoint) referenced until the request ends,
|
||||
# instead of returning it to the free queue the moment decode passes it
|
||||
# (single_type_kv_cache_manager.MambaManager._retire_state_blocks). Strict
|
||||
# "0"/"1", default ON; "0" restores the old release-on-retire behaviour
|
||||
# for A/B. AOT: no. CAPTURE: no -- scheduler-side block bookkeeping only;
|
||||
# the worker sees the same block tables either way.
|
||||
VLLM_E2_MAMBA_RETAIN_CHECKPOINT: bool = True
|
||||
# Opt-out for the fork startup guards in vllm/v1/e2_guards.py, read at
|
||||
# Qwen4ExpForCausalLM construction. AOT: no. CAPTURE: no -- it changes
|
||||
# nothing itself; it only permits a boot whose identity IS different
|
||||
@@ -933,15 +941,17 @@ def _resolve_rust_cli_path() -> str | None:
|
||||
return raw
|
||||
|
||||
|
||||
def _e2_strict_switch(name: str) -> bool:
|
||||
def _e2_strict_switch(name: str, default: bool = False) -> bool:
|
||||
"""Parse a fork on/off switch that accepts exactly ``"0"`` and ``"1"``.
|
||||
|
||||
Unset means off. Anything else -- ``"true"``, ``"yes"``, ``""``, ``" 1"``,
|
||||
Unset means ``default`` (off unless the knob says otherwise). Anything else -- ``"true"``, ``"yes"``, ``""``, ``" 1"``,
|
||||
``"01"`` -- is a boot error: a switch that selects a different transport
|
||||
must not be satisfiable by a spelling nobody meant.
|
||||
"""
|
||||
raw = os.environ.get(name)
|
||||
if raw is None or raw == "0":
|
||||
if raw is None:
|
||||
return default
|
||||
if raw == "0":
|
||||
return False
|
||||
if raw == "1":
|
||||
return True
|
||||
@@ -2679,6 +2689,11 @@ environment_variables: dict[str, Callable[[], Any]] = {
|
||||
"VLLM_SKIP_VERSION_SUFFIX": lambda: bool(
|
||||
int(os.getenv("VLLM_SKIP_VERSION_SUFFIX", "0"))
|
||||
),
|
||||
# Mamba prefix-checkpoint retention (v2.5; default ON, "0" turns it off).
|
||||
# Strict "0"/"1"; read when each MambaManager is constructed.
|
||||
"VLLM_E2_MAMBA_RETAIN_CHECKPOINT": lambda: _e2_strict_switch(
|
||||
"VLLM_E2_MAMBA_RETAIN_CHECKPOINT", default=True
|
||||
),
|
||||
# Seconds between `topk-exact-counters` lines from each GPU worker
|
||||
# (0, the default, disables the reader entirely). The line reports the
|
||||
# medium-path exact-restart counters; see
|
||||
@@ -2930,6 +2945,10 @@ def compile_factors() -> dict[str, object]:
|
||||
# configuration factor and is hashed conservatively.
|
||||
"VLLM_E2_PLE_FLAG_CHECK",
|
||||
"VLLM_E2_MAMBA_SLOT_OWNERSHIP",
|
||||
# Scheduler-side block retention (v2.5). The scheduler is never
|
||||
# compiled and the worker's tables are identical in both worlds, so an
|
||||
# A/B flip must reuse the same AOT cache.
|
||||
"VLLM_E2_MAMBA_RETAIN_CHECKPOINT",
|
||||
# Logging cadence for an already-compiled kernel's counters: it gates a
|
||||
# host-side timer and a snapshot op, and is read by no compiled code, so
|
||||
# hashing it would invalidate every compile cache for a log interval.
|
||||
|
||||
Reference in New Issue
Block a user