Repository navigation
[diffusion] CI: guard the anonymous-host budget alongside peak VRAM - #36051
Merged
Merged
Conversation
Peak-VRAM checks say nothing about the host: merging a LoRA into layerwise-offloaded weights rewrites the checkpoint mapping copy-on-write, turning 61.7 GB into anonymous host memory while every VRAM number stays green -- a real 32 GB machine dies where CI passes. A 1 s sampler thread in the worker tracks peak RssAnon (anonymous only: file-backed pages are droppable and not a budget cost). Snapshots carry peak_host_anon_mb, baselines may declare load/runtime host budgets, and the validator enforces them one-sided like the VRAM caps. Baselines without the fields skip the check, so adoption is per-scenario; the H3 consumer case declares its 32 GiB world as the cap. Co-Authored-By: Claude Fable 5 <[email protected]>
mickqian
requested review from
AgainstEntropy,
BBuf,
HaiShaw,
ping1jing2 and
yichiche
as code owners
August 23, 2026 07:52
…reamer The mapped/pinned host economy is the thing under test. The 5090 runner installs the runai streamer extra, whose loader bypasses the checkpoint mapping and turns the whole DiT into anonymous copies -- 65.9 GiB of host anon that the new budget check rightly failed. Pin the loader to the mapping for this case, as every measured run of the recipe does. Co-Authored-By: Claude Fable 5 <[email protected]>
…h the streamer" This reverts commit 25bed14.
A load whose destination is the CPU has one optimal reader: the mapped safetensors file, whose pages are page cache the kernel can drop and every host-memory budget downstream (layerwise offload, pinning, the mapped-weight gate) assumes. When the runai streamer extra is installed its reader was preferred even for these loads, materializing anonymous copies instead -- on the 5090 CI runner the whole 61.7 GB DiT landed in host anon and the new budget guard rightly failed the consumer case. The streamer's strengths (direct-to-GPU, remote streaming) do not apply to a local file headed for the CPU, so host-bound loads now default to the mapping; an explicit use_runai_model_streamer=True still wins. This is the product fix for what the guard caught: the recipe behaves the same however the wheel was installed, with no environment variable. Co-Authored-By: Claude Fable 5 <[email protected]>
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
Peak-VRAM checks say nothing about the host budget. The live counterexample: merging a LoRA into layerwise-offloaded weights rewrites the checkpoint-mapping copy on write, turning the 61.7 GB DiT into anonymous host memory — every VRAM number stays green,
host memory availablereads 0.0 GiB, all pin plans collapse to zero, and a real 32 GB machine dies where CI passes.This adds the host half of the budget guard:
MemorySnapshotcarriespeak_host_anon_mb; every existing capture point picks it up.load_peak_host_anon_mb/runtime_peak_host_anon_mb; the validator enforces them one-sided with the same shape as the VRAM caps (2% rel, 256 MiB pad). Scenarios without the fields skip the check, so adoption is incremental; records without host peaks (non-Linux) log and skip.Sampler verified live on Linux: a 300 MB allocation raises the reported peak by exactly 300 MB.
🤖 Generated with Claude Code
The guard's first catch, and the product fix
The first CI round failed the H3 consumer case at 65.9 GiB of host anon against the 32 GiB budget — a real defect, not a flaky test. The 5090 runner installs the runai streamer extra, whose reader was preferred even for host-bound loads; it materializes anonymous copies, so the whole 61.7 GB DiT bypassed the checkpoint mapping and every downstream budget (mapped gate, pinning) ran on nothing. Anyone who installed the streamer extra and followed the cookbook recipe would have hit the same thing on a real 32 GB machine.
The fix is in the loader, not the test: a load whose destination is the CPU now defaults to the mapped reader — mapped pages are the zero-copy optimum for host-bound weights, and the streamer's strengths (direct-to-GPU, remote streaming) do not apply there. An explicit
use_runai_model_streamer=Truestill wins. No environment variable, and the recipe behaves identically however the wheel was installed.CI States
Latest PR Test (Base): ✅ Run #32635190444
Latest PR Test (Extra): ❌ Run #32635190364
Latest PR Test (AMD ROCm 7.2): ⏳ Run #32635190460