Repository navigation
[core] Consolidate compiled-kernel caches under SGLANG_CACHE_DIR - #32434
Merged
Merged
Conversation
shuwang21
requested review from
BBuf,
CatherineSue,
Edwardf0t1,
Fridge003,
HaiShaw,
JustinTong0323,
Ying1123,
b8zhong,
ch-wan,
ispobock,
merrymercy and
slin1237
as code owners
July 26, 2026 08:39
Contributor
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 88a6597320
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Contributor
Author
|
one open question: should presharded checkpoints really live under the same root as the kernel caches? |
ch-wan
reviewed
Aug 1, 2026
Fridge003
reviewed
Aug 1, 2026
shuwang21
requested review from
AgainstEntropy,
mickqian,
ping1jing2,
sogalin,
wisclmy0611,
yichiche and
zijiexia
as code owners
August 2, 2026 04:46
Fridge003
approved these changes
Aug 3, 2026
Contributor
Author
|
Rebased to resolve conflicts. |
This was referenced Aug 10, 2026
saturn-acc
pushed a commit
to saturn-acc/sglang
that referenced
this pull request
Aug 16, 2026
2 tasks
Jianhong-Zhang
pushed a commit
to Jianhong-Zhang/sglang
that referenced
this pull request
Aug 18, 2026
3 of 5 tasks
7 of 8 tasks
chromecast56
added a commit
to chromecast56/sglang-fork
that referenced
this pull request
Aug 28, 2026
SGLANG_CUTE_AOT_CACHE_DIR is now registered in environ.py and defaults
to {SGLANG_CACHE_DIR}/cute_aot, matching the convention from sgl-project#32434;
setting it to an empty string keeps compilation process-local.
JITPersistentCache resolves its directory on first storage access so
import-time construction never probes the GPU or hashes sources, which
is what makes default-on safe. The flash_attn cache_config adapter and
the FLASH_ATTENTION_CUTE_DSL_CACHE_* variables are removed; interface.py
consumes the shared factory directly.
Co-Authored-By: Claude Fable 5 <[email protected]>
This was referenced Sep 10, 2026
Atituiset
pushed a commit
to Atituiset/sglang
that referenced
this pull request
Sep 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation (Idea from @ch-wan)
Triton, Inductor, FlashInfer and the CUDA driver each write their compiled
kernels to their own directory:
Scattered across four places, they cannot be cleaned, warmed, copied between
hosts or volume-mounted as a unit, and nothing tells an operator where they
all are.
Modifications
environ.py— addedthird_party_cache_defaults()(env var → cache dirmapping) and
redirect_third_party_caches(), whichsetdefaults those fourvars.
SGLANG_DG_CACHE_DIRnow defaults to{SGLANG_CACHE_DIR}/deep_gemm.sglang/__init__.py— calls the redirect above the imports that reachtorch and FlashInfer, which otherwise fix these paths first.
compile_utils.py— readsSGLANG_DG_CACHE_DIRthroughenvsinsteadof duplicating the default.
warmup_deep_gemm.py'sMARKER_DIRderives fromSGLANG_CACHE_DIR;ci_install_dependency.shclears the inductor cache inevery location it can be in.
_configure_persistent_torch_compile_cachecompares againstthird_party_cache_defaults(), so an sglang default is not mistaken for anoperator override and its caches still land under
SGLANG_DIFFUSION_CACHE_ROOT.~/.triton,~/.cache/flashinferand~/.cache/deep_gemmif present, without touching them; environment-variabledoc updated.
Important
Every cache moves, so the first launch after upgrading recompiles once.
Copy or symlink the old directory to the new one if you pre-warm or
volume-mount it —
deep_gemmandflashinferare the expensive ones.~/.triton{SGLANG_CACHE_DIR}/triton~/.cache/flashinfer{SGLANG_CACHE_DIR}/.cache/flashinfer~/.cache/deep_gemm{SGLANG_CACHE_DIR}/deep_gemm/tmp/torchinductor_$USER{SGLANG_CACHE_DIR}/inductor~/.nv/ComputeCache{SGLANG_CACHE_DIR}/nvSetting any of
TRITON_CACHE_DIR,FLASHINFER_WORKSPACE_BASE,SGLANG_DG_CACHE_DIR,TORCHINDUCTOR_CACHE_DIRorCUDA_CACHE_PATHkeeps that one where it is.
Verification
E2E on a clean L4 studio, Qwen2.5-1.5B:
~/.cache/sglang(
triton464K,.cache/flashinfer5.9M,inductor,nv) and nothingappeared outside it
Accuracy Tests
No forward or weight-loading logic changed — only where derived artifacts are
written.
Speed Tests and Profiling
No inference-path impact. One-time recompile on upgrade, see the note above.
CI States
Latest PR Test (Base): ⏳ Run #30972987487
Latest PR Test (Extra): ✅ Run #30972987297