Repository navigation
Studio video: pin offloaded weights at their size, not a power of two - #15179
Merged
Merged
Conversation
The whole-module offload tier packs a module's weights into pinned chunks through torch's host allocator, which rounds every chunk up to a power of two. On Wan2.2-TI2V-5B under a 12 GiB budget the TE / DiT / VAE pinned 16.11 GB for 14.53 GB of weights. Video loads now allocate each chunk in registered host memory sized to its bytes (page granular), with the same slots, so the device uploads and outputs are unchanged. Each chunk's weights move to it as soon as it is registered, so the pageable copy is not held twice for the whole module. The background pinner's GGUF weights take the same registered copy (re-wrapped with their quant type) instead of a power-of-two pin_memory(). Kill switch: UNSLOTH_VIDEO_EXACT_PIN=0.
Member
Author
|
@codex review |
1 similar comment
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. Nice work! 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". |
[skip ci]
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.
Summary
On Linux / CUDA, Studio's video background pinner already pins one page-rounded block per tensor (
cudaHostRegister). One video path still went through power-of-two rounding: the whole-module ("model") offload tier,_pin_host_weights.pin_memory()for these, so a 5.3 MB Q4_K weight took 8 MiB.Changes
host_pinning_allowed()first, so nothing is pinned there.UNSLOTH_VIDEO_EXACT_PIN=0.Results
Exclusive B200 lease for the whole run. Wan2.2-TI2V-5B, 12 GiB cap, model tier, 1280x704x17, 8 steps. 4 reps per arm in rotating order, 3 renders per process; medians (min-max).
Tests
tests/test_video_exact_pin.py:tests/test_video_*.pyand the pin suites: 2812 passed, 109 skipped. One failure,test_every_pinning_site_asks_the_integrated_gpu_predicate_or_is_reached_through_one, also fails on main because of the offload cost probe; Studio diffusion: skip the offload cost probe's pinned buffer on an integrated GPU #15178 fixes it.Limits