Repository navigation
Studio diffusion: keep the CFG-parallel weight probe inside large inference weights - #14844
Merged
Merged
Conversation
…ffsets so large inference weights stay in bounds
Member
Author
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
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.
Problem
#14626 added
weights_probe, which samples 64 bytes from every inference-tensor weight so CFG-parallel can notice an in-place edit and rebuild its replica. The sample offsets came fromwhere
nis the weight's size in bytes.linspaceruns in float32, so oncen - 1 >= 2**24the last offset can round up ton, one past the end:On CPU
index_selectraisesIndexError. On CUDA it is a device-side assert in the gather kernel, which poisons the CUDA context: the router catches the exception and turns CFG-parallel off, but every later CUDA call in that Studio process fails too.It is reached when a denoiser holds inference-tensor weights (loaded or moved under
torch.inference_mode) and CFG-parallel engages. The existing tests only use small weights, below 16 MiB.Fix
The offsets are computed in int64:
arange(k) * (n - 1) // (k - 1). That gives the same evenly spaced samples, always ends exactly atn - 1, and stays exact at any size. The per-size index cache and everything else are unchanged.Tests
test_probe_stays_inside_inference_weights_past_two_to_the_24_bytes: a 3072 x 3072 bf16 inference weight (18,874,368 bytes) must probe without error, return 64 samples, and see a change to its very last byte.IndexError: index out of range in selftests/test_diffusion_multigpu.py: 122 passed. The one failure,test_execution_device_reports_the_primary_of_a_split_pipeline, is anImportError(get_cached_repo_tree) from a diffusers / huggingface_hub version mismatch in the local environment and fails the same way on main.Not covered
No two-card CFG-parallel render with real inference-tensor weights was run; the fix is checked at the probe level on CPU.