Comfy-Org / Comfy-Org/comfy-aimdo

ComfyUI start-up crash with sageattention2 installed

Open
#64 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
67
Forks
39
Avg merge
1d 25m
Merged PRs (30d)
10

Description

**Description:**
With sageattention2 installed and comfy-aimdo enabled, ComfyUI crashes on startup.
Without sageattention2 installed ComfyUI works perfectly well.
With sageattention2 installed and with --disable-dynamic-vram start option ComfyUI works perfectly well.

**Environment:**
System: Windows 11
GPU: NVIDIA RTX5090
CUDA: 13.2
Python: 3.13.13
ComfyUI version: 0.25.0 (up-to-date (git pull))

**Installed python modules**
torch 2.12.0+cu132
flash_attn 2.9.1
sageattention 2.2.0+cu132torch2.12.0 (wheel from https://huggingface.co/ussoewwin/Sage-Attention-for-Windows/)
comfy-aimdo 0.4.10
comfy-kitchen 0.2.10
comfyui_frontend_package 1.45.19
comfyui-manager 4.2.2
...

**LOG:**
[START] Security scan
[DONE] Security scan
** ComfyUI startup time: 2026-06-21 10:51:53.728
** Platform: Windows
** Python version: 3.13.13 (tags/v3.13.13:01104ce, Apr 7 2026, 19:25:48) [MSC v.1944 64 bit (AMD64)]
** Python executable: I:\AI\Tools\ComfyUI-Remote\venv\Scripts\python.exe
** ComfyUI Path: I:\AI\Tools\ComfyUI-Remote\ComfyUI
** ComfyUI Base Folder Path: I:\AI\Tools\ComfyUI-Remote\ComfyUI
** User directory: I:\AI\Tools\ComfyUI-Remote\ComfyUI\user
** ComfyUI-Manager config path: I:\AI\Tools\ComfyUI-Remote\ComfyUI\user\__manager\config.ini
** Log path: I:\AI\Tools\ComfyUI-Remote\ComfyUI\user\comfyui.log
[INFO] [PRE] ComfyUI-Manager
[INFO]
Prestartup times for custom nodes:
[INFO] 0.0 seconds: I:\AI\Tools\ComfyUI-Remote\ComfyUI\custom_nodes\rgthree-comfy
[INFO] 0.0 seconds: I:\AI\Tools\ComfyUI-Remote\ComfyUI\custom_nodes\ComfyUI-Easy-Use
[INFO]
[INFO] Found comfy_kitchen backend eager: {'available': True, 'disabled': False, 'unavailable_reason': None, 'capabilities': ['apply_rope', 'apply_rope1', 'apply_rope_split_half', 'apply_rope_split_half1', 'dequantize_mxfp8', 'dequantize_nvfp4', 'dequantize_per_tensor_fp8', 'gemv_awq_w4a16', 'quantize_mxfp8', 'quantize_nvfp4', 'quantize_per_tensor_fp8', 'quantize_svdquant_w4a4', 'scaled_mm_mxfp8', 'scaled_mm_nvfp4', 'scaled_mm_svdquant_w4a4', 'stochastic_rounding_fp8']}
[INFO] Found comfy_kitchen backend triton: {'available': True, 'disabled': True, 'unavailable_reason': None, 'capabilities': ['apply_rope', 'apply_rope1', 'apply_rope_split_half', 'apply_rope_split_half1', 'dequantize_nvfp4', 'dequantize_per_tensor_fp8', 'quantize_mxfp8', 'quantize_nvfp4', 'quantize_per_tensor_fp8']}
[INFO] Found comfy_kitchen backend cuda: {'available': True, 'disabled': False, 'unavailable_reason': None, 'capabilities': ['apply_rope', 'apply_rope1', 'apply_rope_split_half', 'apply_rope_split_half1', 'dequantize_nvfp4', 'dequantize_per_tensor_fp8', 'gemv_awq_w4a16', 'quantize_mxfp8', 'quantize_nvfp4', 'quantize_per_tensor_fp8', 'quantize_svdquant_w4a4', 'scaled_mm_nvfp4', 'scaled_mm_svdquant_w4a4', 'stochastic_rounding_fp8']}
[INFO] Checkpoint files will always be loaded safely.
[INFO] Total VRAM 32607 MB, total RAM 196240 MB
[INFO] pytorch version: 2.12.0+cu132
[INFO] Set vram state to: NORMAL_VRAM
[INFO] Device: cuda:0 NVIDIA GeForce RTX 5090 : cudaMallocAsync
[INFO] Using async weight offloading with 2 streams
[INFO] Enabled pinned memory 78496.0
[INFO] Using pytorch attention
aimdo: src-win/cuda-detour.c:38:INFO:aimdo_setup_hooks: installing 6 hooks
aimdo: src-win/cuda-detour.c:16:ALL:install_hook_entries: Hook cuMemAlloc_v2 failed 00007FFBAB635340
Windows fatal exception: access violation

Stack (most recent call first):
File "I:\AI\Tools\ComfyUI-Remote\venv\Lib\site-packages\comfy_aimdo\control.py", line 122 in init_devices
File "I:\AI\Tools\ComfyUI-Remote\ComfyUI\main.py", line 244 in
Traceback (most recent call last):
File "I:\AI\Tools\ComfyUI-Remote\ComfyUI\main.py", line 244, in
aimdo_initialized = comfy_aimdo.control.init_devices((d.index, int(args.vram_headroom * 1024 ** 3)) for d in comfy.model_management.get_all_torch_devices())
File "I:\AI\Tools\ComfyUI-Remote\venv\Lib\site-packages\comfy_aimdo\control.py", line 122, in init_devices
if lib.init(device_array, headroom_array, len(requested)):
~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: exception: access violation writing 0x0000000000000000

---
Thanks for looking into it!

Contributor guide

Open the contributing guide

Research direction

Reproduce the Windows 11 startup crash with sageattention2 and comfy-aimdo enabled, then compare it with --disable-dynamic-vram. Start at src-win/cuda-detour.c around the failed cuMemAlloc_v2 hook and follow the call into site-packages/comfy_aimdo/control.py:122 and main.py:244. Done means ComfyUI starts without the access violation in the reported configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, python
Domain
operating-systems, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.