Repository navigation
fix: run cache_dit's computed steps compiled on pre-rc23 TRT-LLM (1.16-1.19x on Wan2.2-A14B); configurable warmup shapes - #55
Merged
Johan-de-R merged 1 commit intoOct 22, 2026
Conversation
…LM; configurable warmup shapes On TRT-LLM < 1.3.0rc23 the PipelineLoader enables cache_dit (post_load_weights) before torch_compile, and torch_compile swaps a new ModuleList of compiled blocks onto the transformer. cache_dit's BlockAdapter keeps the original list, so every computed denoising step runs eager. Upstream fixed the ordering in NVIDIA/TensorRT-LLM#16508 (merged 2026-07-24, first in rc23); our video image is on rc14. Measured on 1xB200 with Wan2.2-T2V-A14B (1280x720, 81 frames, 50 steps, cache_dit): computed steps 12.04 s vs ~10.4 s compiled. When cache_backend is cache_dit, compile is on, and the installed TRT-LLM predates rc23, BasePipeline.torch_compile is replaced with one that compiles each block into the existing ModuleList. Newer TRT-LLM keeps upstream's behaviour. Also add --warmup-resolutions / --warmup-num-frames (mapped to VisualGen's CompilationConfig). The Wan pipeline's default warmup compiles {480x832, 720x1280} x {33, 81} = 4 shapes while our API serves only 720x1280x81; warming just that shape cut load+warmup from 139.8 s to 99.8 s with no recompile on the first request. Tests: warmup string parsing and CompilationConfig wiring; the version gate; and that compiled blocks land in the list object cache_dit holds (fails if compile swaps in a new list). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Johan-de-R
had a problem deploying
to
external_collaborator
October 21, 2026 21:41 — with
GitHub Actions
Failure
temirulan
approved these changes
Oct 22, 2026
temirulan
left a comment
There was a problem hiding this comment.
Approving. I checked the change against upstream TRT-LLM v1.3.0rc14 source, and the fix is correct.
What I verified
- The bug is real, and rc23 is the right gate. In rc14,
WanPipeline.post_load_weights()sets up cache_dit.cache_dit_enablers.pybuildsBlockAdapter(blocks=[pipeline.transformer.blocks, transformer_2.blocks])from the originalModuleListobjects.PipelineLoaderthen callspipeline.torch_compile(), which doessetattr(model, block_name, nn.ModuleList(compiled_blocks)), so cache_dit is left holding the uncompiled list.pipeline_loader.pyin rc22 vs rc23 confirms_setup_cache_acceleration()moves to aftertorch_compile()starting in rc23. - The replacement
torch_compilebehaves like upstream. It uses the sametransformer_components(transformerandtransformer_2on Wan 2.2), the same_find_transformer_blocks,mode="default",dynamic=Noneandenable_fullgraph. The only difference is that blocks are assigned into the existing list. Any component without a block list (or missing) falls back to the original method. The gate can only misfire on dev builds like1.3.0rc23.dev0, and that is harmless because compiling in place is correct whichever order the loader uses. - The warmup flags match rc14's
CompilationConfig. Both fields areOptional[...] = None, andresolve_warmup_plan()falls back to each model default separately. Setting only one of the two flags therefore behaves as expected, and leaving both unset passes nocompilationkwarg. - The measurements fit the mechanism. Computed steps take 10.40 s with cache_dit vs 10.38 s for dense compiled, so the cached path now runs the compiled blocks.
Non-blocking nits
- A malformed
--warmup-resolutions(e.g.720x1280x81or720*1280) fails at startup with a bareValueError: too many values to unpack. A short error message naming the flag would make a bad model-CD arg quicker to diagnose. - The title says 1.18x but the table shows 1.16x per clip; 1.16x is the per-step speedup on computed steps.
- When rolling out, remember that any request outside 720x1280x81 will trigger a recompile on first hit once warmup is narrowed to that one shape. That's fine as long as the API keeps pinning the shape.
I couldn't run the test file locally because it needs the dynamo.llm Rust extension. I'm relying on your 11/11 result from the prod image.
Johan-de-R
added a commit
that referenced
this pull request
Oct 22, 2026
Review feedback on #55: '720*1280' or '720x1280x81' raised a bare 'too many values to unpack' at worker start. Both warmup parsers now raise a ValueError that names the flag and shows the expected format. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch had an error being deployed
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.
What
PipelineLoaderattaches cache_dit (inpost_load_weights) beforetorch_compile, andtorch_compileswaps a newModuleListof compiled blocks onto the transformer. cache_dit'sBlockAdapterkeeps the original list, so every computed denoising step runs eager. Upstream fixed the order in NVIDIA/TensorRT-LLM#16508 (first in rc23); our video image is on rc14. The engine now replacesBasePipeline.torch_compilewith one that compiles each block into the existing list, only under those three conditions.--warmup-resolutions/--warmup-num-frames(envDYN_TRTLLM_WARMUP_RESOLUTIONS/DYN_TRTLLM_WARMUP_NUM_FRAMES), mapped to VisualGen'sCompilationConfig. Unset keeps the pipeline defaults. Wan's default warmup compiles {480x832, 720x1280} x {33, 81}; our API only serves 720x1280x81.Measured (1x B200, Wan2.2-T2V-A14B, 1280x720, 81 frames, 50 steps, guidance 4.0/3.0 @ 0.875, cache_dit, prod image
trtllm-visualgen:1.2.1-wan22t2v-cachedit-swenc-a9f16fe9)--warmup-resolutions 720x1280 --warmup-num-frames 81Quality, 12 public prompts with fixed seeds: LPIPS vs the full 50-step uncached output 0.160 (production: 0.169), CLIP -0.3%. LPIPS vs production 0.124 mean: compiled kernels round differently from eager ones. Side-by-side review of all 12 pairs: no visible difference except one production artifact (convertible clip) that this output does not have.
Tests
TestWarmupShapes: string parsing; configured shapes becomeCompilationConfig(resolutions=..., num_frames=...); unset keeps defaults.TestCompileBlocksInPlace: version gate (rc22 patched, rc23+/1.4 not); compiled blocks land in the list object cache_dit holds (fails if compile swaps in a new list, checked by mutation); fallback to the original method when a component has no block list.pytest_asynciois not installed in the runtime image).After review
trtllm-visualgen:1.2.1-wan22t2v-cachedit-swenc-43e67c0fmeasured 223 s (1.19x). In production since Oct 21, 4:06 pm PT.Wan22T2VIn) only serves 720p landscape 81 frames.--warmup-resolutionsgoes into feat: expose cache_dit threshold / max-continuous / Wan 2.2 low-noise budget #56 to keep this approved PR unchanged.Rollout
New image = current prod image + these 3 files, then Wan2.2-T2V-A14B via model-CD with
--warmup-resolutions=720x1280 --warmup-num-frames=81added.🤖 Generated with Claude Code