Skip to content

control: also check device free memory on integrated GPUs - #132

Open
tvukovic-amd wants to merge 1 commit into
Comfy-Org:masterfrom
tvukovic-amd:fix/igpu-vram-pressure
Open

tvukovic-amd wants to merge 1 commit into
Comfy-Org:masterfrom
tvukovic-amd:fix/igpu-vram-pressure

Conversation

@tvukovic-amd

Copy link
Copy Markdown
Contributor

On Linux iGPUs, cuda_budget_deficit() computes the budget deficit only from /proc/meminfo MemAvailable. A BIOS carve-out is not part of MemAvailable. With a large carve-out, aimdo therefore never sees any pressure. It keeps loading weights until the device is full, and torch/HIP then runs out of memory.

Fix

Keep the MemAvailable deficit unchanged. Also poll cuMemGetInfo, the same way the discrete GPU path does (VRAM_HEADROOM), and use whichever deficit is larger. aimdo then evicts for whichever pool runs out first:

  • Carve-out: the device-memory deficit prevails and keeps VRAM below capacity.
  • GTT (small carve-out): the device limit is the GTT size. The VRAM check keeps aimdo below it, and when RAM is the tighter limit the MemAvailable deficit prevails as before.

If cuMemGetInfo fails, behavior is unchanged: the MemAvailable deficit alone decides. Discrete GPUs and Windows are untouched. Windows poll_budget_deficit() already takes the max of the DXCore/WDDM budget and cuMemGetInfo.

On Linux integrated GPUs the budget deficit came only from
/proc/meminfo MemAvailable. A BIOS carve-out is not part of
MemAvailable, so with a large carve-out aimdo never evicted, the
device filled up and torch/HIP ran out of memory (Flux.2 Dev on
Strix Halo with a 64 GB carve-out).

Also poll cuMemGetInfo, as on discrete GPUs, and use whichever
deficit is larger. With GTT the device limit is the GTT size, so
this also keeps aimdo below that limit; when RAM is the tighter
limit the MemAvailable deficit prevails as before.
@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The integrated Linux GPU budget check now compares the RAM deficit with the VRAM deficit when cuMemGetInfo succeeds. It reports the larger deficit and includes free VRAM in the poll log.

Changes: Integrated GPU budget

Layer / File(s) Summary
Compare RAM and VRAM deficits
src/control.c
When cuMemGetInfo succeeds, the check uses the VRAM deficit if it exceeds the RAM deficit. The prevailing method identifies integrated VRAM, and the poll log includes free VRAM.

Suggested reviewers: rattus128

Merge Risk: Minimal · up to 9ea16

This change makes the memory budget check on integrated Linux GPUs also consider device free memory, so eviction can trigger when a BIOS carve-out is the limiting pool. No concrete merge-blocking risk was identified, and discrete GPUs and Windows are described as unchanged.

Pre-merge checks: Passed 2

Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Finishing Touches

Generate unit tests (beta)

  • Create a new PR
Simplify code

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 71a9bdfc-e2d6-4432-b5d9-9ddd390d34e9
Commits

Reviewing files that changed from the base of the PR and between 68088de and 9ea1686.

Files selected for processing: 1

  • src/control.c

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@coderabbitai
coderabbitai Bot requested a review from rattus128 November 12, 2026 13:38

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant