Remove temporary CP cache-hit trace instrumentation
The GSM8K/cache-hit debugging pass added request-correlation logs across scheduler, radix, HiCache, Mooncake, and prefill handoff. The root cause work has moved to request-slot remap semantics, so those high-cardinality traces are no longer needed in the runtime diff. This removes the temporary tracing helpers and call sites while leaving existing fail-fast checks, fallback warnings, and explicit debug/timing infrastructure that is still part of normal CP shared-KV diagnostics. Constraint: Production CP hot paths should not carry investigation-only request signatures or transfer summaries Rejected: Keep all debug logs gated by env | even gated logs increase maintenance surface and encourage stale diagnosis paths Confidence: high Scope-risk: moderate Directive: Reintroduce request-correlation logs only as a narrow opt-in probe with a planned removal point Tested: Local py_compile for touched runtime files; remote py_compile; remote pytest test_cp_shared_kv_runtime.py, test_nsa_cp_utils.py, test_cp_shared_kv_layout.py => 263 passed, 5 warnings, 2 subtests passed Not-tested: Long-running ETE log-volume comparison after removal
This commit is contained in:
@@ -64,21 +64,6 @@ def _cp_draft_shared_kv_debug(message: str, *args, limit: int = 64) -> None:
|
||||
logger.info("[CP_DRAFT_SHARED_KV] " + message, *args)
|
||||
|
||||
|
||||
def _cp_shared_kv_bs_gt1_mooncake_debug(
|
||||
key: str, message: str, *args, limit: Optional[int] = None
|
||||
) -> None:
|
||||
if not envs.SGLANG_CP_SHARED_KV_BS_GT1_DEBUG.get():
|
||||
return
|
||||
if limit is None:
|
||||
limit = int(envs.SGLANG_CP_SHARED_KV_BS_GT1_DEBUG_LIMIT.get())
|
||||
count_key = "bs_gt1:" + key
|
||||
count = _CP_SHARED_DEBUG_COUNTS.get(count_key, 0)
|
||||
if limit > 0 and count >= limit:
|
||||
return
|
||||
_CP_SHARED_DEBUG_COUNTS[count_key] = count + 1
|
||||
logger.info("[CP_SHARED_KV_BS_GT1_DEBUG] event=%s " + message, key, *args)
|
||||
|
||||
|
||||
def _mooncake_transfer_stats_enabled() -> bool:
|
||||
return envs.SGLANG_DISAGGREGATION_TRANSFER_STATS.get()
|
||||
|
||||
@@ -1226,19 +1211,6 @@ class MooncakeKVManager(CommonKVManager):
|
||||
_np_summary(chunked_dst_kv_indice),
|
||||
kv_chunk.is_last_chunk,
|
||||
)
|
||||
_cp_shared_kv_bs_gt1_mooncake_debug(
|
||||
"transfer_worker_kv",
|
||||
"cp_rank=%s room=%s prefill_pages=%s "
|
||||
"logical_positions=%s dst_pages=%s is_last=%s "
|
||||
"session=%s",
|
||||
self.attn_cp_rank,
|
||||
kv_chunk.room,
|
||||
_np_summary(kv_chunk.prefill_kv_indices),
|
||||
_np_summary(kv_chunk.logical_page_positions),
|
||||
_np_summary(chunked_dst_kv_indice),
|
||||
kv_chunk.is_last_chunk,
|
||||
req.mooncake_session_id,
|
||||
)
|
||||
if envs.SGLANG_DEBUG_CP_SHARED_KV.get():
|
||||
_cp_shared_debug_log(
|
||||
"transfer_worker_kv",
|
||||
@@ -1354,18 +1326,6 @@ class MooncakeKVManager(CommonKVManager):
|
||||
),
|
||||
_np_summary(dst_state_indices),
|
||||
)
|
||||
_cp_shared_kv_bs_gt1_mooncake_debug(
|
||||
"transfer_worker_state",
|
||||
"cp_rank=%s room=%s prefill_state_pages=%s "
|
||||
"state_positions=%s dst_state_pages=%s "
|
||||
"session=%s",
|
||||
self.attn_cp_rank,
|
||||
kv_chunk.room,
|
||||
_np_summary(kv_chunk.state_indices),
|
||||
_np_summary(kv_chunk.state_logical_page_positions),
|
||||
_np_summary(dst_state_indices),
|
||||
req.mooncake_session_id,
|
||||
)
|
||||
self.maybe_send_extra(
|
||||
req,
|
||||
kv_chunk.state_indices,
|
||||
@@ -1746,22 +1706,6 @@ class MooncakeKVSender(CommonKVSender):
|
||||
is_last_chunk,
|
||||
getattr(self.kv_mgr.kv_args, "draft_kv_buffer_count", None),
|
||||
)
|
||||
_cp_shared_kv_bs_gt1_mooncake_debug(
|
||||
"sender_filter",
|
||||
"cp_rank=%s room=%s page_start=%s orig_kv_pages=%s "
|
||||
"filtered_kv_pages=%s kv_positions=%s orig_state_pages=%s "
|
||||
"filtered_state_pages=%s state_positions=%s is_last=%s",
|
||||
self.kv_mgr.attn_cp_rank,
|
||||
self.bootstrap_room,
|
||||
chunk_page_start,
|
||||
_np_summary(orig_kv_indices),
|
||||
_np_summary(kv_indices),
|
||||
_np_summary(logical_page_positions),
|
||||
_np_summary(orig_state_indices),
|
||||
_np_summary(state_indices),
|
||||
_np_summary(state_logical_page_positions),
|
||||
is_last_chunk,
|
||||
)
|
||||
# Special handling for cp
|
||||
elif self.kv_mgr.enable_all_cp_ranks_for_transfer:
|
||||
kv_indices, index_slice = filter_kv_indices_for_cp_rank(
|
||||
|
||||
@@ -43,7 +43,6 @@ from sglang.srt.disaggregation.utils import (
|
||||
kv_to_page_num,
|
||||
poll_and_all_reduce_attn_cp_tp_group,
|
||||
prepare_abort,
|
||||
token_ids_debug_signature,
|
||||
)
|
||||
from sglang.srt.managers.schedule_batch import (
|
||||
FINISH_ABORT,
|
||||
@@ -1305,7 +1304,7 @@ class SchedulerDisaggregationPrefillMixin:
|
||||
"rid=%s room=%s start_idx=%s end_idx=%s last_chunk=%s "
|
||||
"page_size=%s pages=%s state_pages=%s prefix_len=%s "
|
||||
"host_hit_length=%s extend_input_len=%s fill_len=%s "
|
||||
"origin_input_len=%s has_draft_pool=%s origin_sig=%s fill_sig=%s",
|
||||
"origin_input_len=%s has_draft_pool=%s",
|
||||
req.rid,
|
||||
req.bootstrap_room,
|
||||
start_idx,
|
||||
@@ -1320,8 +1319,6 @@ class SchedulerDisaggregationPrefillMixin:
|
||||
len(req.fill_ids),
|
||||
len(req.origin_input_ids),
|
||||
has_draft_pool,
|
||||
token_ids_debug_signature(getattr(req, "origin_input_ids", None)),
|
||||
token_ids_debug_signature(getattr(req, "fill_ids", None)),
|
||||
)
|
||||
if has_draft_pool and draft_prefix_overlap > 0:
|
||||
_cp_draft_shared_kv_debug(
|
||||
|
||||
@@ -67,31 +67,6 @@ def _cp_shared_kv_poll_debug_enabled() -> bool:
|
||||
return envs.SGLANG_CP_SHARED_KV_BS_GT1_DEBUG.get()
|
||||
|
||||
|
||||
def token_ids_debug_signature(token_ids: Any, *, sample: int = 6) -> str:
|
||||
"""Return a stable, bounded signature for request-token correlation logs."""
|
||||
|
||||
if token_ids is None:
|
||||
return "None"
|
||||
if isinstance(token_ids, torch.Tensor):
|
||||
values = token_ids.detach().reshape(-1).cpu().tolist()
|
||||
elif isinstance(token_ids, np.ndarray):
|
||||
values = token_ids.reshape(-1).tolist()
|
||||
else:
|
||||
values = list(token_ids)
|
||||
|
||||
mask = (1 << 63) - 1
|
||||
digest = 1469598103934665603
|
||||
for value in values:
|
||||
item = int(value) & 0xFFFFFFFFFFFFFFFF
|
||||
for shift in (0, 8, 16, 24, 32, 40, 48, 56):
|
||||
digest ^= (item >> shift) & 0xFF
|
||||
digest = (digest * 1099511628211) & mask
|
||||
|
||||
head = values[:sample]
|
||||
tail = values[-sample:] if len(values) > sample else values[:]
|
||||
return f"len={len(values)} hash={digest} head={head} tail={tail}"
|
||||
|
||||
|
||||
def _poll_queue_debug_hash(debug_ids: Optional[list[str]]) -> int:
|
||||
if not debug_ids:
|
||||
return 0
|
||||
|
||||
Reference in New Issue
Block a user