Expose CP shared-KV allocation fallback as a warning
The compute-owner allocation path is an intended hot path for CP shared KV. Falling back to legacy page allocation changes the behavior profile enough that INFO/no-marker logging is too easy to miss during profiling. This makes the fallback warning-visible and gives it the standard CP shared-KV fallback marker while preserving the existing behavior of logging every fallback event. Constraint: Production fallbacks from intended CP shared-KV hot paths must be visible and grep-able. Rejected: Keep INFO logging | historical silent or low-visibility fallbacks hid inactive optimized paths. Confidence: medium Scope-risk: narrow Directive: Keep fallback logs warning-level unless the path is proven to be expected steady state and separately observable. Tested: Local py_compile for common.py and test_cp_shared_kv_layout.py. Tested: Local extracted assertLogs check for _log_cp_shared_kv_alloc_fallback warning prefix and reason formatting. Tested: Remote g0034 py_compile for common.py and test_cp_shared_kv_layout.py. Not-tested: Full remote pytest for test_cp_shared_kv_layout.py; current g0034 container aborts while importing installed sgl_kernel common_ops before test execution. Co-authored-by: OmX <omx@oh-my-codex.dev>
This commit is contained in:
@@ -782,6 +782,10 @@ Current state:
|
|||||||
- Some prefetch misses use debug logs or normal fallback paths.
|
- Some prefetch misses use debug logs or normal fallback paths.
|
||||||
- Historical silent fallbacks made it hard to identify that async/per-layer or
|
- Historical silent fallbacks made it hard to identify that async/per-layer or
|
||||||
page-aligned paths were not actually active.
|
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:
|
Correction:
|
||||||
|
|
||||||
@@ -798,6 +802,15 @@ Tests:
|
|||||||
- MLA prefix not page-aligned;
|
- MLA prefix not page-aligned;
|
||||||
- index prefetch consume miss after start layer;
|
- index prefetch consume miss after start layer;
|
||||||
- CP HiCache reservation/load capacity failure.
|
- 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
|
### C12. Verification gaps before claiming completion
|
||||||
|
|
||||||
|
|||||||
@@ -58,8 +58,8 @@ def _log_cp_shared_kv_alloc_fallback(
|
|||||||
message: str,
|
message: str,
|
||||||
*args,
|
*args,
|
||||||
) -> None:
|
) -> None:
|
||||||
logger.info(
|
logger.warning(
|
||||||
"CP shared KV compute-owner allocation fallback (%s): " + message,
|
"[CP_SHARED_KV_FALLBACK][compute_owner_alloc] reason=%s " + message,
|
||||||
reason,
|
reason,
|
||||||
*args,
|
*args,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ class TestCPSharedPagedAllocator(CustomTestCase):
|
|||||||
def test_compute_owner_alloc_fallback_logs_every_event(self):
|
def test_compute_owner_alloc_fallback_logs_every_event(self):
|
||||||
from sglang.srt.mem_cache import common
|
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(
|
common._log_cp_shared_kv_alloc_fallback(
|
||||||
"too_short_for_page_aligned",
|
"too_short_for_page_aligned",
|
||||||
"falling back for test event %s",
|
"falling back for test event %s",
|
||||||
@@ -82,8 +82,10 @@ class TestCPSharedPagedAllocator(CustomTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(len(cm.output), 2)
|
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("too_short_for_page_aligned", cm.output[0])
|
||||||
self.assertIn("test event 1", 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("too_short_for_page_aligned", cm.output[1])
|
||||||
self.assertIn("test event 2", cm.output[1])
|
self.assertIn("test event 2", cm.output[1])
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user