[HiCache] Support packed and sidecar draft caches for MTP/EAGLE/DSpark (#30393)

Co-authored-by: hjzhang <hjzhang89.gmail.com>
Co-authored-by: Zhangheng <hzh0425@apache.org>
Co-authored-by: shuwenn <47200617+alphabetc1@users.noreply.github.com>
This commit is contained in:
hjzhang
2026-08-06 14:31:11 +08:00
committed by GitHub
co-authored by hjzhang Zhangheng shuwenn
parent c84ddc0e76
commit 8e11feb68e
19 changed files with 992 additions and 206 deletions
@@ -19,9 +19,10 @@ from sglang.test.test_utils import (
)
DSV4_FLASH_MODEL = "sgl-project/DeepSeek-V4-Flash-FP8"
DSV4_DSPARK_MODEL = "deepseek-ai/DeepSeek-V4-Flash-DSpark"
DSV4_FLASH_LAUNCH_TIMEOUT = 3600
register_cuda_ci(est_time=1000, stage="extra-b", runner_config="4-gpu-h100")
register_cuda_ci(est_time=1500, stage="extra-b", runner_config="4-gpu-h100")
def _assert_dsv4_decode_cached_tokens(result, history_len, output_len, label):
@@ -330,5 +331,64 @@ class TestUnifiedDeepSeekV4FlashEagleHiCacheL3(AccuracyTwoPassMixin, CustomTestC
self.assertEqual(cached_details.get("storage_backend"), "HiCacheFile")
class TestUnifiedDeepSeekV4FlashDSparkHiCacheL3(
TestUnifiedDeepSeekV4FlashEagleHiCacheL3
):
"""DeepSeek V4 Flash DSpark + HiCache L3 should load from storage."""
@classmethod
def setUpClass(cls):
cls.model = DSV4_DSPARK_MODEL
cls.base_url = DEFAULT_URL_FOR_TEST
cls.hicache_dir = tempfile.mkdtemp(prefix="hicache_l3_dspark_dsv4_")
cls.process = popen_launch_server(
cls.model,
cls.base_url,
timeout=DSV4_FLASH_LAUNCH_TIMEOUT,
other_args=[
"--trust-remote-code",
"--tp-size",
"4",
"--attention-backend",
"compressed",
"--page-size",
str(cls.page_size),
"--chunked-prefill-size",
"8192",
"--mem-fraction-static",
"0.95",
"--disable-shared-experts-fusion",
"--enable-hierarchical-cache",
"--hicache-ratio",
"2",
"--hicache-write-policy",
"write_through",
"--hicache-storage-prefetch-policy",
"wait_complete",
"--hicache-io-backend",
"kernel",
"--hicache-mem-layout",
"page_first",
"--hicache-storage-backend",
"file",
"--enable-cache-report",
"--swa-full-tokens-ratio",
"0.25",
"--max-total-tokens",
"20000",
"--max-running-requests",
"4",
"--moe-runner-backend",
"marlin",
"--speculative-algorithm",
"DSPARK",
],
env={
"SGLANG_ENABLE_UNIFIED_RADIX_TREE": "1",
"SGLANG_HICACHE_FILE_BACKEND_STORAGE_DIR": cls.hicache_dir,
},
)
if __name__ == "__main__":
unittest.main()
@@ -179,6 +179,14 @@ class TestUnifiedMambaHiCacheL3(AccuracyTwoPassMixin, CustomTestCase):
"--max-mamba-cache-size",
"500",
"--weight-loader-prefetch-checkpoints",
"--speculative-algorithm",
"NEXTN",
"--speculative-num-steps",
"3",
"--speculative-eagle-topk",
"1",
"--speculative-num-draft-tokens",
"4",
],
env={
"SGLANG_ENABLE_UNIFIED_RADIX_TREE": "1",
@@ -175,6 +175,14 @@ class TestGLM5HiRadixCacheL3Accuracy(AccuracyTwoPassMixin, CustomTestCase):
"page_first",
"--hicache-storage-backend",
"file",
"--speculative-algorithm",
"EAGLE",
"--speculative-num-steps",
"3",
"--speculative-eagle-topk",
"1",
"--speculative-num-draft-tokens",
"4",
],
env={
"SGLANG_HICACHE_FILE_BACKEND_STORAGE_DIR": cls.hicache_dir,
@@ -223,6 +231,14 @@ class TestGLM5UnifiedRadixCacheL3Accuracy(AccuracyTwoPassMixin, CustomTestCase):
"page_first",
"--hicache-storage-backend",
"file",
"--speculative-algorithm",
"EAGLE",
"--speculative-num-steps",
"3",
"--speculative-eagle-topk",
"1",
"--speculative-num-draft-tokens",
"4",
],
env={
"SGLANG_HICACHE_FILE_BACKEND_STORAGE_DIR": cls.hicache_dir,