mirror of
https://github.com/Comfy-Org/comfy-aimdo.git
synced 2026-11-04 23:37:21 +00:00
[GH-ISSUE #25] bug & fix: ModelVBAR crashes on NVIDIA GRID / vGPU instead of falling back #7
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#7
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?
Originally created by @gregdotcom on GitHub (Mar 17, 2026).
Original GitHub issue: https://github.com/Comfy-Org/comfy-aimdo/issues/25
Hey,
i ran into a MemoryError on my setup even though I have enough VRAM.
Took a while to figure out but the issue is that VBAR allocation just fails silently on virtualized GPUs (vGPU environments) and then throws a hard exception instead of falling back gracefully.
MemoryError: VBAR allocation failed File "execution.py", line 525, in execute File "execution.py", line 334, in get_output_data File "custom_nodes/rgthree-comfy/py/power_prompt_simple.py", line 39, in main conditioning = CLIPTextEncode().encode(opt_clip, prompt)[0] File "nodes.py", line 80, in encode return (clip.encode_from_tokens_scheduled(tokens), ) File "comfy/sd.py", line 375, in encode_from_tokens self.load_model(tokens) File "comfy/model_management.py", line 819, in load_models_gpu loaded_model.model_load(lowvram_model_memory, ...) File "comfy/model_patcher.py", line 1495, in _vbar_get vbar = comfy_aimdo.model_vbar.ModelVBAR(self.model_size() * 10, self.load_device.index) File "comfy_aimdo/model_vbar.py", line 51, in __init__ raise MemoryError("VBAR allocation failed")My setup: GRID RTX6000-24Q (24GB vGPU), Ubuntu, CUDA 12.8
VBAR cannot allocate because the underlying low-level CUDA memory ops aren't fully supported in virtualized environments.
What I changed (i got help from AI to find a working fix)
ModelVBAR.__init__no longer raisesMemoryErrorwhen allocation fails, instead sets_disabled = Trueand emits aRuntimeWarningalloc,fault,prioritize,deprioritize,loaded_size, etc.) check_disabledand return safe dummy values instead of crashingvbar_fault()andvbar_unpin()module-level functions also handleNonealloc gracefully nowComfyUI runs fine without VBAR on these setups anyway since the optimization doesn't really work in a virtualized context, so this just makes it degrade nicely instead of hard crashing.
Or do i miss something else?
@rattus128 commented on GitHub (Mar 18, 2026):
This wheel has a built is self-test for startup that will disable the system wholesale if it can get those functions to work:
https://github.com/Comfy-Org/comfy-aimdo/actions/runs/23231132334
Give it a go. It will wholesale disable the dynamic vram system when it fails those APIs.
The degradation you experience is actually full offloading as with no vbar a ModelPatcherDynamic cannot load the model to the GPU at all. The performance of this is often actually quite good and we have had a user following using the --novram mode which is very similar in behaviour (this switches off aimdo though).
If you want the best of both worlds, where you have the --novram model load behaviour but with the dynamic VRAM features we should actually support that in core comfy rather than aimdo, as we can just make your no-vbar dynamic VRAM a mode.
It has to be opt-in as users will assume loaded models we cant fallback to non-loaded models as a default.
@gregdotcom commented on GitHub (Mar 29, 2026):
Thanks for the new build, working fine now.
Here's the log of the running with your build:
I also tested the latest version of comfy-aimdo with the flag
--novrambut as expected that falls back to CPU only:Just noticed I'm probably not alone with this – looks like there might be other with this issue. It seems to happen with PyTorch >2.8.x: Comfy-Org/ComfyUI#13015
I will link the findings there too, maybe it helps track down a proper fix.
It's bit above my technical level to dig deeper into it myself but happy to test things if needed.
@sicp-dnegvp commented on GitHub (Mar 31, 2026):
Any chance this can get fixed soon? Running into this as well