fix: allow restart-analysis replay in assert_cache_hit mode - #75
Open
cennn wants to merge 1 commit into
Open
Conversation
cennn
force-pushed
the
fix/assert-cache-hit-restart-analysis
branch
from
September 10, 2026 14:35
888acf1 to
e84eb7a
Compare
When assert_cache_hit=True and a cache entry exists but load() returns None due to restart_analysis_count > 0, fall through to the normal compile path instead of raising RuntimeError. standalone_compile will trigger the same TensorifyScalarRestartAnalysis that occurred during bake, causing dynamo to re-trace with the correct graph shape. On retry, load() succeeds. Without this fix, verify_compile_cache.sh fails with a false cache miss for any subgraph that encountered RestartAnalysis during bake. Add regression test: test_assert_cache_hit_restart_analysis.py
cennn
force-pushed
the
fix/assert-cache-hit-restart-analysis
branch
from
September 10, 2026 14:45
e84eb7a to
7beaf7c
Compare
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
When
assert_cache_hit=True(bake-verify mode) and a subgraph hasrestart_analysis_count > 0,CompilerManager.load()returnsNonedue to restart-analysis skip.compile()then unconditionally raisesRuntimeError('cache miss'), even though the cache entry exists.This causes
verify_compile_cache.shto fail for any model whose compilation triggersRestartAnalysis(e.g. viaTensorifyScalarRestartAnalysisfrom the tensorify_python_scalars pass).Fix
Change the assert condition from:
to:
When the cache entry exists but
load()returnedNone(restart skip), fall through to the normal compile path.standalone_compilewill trigger the sameTensorifyScalarRestartAnalysisas bake, dynamo re-traces with the correct graph shape, and on retryload()succeeds.Test
test_assert_cache_hit_restart_analysis.py— two-process integration test:restart_analysis_count=1MAGI_COMPILE_ASSERT_CACHE_HIT=1→ must succeedAthena PR: https://github.com/world-sim-dev/athena/pull/1068