Apply #1895 only when really necessary #2322
Open
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.
We observed a significant performance regression for MoE models using pure FSDP, with MFU dropping from 24.5% to 16.3% when running Qwen3 30A3B on 2×8 B200s. This regression was traced back to commit 2a7a148, associated with issue #1895.
While 2a7a148 correctly fixes Dynamo graph breaks for combined EP + FSDP setups, the change is unnecessary for pure FSDP configurations and introduces avoidable overhead in that case.
This pull request refactors and extends the
apply_compilelogic used for MoE model parallelization (DeepSeekV3, Llama4, Qwen3) to better distinguish between EP/FSDP combinations. The fix from #1895 is now applied only when it is actually required. We verified that the experiments from #1895 continue to work as expected.Because FSDP is applied after
apply_compile, we introduce an additionalfsdp_enabledflag, which results in corresponding updates to files that inherit from this logic.Finally, as was the case prior to commit 2a7a148, enabling SAC with Qwen3 30A3B triggers the warning:
This appears to be related to how SAC augments
context_fn. For Qwen3, we verified that this warning can be safely ignored. Still, we would appreciate reviewer input on how this warning should be handled going forward.