Skip to content

fix(jit): invalidate kernel cache on #included source changes#469

Open
Oseltamivir wants to merge 1 commit into
ROCm:mainfrom
Oseltamivir:fix-jit-cache-included-sources
Open

fix(jit): invalidate kernel cache on #included source changes#469
Oseltamivir wants to merge 1 commit into
ROCm:mainfrom
Oseltamivir:fix-jit-cache-included-sources

Conversation

@Oseltamivir

Copy link
Copy Markdown

Problem

The JIT content hash for a kernel covers only its top-level .hip file plus include/mori. But the ops kernel .hip translation units #include sibling sources — src/ops/dispatch_combine/*.cpp (e.g. internode_v1.cpp, low_latency_async.cpp) and src/ops/kernels/ep_common.hip. Editing one of those included files leaves the hash unchanged, so a stale .hsaco is 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 .hip files 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 both dispatch_combine/*.cpp and ep_common.hip. No tests reference the hashing functions.

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 jhchouuu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
thanks for catching this issue

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.

2 participants