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
23 changes: 16 additions & 7 deletions python/sglang/srt/arg_groups/fields/memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,17 +177,26 @@ class Memory(msgspec.Struct):
int,
Arg(
help=(
"Scheduling passes a queued request waits after a storage "
"prefetch miss before the availability check is retried "
"(under load the first check can run before the needed "
"backup commits). 0 disables retries."
"Scheduling passes a queued request waits before its storage "
"availability check is re-issued, when the prefetch found "
"nothing and a backup may still be committing (under load the "
"first check can run before it does). A re-issue that waits on "
"staging or a moved match instead goes out on the next pass. "
"Only passes that reach prefill scheduling count. 0 disables "
"miss retries; known-hit deferrals are always re-issued."
),
),
] = 0
] = 8
hicache_storage_prefetch_retry_max_attempts: A[
int,
"Maximum storage prefetch retries per request when --hicache-storage-prefetch-retry-poll-interval is set.",
] = 4
Arg(
help=(
"Storage availability re-issues a queued request may make, paced "
"miss polls and immediate re-issues alike; past the cap it is "
"admitted with whatever the device holds. 0 disables re-issues."
),
),
] = 8

# -------------------------------------------------------------------------
# Unified Radix Cache
Expand Down
1 change: 1 addition & 0 deletions python/sglang/srt/disaggregation/prefill.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,7 @@ def get_next_disagg_prefill_batch_to_run(
last_batch: Optional[ScheduleBatch],
) -> NextBatchPlan:
self.process_pending_chunked_abort()
self._process_hicache_events()

# HACK (byronhsu): reset the batch_is_full flag because we never enter update_running_batch which resets it
# Otherwise, it hangs under high concurrency
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ def build_hicache_transfers(
host_indices: Optional[torch.Tensor] = None,
token_ids: Optional[Sequence[int]] = None,
prefetch_tokens: int = 0,
staging_tokens: int = 0,
last_hash: Optional[str] = None,
) -> Optional[list[PoolTransfer]]:
ct = self.component_type
Expand Down
9 changes: 5 additions & 4 deletions python/sglang/srt/managers/schedule_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@
from sglang.srt.configs.model_config import ModelConfig
from sglang.srt.managers.hisparse_coordinator import HiSparseCoordinator
from sglang.srt.managers.scheduler_components.metrics_reporter import PrefillStats
from sglang.srt.mem_cache.storage_prefetch import StagedPrefetchPlan
from sglang.srt.session.session_controller import Session
from sglang.srt.speculative.spec_info import SpecInput, SpeculativeAlgorithm

Expand Down Expand Up @@ -1127,14 +1128,14 @@ def __init__(
self.host_loaded_length = 0
# Buffer-mode host memory is transport staging, not an L2 cache tier.
self.host_hit_is_storage = False
# Storage prefetch retry state while queued
# (see Scheduler._retry_missed_storage_prefetches).
self.storage_prefetch_retry_pending = False
self.storage_prefetch_retry_wait_polls = 0
self.storage_prefetch_retry_attempts = 0
self.staged_prefetch_plan: Optional[StagedPrefetchPlan] = None
# Receipt of the tree lock held on last_node (anchor, SWA boundary,
# skipped components); every release replays it unchanged.
self.lock_receipt: DecLockRefParams = DecLockRefParams()
# Device/host prefix used to plan the latest L3 lookup. Admission uses
# it to detect newly exposed storage demand after queue-time eviction.
self.storage_prefetch_last_match_len: Optional[int] = None
# Whether the prefill-time SWA tree lock has been released early
self.swa_prefix_lock_released: bool = False
# Logical-page KV sharding: rotation base of the chain this request
Expand Down
Loading
Loading