perf: stabilize streaming budget across sampling steps (+ log noise cleanup)#1611
Open
fszontagh wants to merge 1 commit into
Open
perf: stabilize streaming budget across sampling steps (+ log noise cleanup)#1611fszontagh wants to merge 1 commit into
fszontagh wants to merge 1 commit into
Conversation
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
Two related changes: stabilize the streaming budget across sampling steps, and demote the per-step budget logs that the old behavior produced.
When
--stream-layersis active, the per-calleffective_budgetre-measured free VRAM at every compute() call. Free VRAM oscillates step-to-step (dips while a partial-offload buffer + compute buffer are live, recovers when freed), so the clamped budget swung between values like 8541 MB and 3354 MB on every step. The planner cache is keyed on the budget, so a different budget triggered a full re-merge of the base segments (150-230 ms per call on SDXL), and the chunk-K residency token could change forcing a resident-set reload.This PR:
effective_budgetto the maximum value ever observed; subsequent clamping to a lower live free-VRAM value is reverted before reaching the planner. Reset to 0 infree_params_buffer.clamping streaming budgetandgraph cut budget merge took X msare DEBUG, andstreaming budget = X MBonly logs at INFO when the budget actually ratchets up.Related Issue / Discussion
Follow-up to #1598.
Additional Information
SDXL 896x1152, 40 steps, dpm++2m karras,
--offload-to-cpu --stream-layers --max-vram -1on RTX 3060:Side effect of stable budget: planner now merges to 1 segment for SDXL and keeps it across steps, so the UNet
offload_paramsruns once per generation instead of per step.Checklist