diff --git a/docs/advanced_features/nsa_prefill_cp_page_aligned_cache_contract.md b/docs/advanced_features/nsa_prefill_cp_page_aligned_cache_contract.md index 1faf086ec..4bef096c8 100644 --- a/docs/advanced_features/nsa_prefill_cp_page_aligned_cache_contract.md +++ b/docs/advanced_features/nsa_prefill_cp_page_aligned_cache_contract.md @@ -782,6 +782,10 @@ Current state: - Some prefetch misses use debug logs or normal fallback paths. - Historical silent fallbacks made it hard to identify that async/per-layer or page-aligned paths were not actually active. +- The CP shared-KV compute-owner allocation fallback currently logs at INFO and + does not use the `[CP_SHARED_KV_FALLBACK]` marker. This is an intended hot + path fallback from owner-lane/page-aligned allocation to legacy allocation, so + it must be visible at warning level. Correction: @@ -798,6 +802,15 @@ Tests: - MLA prefix not page-aligned; - index prefetch consume miss after start layer; - CP HiCache reservation/load capacity failure. +- Update compute-owner allocation fallback coverage to require warning level and + the `[CP_SHARED_KV_FALLBACK][compute_owner_alloc]` prefix. + +Implemented C11 slice: + +- Changed CP shared-KV compute-owner allocation fallback logging from INFO to + WARNING and added the `[CP_SHARED_KV_FALLBACK][compute_owner_alloc]` marker. +- Tightened the existing unit expectation so repeated fallback events are still + emitted, but now require the production-visible fallback prefix. ### C12. Verification gaps before claiming completion diff --git a/python/sglang/srt/mem_cache/common.py b/python/sglang/srt/mem_cache/common.py index cdfda526b..3d551a382 100644 --- a/python/sglang/srt/mem_cache/common.py +++ b/python/sglang/srt/mem_cache/common.py @@ -58,8 +58,8 @@ def _log_cp_shared_kv_alloc_fallback( message: str, *args, ) -> None: - logger.info( - "CP shared KV compute-owner allocation fallback (%s): " + message, + logger.warning( + "[CP_SHARED_KV_FALLBACK][compute_owner_alloc] reason=%s " + message, reason, *args, ) diff --git a/test/registered/unit/mem_cache/test_cp_shared_kv_layout.py b/test/registered/unit/mem_cache/test_cp_shared_kv_layout.py index 6a8a31b25..496774ce4 100644 --- a/test/registered/unit/mem_cache/test_cp_shared_kv_layout.py +++ b/test/registered/unit/mem_cache/test_cp_shared_kv_layout.py @@ -69,7 +69,7 @@ class TestCPSharedPagedAllocator(CustomTestCase): def test_compute_owner_alloc_fallback_logs_every_event(self): from sglang.srt.mem_cache import common - with self.assertLogs("sglang.srt.mem_cache.common", level="INFO") as cm: + with self.assertLogs("sglang.srt.mem_cache.common", level="WARNING") as cm: common._log_cp_shared_kv_alloc_fallback( "too_short_for_page_aligned", "falling back for test event %s", @@ -82,8 +82,10 @@ class TestCPSharedPagedAllocator(CustomTestCase): ) self.assertEqual(len(cm.output), 2) + self.assertIn("[CP_SHARED_KV_FALLBACK][compute_owner_alloc]", cm.output[0]) self.assertIn("too_short_for_page_aligned", cm.output[0]) self.assertIn("test event 1", cm.output[0]) + self.assertIn("[CP_SHARED_KV_FALLBACK][compute_owner_alloc]", cm.output[1]) self.assertIn("too_short_for_page_aligned", cm.output[1]) self.assertIn("test event 2", cm.output[1])