mirror of
https://github.com/Comfy-Org/comfy-aimdo.git
synced 2026-11-04 23:37:21 +00:00
[PR #107] [MERGED] Add runtime simple_vram_headroom accessors #118
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Comfy-Org/comfy-aimdo#118
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Comfy-Org/comfy-aimdo/pull/107
Author: @PozzettiAndrea
Created: 9/5/2026
Status: ✅ Merged
Merged: 9/6/2026
Merged by: @rattus128
Base:
master← Head:pr/headroom-accessors📝 Commits (2)
aa5bb7dAdd runtime simple_vram_headroom accessorsca1eb13Test simple_vram_headroom changes at runtime📊 Changes
3 files changed (+116 additions, -0 deletions)
View changed files
📝
comfy_aimdo/control.py(+30 -0)📝
src/control.c(+5 -0)➕
tests/simple-vram-headroom-runtime-cuda.py(+81 -0)📄 Description
The simple headroom is a process global read on every budget check (
src/plat.hbudget_deficit,src/model-vbar.cfault path), so it can already be changed while running, but the Python module never exposed that. The only runtime path is callinginit()again, which ComfyUI-ReservedVRAM does at node time (nodes.py:68-84); it works, but it is a side door that resets every otherinit()argument on the way through, and a planned change in ComfyUI will write the same value once per model load to forward its runtime reserve, today seeded once at startup (main.py:70-80, from #14480 there). The first consumer of that forward is comfy-env.Expose
set_simple_vram_headroom()andget_simple_vram_headroom(). The setter applies the bounds checkinit_devices()already applies to the per device headroom;init()keeps passing its seed straight to C, so nothing changes for existing callers. Per device belongs with #31, not here.The docstring states the three things a caller needs: raising takes effect at the next VBAR fault or hooked allocation and is honoured by evicting VBAR pages only; lowering refills nothing until a VBAR is next prioritized, which ComfyUI does at model load; and only the simple term reads it, since the measured poll term keeps its own 256 MB floor and the budget takes the larger of the two.
tests/simple-vram-headroom-runtime-cuda.py, RTX 3090, identical on 0.4.13 and this branch: 6016 MiB resident at the default headroom; a 20637 MiB runtime headroom leaves 3456 MiB resident with 20 of 47 chunks refused at the next fault; a 1504 MiB torch tensor is counted and VBAR pages make way for it; back to 256 MiB plusprioritize()refills to 6016 MiB.Contribution Agreement
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.