Skip to content

[HiCache] Merge HiCache event checks to reduce decode overhead - #30511

Merged
huangtingwei9988 merged 10 commits into
sgl-project:mainfrom
antgroup:deocde_hicache_events_opt
Jul 29, 2026
Merged

huangtingwei9988 merged 10 commits into
sgl-project:mainfrom
antgroup:deocde_hicache_events_opt

Conversation

@huangtingwei9988

@huangtingwei9988 huangtingwei9988 commented Jul 8, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

Although HiCache is primarily used during the prefill phase, in single-node deployments the scheduler still has to complete HiCache event checks on every decode step. When storage is enabled, each decode step performs four all-reduce operations to finish the HiCache event polling path:

  • writing_check() inside check_hicache_events()
  • loading_check() inside check_hicache_events()
  • the storage control queue drain inside check_hicache_events()
  • an extra repeated writing_check() from flush_write_through_acks()
image Each all-reduce costs about 150+ us, so four of them add roughly 600+ us of CPU-side synchronization overhead per decode step. On small models or small-batch decode workloads, this overhead can dominate TPOT and cause up to ~30% TPOT regression, with the GPU becoming idle while the scheduler waits on these CPU-side all-reduce calls.

Modifications

Accuracy Tests

Speed Tests and Profiling

Checklist

Review and Merge Process

  1. Ping Merge Oncalls to start the process. See the PR Merge Process.
  2. Get approvals from CODEOWNERS and other reviewers.
  3. Trigger CI tests with comments or contact authorized users to do so.
    • Common commands include /tag-and-rerun-ci, /tag-run-ci-label, /rerun-failed-ci
  4. After green CI and required approvals, ask Merge Oncalls or people with Write permission to merge the PR.

CI States

Latest PR Test (Base): ✅ Run #30440233721
Latest PR Test (Extra): ❌ Run #30440236718

huangtingwei9988 and others added 7 commits July 8, 2026 10:24
# Conflicts:
#	python/sglang/srt/managers/scheduler.py
Co-authored-by: alphabetc1 <47200617+alphabetc1@users.noreply.github.com>
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

@huangtingwei9988

Copy link
Copy Markdown
Collaborator Author

/tag-and-rerun-ci

@github-actions github-actions Bot added the run-ci CI: run the baseline test suite on this PR label Jul 8, 2026
@ishandhanani

Copy link
Copy Markdown
Collaborator

@huangtingwei9988 - just for my curiosity can you share the steps to get that same profile? I think it would be helpful as a snippet

@huangtingwei9988

Copy link
Copy Markdown
Collaborator Author

Qwen3-8B Benchmark Summary
Configuration:
Model: /data/nas/yongke.zyk/model_hub/Qwen3-8B
TP: 4
HiCache: enabled
HiCache backend/layout/policy: direct / page_first_direct / write_through
Workload: 16k input, 2k output

BS Base TPOT (ms) Opt TPOT (ms) TPOT Improvement Base Output tok/s Opt Output tok/s Throughput Improvement
1 13.13 12.91 +1.68% 71.08 72.64 +2.19%
2 13.48 13.39 +0.67% 133.73 134.75 +0.76%
4 14.39 14.33 +0.42% 236.68 240.45 +1.59%
8 17.47 16.70 +4.41% 367.97 388.45 +5.57%
16 21.11 20.22 +4.22% 561.36 591.17 +5.31%

…_opt

# Conflicts:
#	python/sglang/srt/mem_cache/hiradix_cache.py
#	python/sglang/srt/mem_cache/unified_radix_cache.py
@huangtingwei9988

Copy link
Copy Markdown
Collaborator Author

/rerun-failed-ci

@github-actions github-actions Bot added the hicache Hierarchical Caching for SGLang label Jul 29, 2026
@huangtingwei9988
huangtingwei9988 merged commit 50029f0 into sgl-project:main Jul 29, 2026
135 of 147 checks passed
saturn-acc pushed a commit to saturn-acc/sglang that referenced this pull request Aug 16, 2026
…roject#30511)

Co-authored-by: alphabetc1 <47200617+alphabetc1@users.noreply.github.com>
Atituiset pushed a commit to Atituiset/sglang that referenced this pull request Sep 10, 2026
…roject#30511)

Co-authored-by: alphabetc1 <47200617+alphabetc1@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation hicache Hierarchical Caching for SGLang high priority run-ci CI: run the baseline test suite on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants