Add SGLANG_CP_TRANSFER_LOG: decouple CP shared-KV transfer-partition dumps from debug flag
SGLANG_DEBUG_CP_SHARED_KV also disables tai IPC materialize -> NSA index fail-fast at warmup (unusable in this config). Add a logging-only flag that emits the sender/worker transfer-partition dumps (main-KV pages/positions vs NSA-state pages/positions) without that side effect, and lift the 64-log cap, so we can diff the state-vs-main-KV partition for a cache-hit vs cache-miss. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -43,8 +43,8 @@ logger = logging.getLogger(__name__)
|
||||
_CP_SHARED_DEBUG_COUNTS: dict[str, int] = {}
|
||||
|
||||
|
||||
def _cp_shared_debug_log(key: str, message: str, *args, limit: int = 64) -> None:
|
||||
if not envs.SGLANG_DEBUG_CP_SHARED_KV.get():
|
||||
def _cp_shared_debug_log(key: str, message: str, *args, limit: int = 1_000_000) -> None:
|
||||
if not (envs.SGLANG_DEBUG_CP_SHARED_KV.get() or envs.SGLANG_CP_TRANSFER_LOG.get()):
|
||||
return
|
||||
count = _CP_SHARED_DEBUG_COUNTS.get(key, 0)
|
||||
if count >= limit:
|
||||
@@ -1241,7 +1241,7 @@ class MooncakeKVManager(CommonKVManager):
|
||||
_np_summary(chunked_dst_kv_indice),
|
||||
kv_chunk.is_last_chunk,
|
||||
)
|
||||
if envs.SGLANG_DEBUG_CP_SHARED_KV.get():
|
||||
if envs.SGLANG_DEBUG_CP_SHARED_KV.get() or envs.SGLANG_CP_TRANSFER_LOG.get():
|
||||
_cp_shared_debug_log(
|
||||
"transfer_worker_kv",
|
||||
"transfer worker cp_rank=%s room=%s prefill_pages=%s "
|
||||
@@ -1350,7 +1350,7 @@ class MooncakeKVManager(CommonKVManager):
|
||||
req.dst_state_indices,
|
||||
kv_chunk.state_logical_page_positions,
|
||||
)
|
||||
if envs.SGLANG_DEBUG_CP_SHARED_KV.get():
|
||||
if envs.SGLANG_DEBUG_CP_SHARED_KV.get() or envs.SGLANG_CP_TRANSFER_LOG.get():
|
||||
_cp_shared_debug_log(
|
||||
"transfer_worker_state",
|
||||
"transfer worker state cp_rank=%s room=%s prefill_state_pages=%s "
|
||||
@@ -1731,7 +1731,7 @@ class MooncakeKVSender(CommonKVSender):
|
||||
)
|
||||
)
|
||||
index_slice = None
|
||||
if envs.SGLANG_DEBUG_CP_SHARED_KV.get():
|
||||
if envs.SGLANG_DEBUG_CP_SHARED_KV.get() or envs.SGLANG_CP_TRANSFER_LOG.get():
|
||||
_cp_shared_debug_log(
|
||||
"sender_filter",
|
||||
"sender filter cp_rank=%s room=%s page_start=%s orig_kv_pages=%s "
|
||||
|
||||
Reference in New Issue
Block a user