Skip to content

Store index cache per page independently and enable hicache offload for GLM-5.3-Flash - #40134

Closed
llc-kc wants to merge 2 commits into
sgl-project:mainfrom
llc-kc:fix_glm53_flash_indxer_cache_offload
Closed

llc-kc wants to merge 2 commits into
sgl-project:mainfrom
llc-kc:fix_glm53_flash_indxer_cache_offload

Conversation

@llc-kc

@llc-kc llc-kc commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

Currently indexer cache is missing for GLM-5.3-Flash
exiting PR #39156, #38212 try to fix this, but the require model-specific adaptations.
The root cause is GLM pack indexer cache of 256 token into it's first 64 token.

Modifications

Make index cache each page (64 token) stored into it corresponding page, and add indexer sidecar for L2 L3 offload.
As a result, we do not need complicated and model-specific adaptations in hicache, compatible with both L2 and L3 storage.

Accuracy Tests

test script:

# clear L1 L2 kv cache
curl -s -X POST http://localhost:12121/flush_cache
# clear L3 kv cache
curl -s -X POST http://localhost:12121/hicache/storage-backend/clear

# first round bench without L3

# short,medium,long
evalscope eval \
--model GLM-5.3-Flash \
--api-url http://localhost:12121/v1 \
--api-key EMPTY \
--eval-type openai_api \
--generation-config timeout=1800 \
--datasets longbench_v2 \
--dataset-args '{"longbench_v2": {"subset_list": ["short"], "local_path": "/data1/datasets/llm_dataset/llm_accuracy_bench/LongBench-v2/"}}' \
--generation-config '{"max_tokens":24576}' \
--eval-batch-size 20 \
--limit 100

# clear L1 L2 kv cache
curl -s -X POST http://localhost:12121/flush_cache

# second bench with all loading from L3 cache

# short,medium,long
evalscope eval \
--model GLM-5.3-Flash \
--api-url http://localhost:12121/v1 \
--api-key EMPTY \
--eval-type openai_api \
--generation-config timeout=1800 \
--datasets longbench_v2 \
--dataset-args '{"longbench_v2": {"subset_list": ["short"], "local_path": "/data1/datasets/llm_dataset/llm_accuracy_bench/LongBench-v2/"}}' \
--generation-config '{"max_tokens":24576}' \
--eval-batch-size 20 \
--limit 100

before fix without hicache l2 l3

┌───────────────┬──────────────┬──────────┬──────────┬───────┬─────────┬─────────┐
│ Model         │ Dataset      │ Metric   │ Subset   │   Num │   Score │ Cat.0   │
├───────────────┼──────────────┼──────────┼──────────┼───────┼─────────┼─────────┤
│ GLM-5.3-Flash │ longbench_v2 │ mean_acc │ short    │   100 │    0.66 │ default │
└───────────────┴──────────────┴──────────┴──────────┴───────┴─────────┴─────────┘

after fix:

first round: writing L3
longbench_v2 report table:
┌───────────────┬──────────────┬──────────┬──────────┬───────┬─────────┬─────────┐
│ Model         │ Dataset      │ Metric   │ Subset   │   Num │   Score │ Cat.0   │
├───────────────┼──────────────┼──────────┼──────────┼───────┼─────────┼─────────┤
│ GLM-5.3-Flash │ longbench_v2 │ mean_acc │ short    │   100 │    0.67 │ default │
└───────────────┴──────────────┴──────────┴──────────┴───────┴─────────┴─────────┘


second round: clear L1 L2, loading from L3

2026-09-18 13:28:58 - evalscope - INFO: Overall report table:
┌───────────────┬──────────────┬──────────┬──────────┬───────┬─────────┬─────────┐
│ Model         │ Dataset      │ Metric   │ Subset   │   Num │   Score │ Cat.0   │
├───────────────┼──────────────┼──────────┼──────────┼───────┼─────────┼─────────┤
│ GLM-5.3-Flash │ longbench_v2 │ mean_acc │ short    │   100 │    0.66 │ default │
└───────────────┴──────────────┴──────────┴──────────┴───────┴─────────┴─────────┘

Speed Tests and Profiling

to do


CI States

Latest PR Test (Base): ❌ Run #35320939903
Latest PR Test (Extra): ❌ Run #35320939885
Latest PR Test (AMD ROCm 10): ❌ Run #35320939851

@ispobock

ispobock commented Oct 4, 2026 •

Copy link
Copy Markdown
Collaborator

Compared this with #42178, which fixes the same root cause (pooled index keys of a 256-token span live in the group-head page) from the other side.

#42178 (256-token logical page) #40134 (64-token page, 16 rows per index page)
paged-MQA kernel untouched, DeepGEMM / tilelang / aiter all work tilelang only and forced on all CUDA; SM100 defaults to DeepGEMM, and each 64-row tile only carries 16 rows; aiter not covered
sglang triton addressing kernels changed changed
prefix hit granularity decode mamba checkpoints already on the 256 track interval; prefill / branching checkpoints move from 64 to 256 64, unchanged
memory index pool 1/4, +9.4% max_total_num_tokens unchanged, 3/4 of index pool unused
HiCache / PD IO 256-token pages, 1/4 index bytes 64-token pages
shared-prefix corruption fixed, NIAH 11/20 -> 20/20 should be fixed, not tested
constraints no DCP; chunked_prefill_size and mamba_track_interval must be multiples of 256 page semantics unchanged

The DSA layout can't be page-local like QSA (compressed_slot = loc // ratio) because it reuses the DSA paged-MQA kernels, which require 64-row index pages. QSA owns its tilelang kernel and packs sub-pages into one 64-row tile.

Prefer #42178 for the index layout: it fixes the corruption without touching the paged-MQA kernels, and the only cost is the coarser prefill / branching checkpoint granularity.

@llc-kc llc-kc closed this Oct 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hicache Hierarchical Caching for SGLang jit-kernel memory-pool

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants