Comfy-Org / Comfy-Org/ComfyUI

Wrong device allocation?

Open
#13,521 0 comments 0 reactions 0 assignees View on GitHub
Potential Bug
Dominant language
Python
Stars
133k
Forks
15.7k
Avg merge
1d 7h
Merged PRs (30d)
158

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

I normally startup ComfyUI and once I start run (after I setted up a workflow), I expect the model to be loaded onto VRAM and executed on the same GPU.

### Actual Behavior

I have two CUDA GPUs inside of my setup. For whatever reason the model is loaded onto CUDA1, while the execution is running on CUDA0, producing a noticable performance loss, as the data has to be transfered from CUDA1 VRAM to CUDA0 compute.

### Steps to Reproduce

Run ComfyUI from a successful setted up workflow with two CUDA devices plugged into the computer.

### Debug Logs

```powershell
.\python_embeded\python.exe -s ComfyUI\main.py --windows-standalone-build
Found comfy_kitchen backend eager: {'available': True, 'disabled': False, 'unavailable_reason': None, 'capabilities': ['apply_rope', 'apply_rope1', 'dequantize_mxfp8', 'dequantize_nvfp4', 'dequantize_per_tensor_fp8', 'quantize_mxfp8', 'quantize_nvfp4', 'quantize_per_tensor_fp8', 'scaled_mm_mxfp8', 'scaled_mm_nvfp4']}
Found comfy_kitchen backend cuda: {'available': True, 'disabled': False, 'unavailable_reason': None, 'capabilities': ['apply_rope', 'apply_rope1', 'dequantize_nvfp4', 'dequantize_per_tensor_fp8', 'quantize_mxfp8', 'quantize_nvfp4', 'quantize_per_tensor_fp8', 'scaled_mm_nvfp4']}
Found comfy_kitchen backend triton: {'available': False, 'disabled': True, 'unavailable_reason': "ImportError: No module named 'triton'", 'capabilities': []}
Checkpoint files will always be loaded safely.
Total VRAM 49140 MB, total RAM 130199 MB
pytorch version: 2.11.0+cu130
Set vram state to: NORMAL_VRAM
Device: cuda:0 NVIDIA GeForce RTX 4090 : cudaMallocAsync
Using async weight offloading with 2 streams
Enabled pinned memory 52079.0
Using pytorch attention
aimdo: src-win/cuda-detour.c:77:INFO:aimdo_setup_hooks: found driver at 00007FFF87410000, installing 4 hooks
aimdo: src-win/cuda-detour.c:61:DEBUG:install_hook_entrys: hooks successfully installed
aimdo: src/control.c:69:INFO:comfy-aimdo inited for GPU: NVIDIA GeForce RTX 4090 (VRAM: 49139 MB)
DynamicVRAM support detected and enabled
Python version: 3.13.12 (tags/v3.13.12:1cbe481, Feb 3 2026, 18:22:25) [MSC v.1944 64 bit (AMD64)]
ComfyUI version: 0.19.3
comfy-aimdo version: 0.2.12
comfy-kitchen version: 0.2.8
ComfyUI frontend version: 1.42.14
[Prompt Server] web root: E:\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\comfyui_frontend_package\static
Asset seeder disabled

Import times for custom nodes:
0.0 seconds: E:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\websocket_image_save.py

Context impl SQLiteImpl.
Will assume non-transactional DDL.
Starting server

To see the GUI go to: http://127.0.0.1:8188
got prompt
Found quantization metadata version 1
Detected mixed precision quantization
Using mixed precision operations
model weight dtype torch.bfloat16, manual cast: torch.bfloat16
model_type FLUX
VAE load device: cuda:0, offload device: cpu, dtype: torch.bfloat16
no CLIP/text encoder weights in checkpoint, the text encoder model will not be loaded.
Found quantization metadata version 1
Using MixedPrecisionOps for text encoder
CLIP/text encoder model load device: cuda:0, offload device: cpu, current: cpu, dtype: torch.float16
Requested to load LTXAVTEModel_
Model LTXAVTEModel_ prepared for dynamic VRAM loading. 11200MB Staged. 0 patches attached. Force pre-loaded 290 weights: 1497 KB.
Model LTXAVTEModel_ prepared for dynamic VRAM loading. 11200MB Staged. 0 patches attached. Force pre-loaded 290 weights: 1497 KB.
Requested to load VideoVAE
Model VideoVAE prepared for dynamic VRAM loading. 1384MB Staged. 0 patches attached.
Model VideoVAE prepared for dynamic VRAM loading. 1384MB Staged. 0 patches attached.
Model VideoVAE prepared for dynamic VRAM loading. 1384MB Staged. 0 patches attached.
Model VideoVAE prepared for dynamic VRAM loading. 1384MB Staged. 0 patches attached.
Model VideoVAE prepared for dynamic VRAM loading. 1384MB Staged. 0 patches attached.
Requested to load LTXAV
Model LTXAV prepared for dynamic VRAM loading. 24206MB Staged. 0 patches attached.
12%|██████▏ | 1/8 [00:11<01:20, 11.56s/it, Model Initialization complete! ]Interrupting prompt 0eba4d07-e645-469c-ac1f-0f762a77c64a
12%|██████▏ | 1/8 [00:12<01:28, 12.61s/it, Model Initialization complete! ]
Processing interrupted
Prompt executed in 23.52 seconds
got prompt
Model VideoVAE prepared for dynamic VRAM loading. 1384MB Staged. 0 patches attached.
Model VideoVAE prepared for dynamic VRAM loading. 1384MB Staged. 0 patches attached.
Model VideoVAE prepared for dynamic VRAM loading. 1384MB Staged. 0 patches attached.
Model VideoVAE prepared for dynamic VRAM loading. 1384MB Staged. 0 patches attached.
Model VideoVAE prepared for dynamic VRAM loading. 1384MB Staged. 0 patches attached.
0 models unloaded.
Model LTXAV prepared for dynamic VRAM loading. 24206MB Staged. 0 patches attached.
100%|████████████████████████████████████████████████████████████████████████████████████| 8/8 [09:29<00:00, 71.17s/it]
Requested to load AudioVAE
loaded completely; 14017.40 MB usable, 693.46 MB loaded, full load: True
0 models unloaded.
Model VideoVAE prepared for dynamic VRAM loading. 1384MB Staged. 0 patches attached.
Prompt executed in 00:10:12
```

### Other

- ComfyUI does not recognize both CUDA devices
- The VRAM allocation at all seems awkward
- Other LLM backends work fine (e.g. koboldcpp, ollama) for single or dual GPU usage, including VRAM allocation

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.