Repository navigation
Studio LoRA fuse: charge the host RAM guard what the pinned backup really holds - #17191
Merged
Merged
Conversation
Weights over 64 MiB were backed up in exact-size pinned slabs, which the pinned host allocator rounds up to a power of two, so the host reserve check added in #17086 was charged less than the backup really held. Pinned backups are now packed into power-of-two chunks (largest first), and the guard is charged those chunk sizes. UNSLOTH_DIFFUSION_LORA_FUSE_POW2_PACK=0 keeps the old layout.
Codex Review Summary: ✅ CompletedThis 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. |
Member
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. 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". |
danielhanchen
added a commit
that referenced
this pull request
Nov 9, 2026
…uff-unsloth wheel (#17211) ## Summary The Backend CI step that installs the pinned `ruff-unsloth` wheel retries 3 times with 5 s and 10 s gaps. Between 05:19 and 05:40 UTC today, GitHub served intermittent 504s for the release asset, and every attempt of an unlucky job landed inside one burst. That turned `Repo tests (CPU, fsdp2 / gloo-cp / gloo-pp / gloo-tp / rest / studio-install)` red on #17188, #17191, #17197, #17201 and #17202, while sibling jobs in the same runs installed the wheel fine a minute later. This raises the loop to 6 attempts with exponential backoff (10, 20, 40, 80, 160 s, about 5 minutes total). A healthy download still never sleeps, and a lasting outage still fails the job with the same `::error::` line, so the fixed-point formatter guard keeps failing loudly in CI when the wheel is truly unavailable. ## Changes - `.github/workflows/studio-backend-ci.yml`: 6 attempts, `sleep $((10 << (attempt - 1)))`. - `tests/test_ruff_unsloth_install_retries.py`: runs the step's own `run:` script under bash with `pip` and `sleep` faked on `PATH`, and checks that - 5 failed downloads in a row still install, after at least 300 s of backoff, - a download that never recovers still fails the job, in under 10 minutes, - a healthy download does not wait at all. ## Testing - `pytest tests/test_ruff_unsloth_install_retries.py`: 3 passed. - Against the old step from `main`, the burst test fails with `ruff-unsloth install failed after 3 attempts`. - The other tests that read `studio-backend-ci.yml` pass.
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.
Follow-up to #17086.
What happened
#17086 added a host RAM reserve check before the LoRA fuse allocates its host backup of the original weights. The check is charged
sum(sizes)of the backup layout. Weights up to 64 MiB share 64 MiB chunks, which the pinned host allocator keeps at their size. A weight larger than 64 MiB, though, got its own slab of exactly its size, and CUDA's caching host allocator rounds every pinned block up to a power of two. A 72 MiB slab therefore holds 128 MiB, and a 126 MiB slab holds 128 MiB.FLUX-sized denoisers hit this: their
3072 x 12288,3072 x 21504and15360 x 3072bf16 projections are all over 64 MiB. In the layout below (24 x 72 MiB, 4 x 126 MiB, 4 x 90 MiB, 8 x 18 MiB) the guard was charged 2784 MiB while the pinned allocator held 4288 MiB, so a backup could pass the check and still take about 1.5 GiB out of the reserve it is meant to keep.What changed
UNSLOTH_DIFFUSION_LORA_FUSE_POW2_PACK=0restores the previous layout and charge.Placement, copy, fold and restore are unchanged: each weight still gets an aligned view into one chunk.
Tests
studio/backend/tests/test_diffusion_lora_fuse.py:test_the_host_guard_is_charged_what_the_pinned_allocator_holdsrunsfuseon the FLUX-like layout with a recording pinned allocation and checks that the guard charge covers the power-of-two rounded blocks. On main it fails (2919235584 >= 4496293888); with this change it passes.test_power_of_two_layout_places_every_weight_inside_its_chunkchecks that the chunks are powers of two, offsets are aligned, and no weights overlap.test_power_of_two_packing_kill_switch_keeps_the_exact_slabschecks the opt-out.The full file passes on CPU (20 passed, 2 CUDA-only skips).