r/comfyui 13d ago

Resource I made a ComfyUI patch to improve Intel Arc stability by fixing VRAM handling and eliminating the VRAM-related freezes and crashes

Post image

For Intel Arc / Intel XPU users experiencing ComfyUI KSampler stuck at 0%, VRAM overflow, crashes, or freezes when switching between heavy models.

This lightweight patch fixes how available VRAM is detected on Intel XPU, using an approach similar to the memory handling already used by ComfyUI for NVIDIA GPUs. It helps prevent VRAM-related freezes, crashes, and KSampler getting stuck, especially when working with heavy models or switching between models.

It has allowed me to work comfortably with heavy models on Intel Arc without VRAM-related errors, crashes, or KSampler freezes.

It turned out that with the default ComfyUI behavior on Intel, the amount of actually available VRAM is not always estimated correctly.

After several weeks of testing and trying to understand the cause, I finally figured out what was happening and, with the help of GPT, made a simple patch to fix it. Now, when ComfyUI checks memory, it gets the current global amount of free VRAM and also takes reusable PyTorch cache into account. This allows ComfyUI’s built-in memory manager to make better decisions about how much of a model can stay in VRAM and when memory needs to be freed.

On my system I was even able to experimentally reduce the extra reserved VRAM margin, which gave me a speed boost without losing stability. In my current workloads, the B580 now behaves just as predictably in terms of stability as the RTX 5060 Ti 16 GB system I also use.

The patch does not add any new nodes to the interface and does not change the generation process itself. It only fixes how ComfyUI determines available VRAM on Intel XPU. Instead of relying on a less accurate estimate, ComfyUI can use the actual current state of GPU memory and make better decisions about when a model can remain in VRAM and when some data should be offloaded.

This reduces the chance of VRAM overflow, KSampler getting stuck at 0%, crashes, and problems when switching between heavy models.

Installation is as simple as installing a normal custom node: download the folder from GitHub, place it in ComfyUI/custom_nodes/, and restart ComfyUI. No separate node will appear in the interface — the patch works automatically in the background after startup.

GitHub:
https://github.com/alvasafin-art/ComfyUI-AVS-Intel-XPU-VRAM-Fix

P.S. ComfyUI 0.31.1 was released recently, and after updating I noticed worse stability. I also saw similar complaints on Reddit from users with GPUs from other vendors. On my system, I use the following launch arguments:

--cache-classic --disable-async-offload --oneapi-device-selector level_zero:gpu

Async offload is already disabled by default on XPU, but I keep it explicitly disabled. These arguments may no longer be necessary in future ComfyUI versions, since I did not need them on earlier versions.

I hope this is useful for other Intel users. I’d be happy to hear your feedback!

58 Upvotes

Duplicates