Gate tiny CP shared-KV prefetch by token threshold
Prefix materialize prefetch has fixed launch and coordination overhead, so tiny cache-hit prefixes should stay on the simpler synchronous path. The default threshold is now expressed as a cached import-time token threshold while the existing page override remains available for workload-specific tuning. Both MLA and index prefix prefetchers use the same page-size-aware threshold, so CP shared-KV prefix prefetch is enabled only when the prefix covers at least one page per CP lane and at least the configured token threshold. Constraint: The default token threshold must be read once to avoid hot-path env lookups Constraint: Existing page threshold override must continue to disable or force the gate Rejected: Hard-code 1024 tokens | tuning needs to be possible without code changes Rejected: Read token threshold on every maybe_create call | unnecessary hot-path env lookup Confidence: medium Scope-risk: narrow Directive: Keep MLA and index prefetch threshold logic shared; do not let their gates diverge Tested: Not rerun per user request; prior py_compile, diff check, and isolated env-cache check had passed before commit Not-tested: full pytest in local environment due missing optional dependencies/kernel import constraints Not-tested: GLM5 E2E throughput after this threshold change
This commit is contained in:
@@ -212,6 +212,7 @@ class Envs:
|
||||
SGLANG_CP_SHARED_KV_ENABLE_MLA_PREFETCH = EnvBool(False)
|
||||
SGLANG_CP_SHARED_KV_LOG_MLA_PREFETCH = EnvBool(False)
|
||||
SGLANG_CP_SHARED_KV_MATERIALIZE_NVTX = EnvBool(False)
|
||||
SGLANG_CP_SHARED_KV_MLA_PREFETCH_MIN_PREFIX_TOKENS = EnvInt(1024)
|
||||
SGLANG_CP_SHARED_KV_MLA_PREFETCH_MIN_PREFIX_PAGES = EnvInt(-1)
|
||||
SGLANG_CP_DRAFT_SHARED_KV = EnvBool(False)
|
||||
SGLANG_CP_DRAFT_SHARED_KV_DEBUG = EnvBool(False)
|
||||
|
||||
Reference in New Issue
Block a user