[perf]: QAT/QAD add safe regional compile for modular training - #1718
Open
jzhang38 wants to merge 5 commits into
Open
[perf]: QAT/QAD add safe regional compile for modular training#1718jzhang38 wants to merge 5 commits into
jzhang38 wants to merge 5 commits into
Conversation
Contributor
Merge Protections🔴 1 of 1 protections blocking · waiting on 👀 reviews and 🤖 CI
🔴 PR merge requirementsWaiting for
This rule is failing.
|
Contributor
|
This PR has merge conflicts with the base branch. Please rebase: git fetch origin main
git rebase origin/main
# Resolve any conflicts, then:
git push --force-with-lease |
…ping, AC-prefix loader trap, FA3 guard + config 1. mode/options conflict: _compile_model_regions now rejects torch_compile_kwargs['mode'] with an actionable error instead of letting torch raise about an 'options' key the user never wrote (the CLI help's own example uses mode). CLI help updated. 2. Legacy stack scoping: new regional_compile flag (FastVideoArgs, default False). The modular fastvideo/train moduleloader opts in; legacy --enable-torch-compile recipes keep their pre-PR whole-model torch.compile semantics (partial graphs, kwargs passed through). 3. AC-prefix normalization in the weight loader: checkpoint_wrapper strips its prefix from state_dict() keys but not named_parameters()/ named_buffers(); with pre_fsdp_transform applying AC before load, a loaded buffer inside a wrapped block was silently converted into a TRAINABLE parameter by load_state_dict(assign=True) (verified on torch 2.12). All name-keyed lookups (buffer membership, fused weight_loader, _get_parameter_dtype at load and shard time) now compare canonical names via _strip_checkpoint_wrapper_prefix. 4. FA3: flash-attn 3's grad-enabled attention path graph-breaks, which fullgraph regional compile turns into a hard error at step 1 on Hopper hosts. The loader now detects FLASH_ATTN+fa3 and warns-and-disables compile instead of crashing, and dmd2_t2v_fa3.yaml ships the recipe with compile explicitly off (main config annotated). Tests: mode-conflict rejection; AC-prefix canonicalization incl. the buffer-stays-buffer regression under assign=True. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
H1yori233
force-pushed
the
master_add_dmd_compile
branch
from
September 2, 2026 01:48
2d43518 to
8775bff
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.
Add opt-in regional
torch.compilesupport to the YAML-driven modular Wantrainer, including compiled forward and backward execution with FA4, FSDP, and
activation checkpointing.
Fix an Inductor backward output-assembly issue that produced invalid Wan
modulation gradients, and preserve eager-like BF16 numerical behavior without
giving up steady-state compile performance.
Fixes #
Changes
training.model.enable_torch_compiletraining.model.torch_compile_kwargsfullgraph=Trueto prevent silent partial-graph fallback.FASTVIDEO_DISABLE_ATTENTION_COMPILE=1as a debugging escape hatch.scale_shift_tableand timestep-embedding gradientsemulate_precision_castsby default for regional trainingcompile so fused BF16 operators retain eager's intermediate rounding points.
Users may override it under
torch_compile_kwargs.options.Wan modulation gradient, and state-dict regression tests.
options.
Test Plan