Comfy-Org / Comfy-Org/ComfyUI

XPU out of memory. Tried to allocate 5.12 GiB (GPU 0; 15.11 GiB total capacity; 13.40 GiB already allocated; 13.90 GiB reserved in total by PyTorch)

Open
#8,767 2 comments 0 reactions 0 assignees View on GitHub
Potential Bug
Dominant language
Python
Stars
133k
Forks
15.7k
Avg merge
1d 6h
Merged PRs (30d)
155

Description

### Custom Node Testing

- [x] I have tried disabling custom nodes and the issue persists (see [how to disable custom nodes](https://docs.comfy.org/troubleshooting/custom-node-issues#step-1%3A-test-with-all-custom-nodes-disabled) if you need help)

### Expected Behavior

Hi all
I installed ComfyUI as described here:
https://comfyui-wiki.com/en/install/install-comfyui/install-comfyui-on-linux
and also, after acticating my venv AND installing requirements.txt, I added:
pip install torch==2.7.0 torchvision==0.22.0 torchaudio==2.7.0 --index-url https://download.pytorch.org/whl/xpu
and:
pip install intel-extension-for-pytorch==2.7.10+xpu oneccl_bind_pt==2.7.0+xpu --extra-index-url https://pytorch-extension.intel.com/release-whl/stable/xpu/us/
Also I chose a image workflow to start with, which uses as checkpoint:
/home/debian/ComfyUI4IPEX/models/checkpoints/sd3.5_large_fp8_scaled.safetensors
So my Q's are:
1) may be the model is too large for a 16GB VRam GPU?
2) did I miss some pip wheels to also install to get an ARC A770 up and running with ComfyUI?
3) are there some CLI parameters to test my env with?
Following the report from ComfyUI:
# ComfyUI Error Report
## Error Details
- **Node ID:** 3
- **Node Type:** KSampler
- **Exception Type:** RuntimeError
- **Exception Message:** XPU out of memory. Tried to allocate 5.12 GiB (GPU 0; 15.11 GiB total capacity; 13.40 GiB already allocated; 13.90 GiB reserved in total by PyTorch)

## Stack Trace
...
## System Information
- **ComfyUI Version:** 0.3.43
- **Arguments:** main.py
- **OS:** posix
- **Python Version:** 3.11.2 (main, Apr 28 2025, 14:11:48) [GCC 12.2.0]
- **Embedded Python:** false
- **PyTorch Version:** 2.7.1+xpu
## Devices

- **Name:** xpu
- **Type:** xpu
- **VRAM Total:** 16225243136
- **VRAM Free:** 16225243136
- **Torch VRAM Total:** 0
- **Torch VRAM Free:** 0
...
File "/home/debian/ComfyUI4IPEX/comfy/ldm/modules/diffusionmodules/mmdit.py", line 665, in forward
return block_mixing(
^^^^^^^^^^^^^
File "/home/debian/ComfyUI4IPEX/comfy/ldm/modules/diffusionmodules/mmdit.py", line 604, in block_mixing
return _block_mixing(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/debian/ComfyUI4IPEX/comfy/ldm/modules/diffusionmodules/mmdit.py", line 620, in _block_mixing
attn = optimized_attention(
^^^^^^^^^^^^^^^^^^^^
File "/home/debian/ComfyUI4IPEX/comfy/ldm/modules/attention.py", line 451, in attention_pytorch
out = torch.nn.functional.scaled_dot_product_attention(q, k, v, attn_mask=mask, dropout_p=0.0, is_causal=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: XPU out of memory. Tried to allocate 5.12 GiB (GPU 0; 15.11 GiB total capacity; 13.40 GiB already allocated; 13.90 GiB reserved in total by PyTorch)

2025-07-02T15:00:36.204477 - Prompt executed in 39.91 seconds

```
## Attached Workflow
Please make sure that workflow does not contain any sensitive information such as API keys or passwords.

Any hint to solve will be highly appreciated.
Thanks for your support/feedback.
Kind regards,
Roger

### Actual Behavior

ComyUI stops with hint in terminal on:
RuntimeError: XPU out of memory.

### Steps to Reproduce

- clean install of Debian Bookworm w/ Backports repo
- clean install as mentioned here: https://comfyui-wiki.com/en/install/install-comfyui/install-comfyui-on-linux
- select a workflow after initial startup and showing GUI
- download the relevant checkpoint/model for this workflow
- make sure this one is in correct folder
- click on 'Run'
- error message arises

### Debug Logs

```powershell
## Logs

2025-07-02T14:59:45.762020 - Checkpoint files will always be loaded safely.
2025-07-02T14:59:49.297928 - Total VRAM 15474 MB, total RAM 128710 MB
2025-07-02T14:59:49.298010 - pytorch version: 2.7.1+xpu
2025-07-02T14:59:49.298248 - Set vram state to: LOW_VRAM
2025-07-02T14:59:49.298328 - Device: xpu
2025-07-02T14:59:49.325881 - Using pytorch attention
2025-07-02T14:59:50.301515 - Python version: 3.11.2 (main, Apr 28 2025, 14:11:48) [GCC 12.2.0]
2025-07-02T14:59:50.301602 - ComfyUI version: 0.3.43
2025-07-02T14:59:50.305053 - ComfyUI frontend version: 1.23.4
2025-07-02T14:59:50.305557 - [Prompt Server] web root: /home/debian/ComfyUI4IPEX/venv/lib/python3.11/site-packages/comfyui_frontend_package/static
2025-07-02T14:59:51.084503 -
Import times for custom nodes:
2025-07-02T14:59:51.084600 - 0.0 seconds: /home/debian/ComfyUI4IPEX/custom_nodes/websocket_image_save.py
2025-07-02T14:59:51.084628 -
2025-07-02T14:59:51.302521 - Context impl SQLiteImpl.
2025-07-02T14:59:51.302585 - Will assume non-transactional DDL.
2025-07-02T14:59:51.303527 - No target revision found.
2025-07-02T14:59:51.310150 - Starting server

2025-07-02T14:59:51.310525 - To see the GUI go to: http://127.0.0.1:8188
2025-07-02T14:59:56.293086 - got prompt
2025-07-02T14:59:56.422919 - Using scaled fp8: fp8 matrix mult: False, scale input: True
2025-07-02T14:59:56.470341 - model weight dtype torch.float16, manual cast: None
2025-07-02T14:59:56.470832 - model_type FLOW
2025-07-02T14:59:57.502297 - Using pytorch attention in VAE
2025-07-02T14:59:57.503498 - Using pytorch attention in VAE
2025-07-02T14:59:57.579553 - VAE load device: xpu:0, offload device: cpu, dtype: torch.bfloat16
2025-07-02T14:59:57.601337 - Using scaled fp8: fp8 matrix mult: False, scale input: False
2025-07-02T14:59:57.805842 - Requested to load SD3ClipModel_
2025-07-02T14:59:57.830978 - loaded completely 9.5367431640625e+25 6228.190093994141 True
2025-07-02T14:59:57.852449 - 2025-07-02 14:59:57,852 - _logger.py - IPEX - INFO - Conv BatchNorm folding failed during the optimize process.
2025-07-02T14:59:57.860028 - 2025-07-02 14:59:57,859 - _logger.py - IPEX - INFO - Linear BatchNorm folding failed during the optimize process.
2025-07-02T14:59:58.856414 - CLIP/text encoder model load device: cpu, offload device: cpu, current: cpu, dtype: torch.float16
2025-07-02T15:00:01.984502 - 2025-07-02 15:00:01,984 - _logger.py - IPEX - INFO - Conv BatchNorm folding failed during the optimize process.
2025-07-02T15:00:01.993176 - 2025-07-02 15:00:01,993 - _logger.py - IPEX - INFO - Linear BatchNorm folding failed during the optimize process.
2025-07-02T15:00:15.689182 - 2025-07-02 15:00:15,689 - _logger.py - IPEX - INFO - Conv BatchNorm folding failed during the optimize process.
2025-07-02T15:00:15.698637 - 2025-07-02 15:00:15,698 - _logger.py - IPEX - INFO - Linear BatchNorm folding failed during the optimize process.
2025-07-02T15:00:29.540064 - Requested to load SD3
2025-07-02T15:00:34.656654 - loaded completely 14254.39716796875 7683.561706542969 True
2025-07-02T15:00:34.767417 - 2025-07-02 15:00:34,767 - _logger.py - IPEX - INFO - Currently split master weight for xpu only support sgd
2025-07-02T15:00:34.788017 - 2025-07-02 15:00:34,787 - _logger.py - IPEX - INFO - Conv BatchNorm folding failed during the optimize process.
2025-07-02T15:00:34.799353 - 2025-07-02 15:00:34,799 - _logger.py - IPEX - INFO - Linear BatchNorm folding failed during the optimize process.
2025-07-02T15:00:35.056153 -
0%| | 0/20 [00:00

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.