Conversation
…ing + cache The cache Fn-blocks residual (_get_Fn_residual) subtracted a full-sequence original_hidden_states from the already CP-sharded hidden_states, crashing with a shape mismatch (e.g. 1280 vs 640) when --cache was combined with --parallel ulysses/ring (issue #1094). The CP-enabled guard only inspected diffusers' native _diffusers_hook registry, while cache-dit's own ulysses/ring runtime attaches split hooks to the vendored _cache_dit_hook registry (_ContextParallelSplitHook), so the guard was always False for the built-in CP backend and the shape-tolerance branch never triggered. - detect CP split hooks in BOTH diffusers (_diffusers_hook) and cache-dit (_cache_dit_hook) registries - shard the full-sequence original by replaying the block's own split hook (_prepare_cp_input) before subtracting, with an explicit shape guard and a proxy (hidden_states) fallback when no split hook matches - drop the now-unused HookRegistry import Verified on Wan2.2-T2V: --cache --parallel ulysses|ring no longer crashes; real cache hits (49 steps) give ~2x speedup with structurally-identical output (no garbling); the non-CP path is byte-for-byte unchanged. Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
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.
fixed #1094
The cache Fn-blocks residual (_get_Fn_residual) subtracted a full-sequence original_hidden_states from the already CP-sharded hidden_states, crashing with a shape mismatch (e.g. 1280 vs 640) when --cache was combined with --parallel ulysses/ring (issue #1094). The CP-enabled guard only inspected diffusers' native _diffusers_hook registry, while cache-dit's own ulysses/ring runtime attaches split hooks to the vendored _cache_dit_hook registry (_ContextParallelSplitHook), so the guard was always False for the built-in CP backend and the shape-tolerance branch never triggered.
Verified on Wan2.2-T2V: --cache --parallel ulysses|ring no longer crashes; real cache hits (49 steps) give ~2x speedup with structurally-identical output (no garbling); the non-CP path is byte-for-byte unchanged.