[Fix] Include world_size in cache directory name to prevent EP cross-contamination#42
Open
cennn wants to merge 2 commits into
Open
[Fix] Include world_size in cache directory name to prevent EP cross-contamination#42cennn wants to merge 2 commits into
cennn wants to merge 2 commits into
Conversation
bdb4b91 to
44369f9
Compare
…anager cache invariants
1. model_rank_dir_name() now produces `model_{idx}[_{tag}]_rank_{rank}_ws{world_size}`.
Without world_size, switching between EP=6 and EP=8 silently reuses stale
compiled artifacts whose tensor strides no longer match, causing
assert_size_stride failures at runtime.
2. CompilerManager cache hardening (3 bugs fixed):
- initialize_cache(): unconditionally reset self.cache and
_remaining_restart_skips before loading index, preventing ghost
handles from surviving across re-init calls
- load(): check artifact directory exists on disk before delegating
to compiler.load(); remove stale entry if missing
- _maybe_store_cache_entry(): when handle is None (compilation failed),
remove any pre-existing stale entry instead of silently keeping it
3. Add three cache-invariant regression tests reproducing the above bugs.
44369f9 to
780b160
Compare
- Add unconditional _remaining_restart_skips reset in initialize_cache() to prevent stale skip counts from surviving across re-initialization - Simplify test CompileConfig creation: use _cli_parse_args=False instead of sys.argv monkey-patching - Add assertion verifying _remaining_restart_skips is cleared on re-init
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.
Summary
model_rank_dir_name()的 cache 路径从model_{idx}[_{tag}]_rank_{rank}改为model_{idx}[_{tag}]_rank_{rank}_ws{world_size}assert_size_stride失败背景
切换 EP 配置(如 EP=6 → EP=8)时,MoE head padding 和 custom-op meta function 的 tensor stride 不同,但旧 cache key 不含 world_size,导致 rank 0 的编译产物被错误复用,运行时
assert_size_stride(expected_size != actual_size)崩溃。Test plan
test_cache_invariant.py3 个测试通过_ws{N}后缀,对 world_size=1 单卡场景等价于_ws1)