Repository navigation
fix(environ): align SGLANG_JIT_CACHE_DIR default with SGLANG_CACHE_DIR - #44068
Asthenia0412 wants to merge 1 commit into
Conversation
The SGLANG_CACHE_DIR root directory (~/.cache/sglang) already drives most
JIT cache paths via _default_cache_subdir() and redirect_third_party_caches(),
but SGLANG_JIT_CACHE_DIR was an exception: it defaulted to None in environ.py
while cache.py hardcoded "~/.cache/sglang/jit" as a fallback, creating two
separate sources of truth.
This change makes SGLANG_JIT_CACHE_DIR resolve via _default_cache_subdir("jit")
so it tracks SGLANG_CACHE_DIR (matching SGLANG_DG_CACHE_DIR and
SGLANG_CUTE_AOT_CACHE_DIR), and updates cache.py cache_root() to derive its
fallback from envs.SGLANG_CACHE_DIR instead of a hardcoded path.
With this change, operators who set SGLANG_CACHE_DIR=/mnt/cache/sglang will
automatically get JIT builds under /mnt/cache/sglang/jit without a separate
SGLANG_JIT_CACHE_DIR override.
Ref: #19612
Signed-off-by: yancy <yancy@users.noreply.github.com>
|
Hi @DarkSharpness @HaiShaw — gentle ping for review when you have a moment. Thanks! |
|
@reviewers @maintainers CI call-gate fails because it requires a 'run-ci' label. Could someone add this label to trigger the full test suite? |
|
🤖 CI gating notice: This PR's checks ( |
|
Thanks for your interest in SGLang. This account opened 16 PRs in about eight hours, across unrelated subsystems (attention backends, speculative decoding, diffusion loading, scheduler IPC, KV-cache compression, docs), including two PRs for the same change (#44073 and #44117, both for #28808) and a fix for #43929 that is already on main. We can't review contributions at this volume, so we are closing the ones still open. If you want to pursue one, please pick a single change, verify it on a real run (a repro, a test, or numbers), and open a fresh PR. |
Summary
Partial fix for #19612: Align
SGLANG_JIT_CACHE_DIRwith the unifiedSGLANG_CACHE_DIRroot.Problem
SGLang already directs third-party JIT caches (Triton, Inductor, CUDA, TileLang, FlashInfer) under
SGLANG_CACHE_DIRviaredirect_third_party_caches(), and other internal caches (SGLANG_DG_CACHE_DIR,SGLANG_CUTE_AOT_CACHE_DIR) resolve relative to it using_default_cache_subdir(). However,SGLANG_JIT_CACHE_DIRwas inconsistent:environ.py: declared asEnvStr(None)(no default)cache.py: hardcoded fallback"~/.cache/sglang/jit"This split meant setting
SGLANG_CACHE_DIR=/mnt/cachedid not redirect the JIT kernel build cache — operators needed a separateSGLANG_JIT_CACHE_DIR=/mnt/cache/jitoverride.Fix
environ.py— ChangedSGLANG_JIT_CACHE_DIRfromEnvStr(None)toEnvStr(lambda: _default_cache_subdir("jit")), matching the pattern used bySGLANG_DG_CACHE_DIRandSGLANG_CUTE_AOT_CACHE_DIR.cache.py— Updatedcache_root()fallback from a hardcoded"~/.cache/sglang/jit"toos.path.join(os.path.expanduser(envs.SGLANG_CACHE_DIR.get()), "jit"), eliminating the second source of truth.Result
All JIT/precompilation caches now resolve under a single configurable root:
$SGLANG_CACHE_DIR/tritonTRITON_CACHE_DIR$SGLANG_CACHE_DIR/inductorTORCHINDUCTOR_CACHE_DIR$SGLANG_CACHE_DIR/nvCUDA_CACHE_PATH$SGLANG_CACHE_DIR/tilelangTILELANG_CACHE_DIR$SGLANG_CACHE_DIRbaseFLASHINFER_WORKSPACE_BASE$SGLANG_CACHE_DIR/deep_gemmSGLANG_DG_CACHE_DIR$SGLANG_CACHE_DIR/cute_aotSGLANG_CUTE_AOT_CACHE_DIR$SGLANG_CACHE_DIR/jitSGLANG_JIT_CACHE_DIRSetting
SGLANG_CACHE_DIR=/mnt/cache/sglangnow redirects every cache at once.Backward Compatibility
SGLANG_JIT_CACHE_DIRis explicitly set, it still takes precedenceNone→~/.cache/sglang/jit(same ascache.py's previous hardcoded fallback)SGLANG_JIT_CACHE_DIRwill now see a concrete path when unset instead ofNoneRefs: #19612
Signed-off-by: yancy yancy@users.noreply.github.com
CI States
Latest PR Test (Base): ❌ Run #38407097560
Latest PR Test (Extra): ❌ Run #38407096687
Latest PR Test (AMD ROCm 10): ❌ Run #38407097015