[None][perf] Reordering torch.compile and cache-dit call#16508
[None][perf] Reordering torch.compile and cache-dit call#16508BrianLi23 wants to merge 8 commits into
Conversation
Signed-off-by: BrianLi23 <briannli233@gmail.com>
|
/bot help |
GitHub Bot Help
Provide a user friendly way for developers to interact with a Jenkins server. Run See details below for each supported subcommand. Details
Launch build/test pipelines. All previously running jobs will be killed.
kill
Kill all running builds associated with pull request. skip
Skip testing for latest commit on pull request. reuse-pipeline
Reuse a previous pipeline to validate current commit. This action will also kill all currently running builds associated with the pull request. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break. |
Signed-off-by: BrianLi23 <briannli233@gmail.com>
Signed-off-by: BrianLi23 <briannli233@gmail.com>
|
cc: @zhenhuaw-me |
📝 WalkthroughWalkthroughChangesCache acceleration flow
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant PipelineLoader
participant TorchCompile
participant Pipeline
participant CacheDiTAdapter
PipelineLoader->>TorchCompile: compile pipeline when enabled
TorchCompile-->>PipelineLoader: return compiled transformer blocks
PipelineLoader->>Pipeline: _setup_cache_acceleration()
Pipeline->>CacheDiTAdapter: configure compiled blocks
CacheDiTAdapter-->>Pipeline: disable forward-pattern checks
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/unittest/_torch/visual_gen/test_teacache.py`:
- Line 365: Add loader-level test coverage for the compiled Cache-DiT path by
exercising PipelineLoader.load() rather than only
BasePipeline._setup_cache_acceleration(). Assert that torch compilation occurs
before cache acceleration setup, or add an equivalent compiled Cache-DiT case
while preserving the existing direct setup tests.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: cbb8b9cb-1439-40e5-9bdd-801e5bfbeb41
📒 Files selected for processing (8)
tensorrt_llm/_torch/visual_gen/cache/cache_dit_enablers.pytensorrt_llm/_torch/visual_gen/models/flux/pipeline_flux.pytensorrt_llm/_torch/visual_gen/models/flux/pipeline_flux2.pytensorrt_llm/_torch/visual_gen/models/ltx2/pipeline_ltx2.pytensorrt_llm/_torch/visual_gen/models/wan/pipeline_wan.pytensorrt_llm/_torch/visual_gen/models/wan/pipeline_wan_i2v.pytensorrt_llm/_torch/visual_gen/pipeline_loader.pytests/unittest/_torch/visual_gen/test_teacache.py
Signed-off-by: BrianLi23 <briannli233@gmail.com>
|
@luyiyun1021 could help to take a look? |
zhenhuaw-me
left a comment
There was a problem hiding this comment.
LGTM. @luyiyun1021 @o-stoner could you also take a look? Thanks!
|
/bot run |
|
PR_Github #59821 [ run ] triggered by Bot. Commit: |
|
PR_Github #59821 [ run ] completed with state
|
|
The new SUPPORTED_CACHE_BACKENDS gate logs a warning and returns when the configured backend isn't in the pipeline's tuple. Before this PR, LTX2TwoStagesPipeline + cache_backend=cache_dit inherited LTX2Pipeline.post_load_weights's cache_dit branch and raised ValueError("Cache-DiT: no enabler registered for pipeline class 'LTX2TwoStagesPipeline'..."). Now the run proceeds at full denoise cost with one log warning. Do you think this works fine? @zhenhuaw-me |
|
Leave LTX enable cache dit with torch compile as a followup |
I think we should explicitly raise exceptions |
|
Suggested test additions (all in
|
o-stoner
left a comment
There was a problem hiding this comment.
Left a comment on perhaps enforcing explicit exception raising rather than logging, but otherwise LGTM, thanks!
|
/bot run |
|
PR_Github #61405 [ run ] triggered by Bot. Commit: |
|
PR_Github #61405 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
Signed-off-by: BrianLi23 <briannli233@gmail.com>
Head branch was pushed to by a user without write access
|
PR_Github #61417 [ run ] triggered by Bot. Commit: |
Signed-off-by: BrianLi23 <briannli233@gmail.com>
|
/bot run --disable-fail-fast |
|
PR_Github #61432 [ run ] triggered by Bot. Commit: |
|
PR_Github #61417 [ run ] completed with state |
Signed-off-by: BrianLi23 <briannli233@gmail.com>
|
LGTM. Thanks. |
|
PR_Github #61432 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #61493 [ run ] triggered by Bot. Commit: |
Summary
Test Coverage
Flux2 Before

Flux2 After

Qwen-Image Before

Qwen-Image After

WAN2.2 Before
wan22-unpatched.mp4
WAN2.2 After
https://github.com/user-attachments/assets/56498c2b-f5e8-4eed-883e-b563257d6d05
Follow up
LTX2 shows ~2.03s denoise for pre/post changes. Cache-DiT works fine in both runs (6/20 steps cached), but torch.compile seems to be broken on LTX2 as transformer_ltx2.py:1033 (v_kv_list[idx]) guards on the static block index which causes dynamo to hit the 128-recompile limit which falls back to eager. Follow-up: fix the LTX2 index guard so compile survives; until then LTX2 gets zero compile benefit even without caching.
Reapply these changes on top of [None][feat] Qwen-Image TeaCache/Cache-DiT Support #16339 to reflect changes on Qwen Image.
Summary by CodeRabbit
Bug Fixes
Tests