diff --git a/python/sglang/srt/environ.py b/python/sglang/srt/environ.py index 7f25fb37b..1289c6a47 100644 --- a/python/sglang/srt/environ.py +++ b/python/sglang/srt/environ.py @@ -393,6 +393,10 @@ class Envs: # is replicated (Theorem 1). When on, MIN/MAX-reduce placement_digest across the # CP group each tick and fail loud on divergence. On in CI/bring-up, off in prod. SGLANG_CP_HICACHE_PLACEMENT_ASSERT = EnvBool(False) + # CP HiCache debug drift-detector: when on, _cp_host_capacity_snapshot walks the + # full radix tree and asserts the running per-rank counts match (fail loud on + # drift). Expensive full-walk per snapshot -> default off; on in bring-up/CI. + SGLANG_CP_HICACHE_VERIFY_SNAPSHOT = EnvBool(False) # Mooncake KV Transfer SGLANG_MOONCAKE_CUSTOM_MEM_POOL = EnvStr(None) diff --git a/python/sglang/srt/mem_cache/allocator.py b/python/sglang/srt/mem_cache/allocator.py index bf2cceff8..2eb69318e 100644 --- a/python/sglang/srt/mem_cache/allocator.py +++ b/python/sglang/srt/mem_cache/allocator.py @@ -1045,6 +1045,20 @@ class CPSharedPagedTokenToKVPoolAllocator(PagedTokenToKVPoolAllocator): return out_indices + def alloc_pages_for_shared_l2_load( + self, current_page_owners: List[int] + ) -> Optional[torch.Tensor]: + """Allocate fresh L1 pages for shared-physical L2 load-back. + + ``current_page_owners`` is the load-time owner plan recomputed + positionally ((page-1) % cp_size), NOT the write-time ``page_owners`` + metadata used by legacy CP HiCache replay. Thin wrapper over + ``alloc_pages_with_owners``; restored here because the 2b.0 adopt + ported the callee but dropped this wrapper that + ``cache_controller.load_cp_shared_l2`` calls. + """ + return self.alloc_pages_with_owners(current_page_owners) + def alloc_pages_with_owners( self, page_compute_owners: List[int],