ComfyUI 0.21.1 consume more Vram than 0.3.27
- 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
Expected to run ComfuUI 0.21.1 and generate even higher resolution than 1920x1088p in Z-Image with this new ComfyUI version compared to ComfyUI 0.3.27 or at least generate it faster but instead I rarely now can generate 1920x1088p in Z-Image pictures at all and only can when I lower the resolution.
### Actual Behavior
I was using portable ComfyUI 0.3.27 (version: 0.3.76)-(ComfyUI frontend version: 1.33.10) for quite some time and I never was getting CUDA out of memory error during 1920x1088p imagie generation in Z-Image on MSI 980Ti 6G but upon hearing that new ComfuUI version was released with Dynamic Memory allocation optimizations and etc I decided to give it a try and I clean installed (like I always do) portable ComfuUI 0.21.1 and now upon trying to generate the same image at 1920x1088p in Z-Image Im getting out of memory Cuda error at the final step despite the fact that upon generation it uses now 5.2GB of Vram compared to 5.9GB in ComfyUI verison 0.3.27.
### Steps to Reproduce
Copy paste Z-Image model files from older ComfyUI 0.3.27 verison to new ComfuUI 0.21.1
### Debug Logs
```powershell
H:\Comfy>.\python_embeded\python.exe -s ComfyUI\main.py --windows-standalone-build --disable-metadata
setup plugin alembic.autogenerate.schemas
setup plugin alembic.autogenerate.tables
setup plugin alembic.autogenerate.types
setup plugin alembic.autogenerate.constraints
setup plugin alembic.autogenerate.defaults
setup plugin alembic.autogenerate.comments
WARNING: You need pytorch with cu130 or higher to use optimized CUDA operations.
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 triton: {'available': False, 'disabled': True, 'unavailable_reason': "ImportError: No module named 'triton'", 'capabilities': []}
Found comfy_kitchen backend cuda: {'available': True, 'disabled': True, 'unavailable_reason': None, 'capabilities': ['apply_rope', 'apply_rope1', 'dequantize_nvfp4', 'dequantize_per_tensor_fp8', 'quantize_mxfp8', 'quantize_nvfp4', 'quantize_per_tensor_fp8']}
Checkpoint files will always be loaded safely.
Total VRAM 6144 MB, total RAM 129959 MB
pytorch version: 2.12.0+cu126
Set vram state to: NORMAL_VRAM
Device: cuda:0 NVIDIA GeForce GTX 980 Ti : native
Using async weight offloading with 2 streams
Enabled pinned memory 51983.0
Using pytorch attention
aimdo: src-win/cuda-detour.c:38:INFO:aimdo_setup_hooks: installing 6 hooks
aimdo: src-win/cuda-detour.c:28:DEBUG:install_hook_entries: hooks successfully installed
aimdo: src-win/shmem-detect.c:80:INFO:comfy-aimdo WDDM adapter match: NVIDIA GeForce GTX 980 Ti runtime_luid=00000000:00011412 dxgi_luid=00000000:00011412
aimdo: src/control.c:152:INFO:comfy-aimdo inited for GPU: NVIDIA GeForce GTX 980 Ti (VRAM: 6143 MB)
DynamicVRAM support detected and enabled
Python version: 3.12.10 (tags/v3.12.10:0cc8128, Apr 8 2025, 12:21:36) [MSC v.1943 64 bit (AMD64)]
ComfyUI version: 0.21.1
comfy-aimdo version: 0.3.0
comfy-kitchen version: 0.2.8
ComfyUI frontend version: 1.43.18
[Prompt Server] web root: H:\Comfy\python_embeded\Lib\site-packages\comfyui_frontend_package\static
Asset seeder disabled
Import times for custom nodes:
0.0 seconds: H:\Comfy\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
Using pytorch attention in VAE
Using pytorch attention in VAE
VAE load device: cuda:0, offload device: cpu, dtype: torch.float32
Requested to load ZImageTEModel_
loaded completely; 7672.25 MB loaded, full load: True
CLIP/text encoder model load device: cpu, offload device: cpu, current: cpu, dtype: torch.float16
model weight dtype torch.bfloat16, manual cast: torch.float32
model_type FLOW
Requested to load Lumina2
Model Lumina2 prepared for dynamic VRAM loading. 11739MB Staged. 0 patches attached.
100%|████████████████████████████████████████████████████████████████████████████████████| 9/9 [04:39<00:00, 31.04s/it]
Requested to load AutoencodingEngine
0 models unloaded.
Model AutoencodingEngine prepared for dynamic VRAM loading. 319MB Staged. 0 patches attached.
Prompt executed in 298.00 seconds
got prompt
Model Lumina2 prepared for dynamic VRAM loading. 11739MB Staged. 0 patches attached.
100%|████████████████████████████████████████████████████████████████████████████████████| 9/9 [04:39<00:00, 31.06s/it]
0 models unloaded.
Model AutoencodingEngine prepared for dynamic VRAM loading. 319MB Staged. 0 patches attached.
!!! Exception during processing !!! CUDA error: the launch timed out and was terminated
Search for `cudaErrorLaunchTimeout' in https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__TYPES.html for more information.
CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1
Compile with `TORCH_USE_CUDA_DSA` to enable device-side assertions.
Traceback (most recent call last):
File "H:\Comfy\ComfyUI\execution.py", line 535, in execute
output_data, output_ui, has_subgraph, has_pending_tasks = await get_output_data(prompt_id, unique_id, obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, v3_data=v3_data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "H:\Comfy\ComfyUI\execution.py", line 335, in get_output_data
return_values = await _async_map_node_over_list(prompt_id, unique_id, obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, v3_data=v3_data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "H:\Comfy\ComfyUI\execution.py", line 309, in _async_map_node_over_list
await process_inputs(input_dict, i)
File "H:\Comfy\ComfyUI\execution.py", line 297, in process_inputs
result = f(**inputs)
^^^^^^^^^^^
File "H:\Comfy\ComfyUI\nodes.py", line 316, in decode
images = vae.decode(latent)
^^^^^^^^^^^^^^^^^^
File "H:\Comfy\ComfyUI\comfy\sd.py", line 1013, in decode
model_management.raise_non_oom(e)
File "H:\Comfy\ComfyUI\comfy\model_management.py", line 286, in raise_non_oom
raise e
File "H:\Comfy\ComfyUI\comfy\sd.py", line 1006, in decode
out = self.first_stage_model.decode(samples, **vae_options).to(device=self.output_device, dtype=self.vae_output_dtype(), copy=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
torch.AcceleratorError: CUDA error: the launch timed out and was terminated
Search for `cudaErrorLaunchTimeout' in https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__TYPES.html for more information.
CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1
Compile with `TORCH_USE_CUDA_DSA` to enable device-side assertions.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "H:\Comfy\ComfyUI\execution.py", line 540, in execute
comfy.model_management.reset_cast_buffers()
File "H:\Comfy\ComfyUI\comfy\model_management.py", line 1233, in reset_cast_buffers
offload_stream.synchronize()
File "H:\Comfy\python_embeded\Lib\site-packages\torch\cuda\streams.py", line 108, in synchronize
super().synchronize()
torch.AcceleratorError: CUDA error: the launch timed out and was terminated
Search for `cudaErrorLaunchTimeout' in https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__TYPES.html for more information.
CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1
Compile with `TORCH_USE_CUDA_DSA` to enable device-side assertions.
Prompt executed in 287.06 seconds
Exception in thread Thread-1 (prompt_worker):
Traceback (most recent call last):
File "threading.py", line 1075, in _bootstrap_inner
File "threading.py", line 1012, in run
File "H:\Comfy\ComfyUI\main.py", line 366, in prompt_worker
comfy.model_management.soft_empty_cache()
File "H:\Comfy\ComfyUI\comfy\model_management.py", line 1801, in soft_empty_cache
torch.cuda.synchronize()
File "H:\Comfy\python_embeded\Lib\site-packages\torch\cuda\__init__.py", line 1181, in synchronize
return torch._C._cuda_synchronize()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
torch.AcceleratorError: CUDA error: the launch timed out and was terminated
Search for `cudaErrorLaunchTimeout' in https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__TYPES.html for more information.
CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1
Compile with `TORCH_USE_CUDA_DSA` to enable device-side assertions.
```
### Other
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.