fix(jit): invalidate kernel cache on #included source changes#469
Open
Oseltamivir wants to merge 1 commit into
Open
fix(jit): invalidate kernel cache on #included source changes#469Oseltamivir wants to merge 1 commit into
Oseltamivir wants to merge 1 commit into
Conversation
The JIT content hash covered only a kernel's top-level .hip plus include/mori. Ops kernel .hip units #include src/ops/dispatch_combine/*.cpp and ep_common.hip, so editing an included file left the hash unchanged and a stale .hsaco was reused — the edit silently had no effect. Hash the whole subsystem source tree instead of the single .hip, and include .hip files when hashing directories so #included translation units are covered.
jhchouuu
approved these changes
Jul 14, 2026
jhchouuu
left a comment
Collaborator
There was a problem hiding this comment.
LGTM
thanks for catching this issue
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.
Problem
The JIT content hash for a kernel covers only its top-level
.hipfile plusinclude/mori. But the ops kernel.hiptranslation units#includesibling sources —src/ops/dispatch_combine/*.cpp(e.g.internode_v1.cpp,low_latency_async.cpp) andsrc/ops/kernels/ep_common.hip. Editing one of those included files leaves the hash unchanged, so a stale.hsacois reused and the change silently has no effect. Today the only workaround is deleting~/.mori/jit/<arch>_<nic>/by hand.Fix
compile_genco: hash the whole subsystem source tree (parent of the kernel dir) instead of only the top-level.hip._hash_tree: include.hipfiles when hashing directories, so#included translation units (e.g.ep_common.hip) are covered.Verification
Recomputing the hash over the source tree while editing an
#included file: before the change the hash is unchanged (stale reuse); after, it changes for bothdispatch_combine/*.cppandep_common.hip. No tests reference the hashing functions.