Skip to content

Make the JIT cache key independent of the install include path - #388

Open
matteso1 wants to merge 1 commit into
deepseek-ai:mainfrom
matteso1:jit-cache-key-relocatable
Open

Make the JIT cache key independent of the install include path#388
matteso1 wants to merge 1 commit into
deepseek-ai:mainfrom
matteso1:jit-cache-key-relocatable

Conversation

@matteso1

@matteso1 matteso1 commented Jul 20, 2026

Copy link
Copy Markdown

The kernel cache key embeds the absolute -I{library_include_path} token via flags, so a byte-identical kernel re-JITs and duplicates cache entries whenever the install prefix differs (venv rename, container build-layer vs runtime layout, moved NFS mount). That defeats sharing a DG_JIT_CACHE_DIR across layouts.

This strips that one token from the key (strip_flag_token, exact match, key computation only; the compile command and DG_JIT_DEBUG output are unchanged). It stays safe because that directory's header content is already keyed through the include hash embedded in code (IncludeParser::get_hash_value); everything else stays keyed: the compiler-version signature, every behavioral flag, and every other -I (NVRTC's cuda_home/include headers are not content-hashed, so their path stays). Since the key changes, existing entries re-JIT once under it.

This PR follows simon-mo's request on the open vllm-project/vllm#48190 to propose the relocation fix upstream instead of carrying it as a vendored patch. The vendored variant proposed there also drops the version field; on H100, relocating a prebuilt cache across install layouts turned a guaranteed miss into a hit and cut 93.7s from a Qwen3-30B-A3B-FP8 cold start (n=1). This PR deliberately keeps the version field keyed.

Related but distinct: #301/#302 (JIT cache concurrency), #333 (wheel portability).

The key embedded the absolute -I<library include> token via flags, so
byte-identical kernels re-JIT and duplicate cache entries whenever the
install prefix differs. That directory's header content is already keyed
through the include hash embedded in the code string; the compiler
version signature, every behavioral flag, and every other include path
(CUDA headers are not content-hashed) stay in the key. Compile commands
are unchanged; only the key computation differs.

Signed-off-by: Nils Matteson <nilsmatteson@icloud.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant