Skip to content

fix: skip FSDP fullgraph overlap for non-fullgraph models (e.g. VAE) - #79

Closed
cennn wants to merge 2 commits into
mainfrom
fix/fsdp-overlap-non-fullgraph
Closed

cennn wants to merge 2 commits into
mainfrom
fix/fsdp-overlap-non-fullgraph

Conversation

@cennn

@cennn cennn commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

When enable_fsdp is globally True but a model uses graph splitting (disable_graph_split=False), the FSDP fullgraph overlap pass would assert-fail:

AssertionError: fsdp_config.enable_fullgraph_overlap requires disable_graph_split=True

This happens when compiling models like VAE alongside FSDP models (base, SR) in a monolithic deployment. The fix adds a disable_graph_split guard at the call site (line 672) so non-FSDP models compile correctly.

Tested: 400B FSDP monolithic deployment on 8×H200 — all three compile phases (base, SR, VAE) completed successfully.

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
When enable_fsdp is globally True but a model uses graph splitting
(disable_graph_split=False), the FSDP fullgraph overlap pass would
assert-fail. Add a disable_graph_split guard so non-FSDP models
(VAE, etc.) compile correctly alongside FSDP models.
@cennn

cennn commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator Author

Superseded by #89 (rebased the still-useful parts onto current main). Closing this PR.

@cennn cennn closed this Oct 14, 2026
jiahy0825 pushed a commit that referenced this pull request Oct 15, 2026
…split graphs (#89)

* fix: cache key on graph+placements, AOT JIT fallback, skip FSDP overlap on split graphs

Unmerged remnants of #88 / #86 / #84 / #79, rebased onto current main:

- Cache key includes graph.code and DTensor placements. Changing SimpleFSDP
  fully_shard -> replicate used to reuse the old artifact (1-rank AllGathers
  served as DtoD copies).
- AOT compile failures fall back to JIT so MAGI_COMPILE_AOT=1 can stay
  process-wide (VAE AOT, SimpleFSDP DiT JIT).
- enable_fsdp no longer runs fullgraph overlap when disable_graph_split is
  False (VAE in a monolithic FSDP process). #79's restart-analysis half
  already landed as #75.
- Timing bench dim 128->1024 so launch jitter does not flake max/min < 1.2
  on B300/H100.

* fix(cache): hash input placements only, not graph.code

Restart-analysis retraces with different FX node names, so including graph.code
in the magi cache key made the second pass miss the first-pass directory
(test_assert_cache_hit_succeeds_with_restart_analysis / test_restart_analysis_cache
on pt212). DTensor fully_shard vs replicate is still distinguished by the input
placement signature.

* fix(cache): hash only DTensor placements so restart-analysis still hits

* fix(aot): do not swallow AssertionError/OOM when AOT falls back to JIT
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