ComfyUI SamplerCustom 报错 subprocess.CalledProcessError|SageAttention+Triton tcc.exe 编译失败 Windows 排错

11次阅读
没有评论

根因Windows 平台 Triton 使用内置 tcc.exe 编译 cuda_utils.c 失败,subprocess.CalledProcessError

触发源:comfyui‑kjnodes 自定义节点开启了 SageAttention 注意力优化,SageAttention 强依赖 Triton JIT 编译;你的环境是 Python3.13 + CUDA13.0 + PyTorch2.12,Windows 上 triton+tcc 对 Python3.13 兼容性存在已知问题,tcc 编译链接 ‑lpython313 失败。

关键栈:

plaintext

comfyui‑kjnodes → attention_override_sage → sageattn → triton JIT → tcc.exe 编译 cuda_utils.c 报错退出码1

启动参数还带了 --use‑sage‑attention,双重开启 SageAttention。

注意:不是显存不足,两块 4090 显存空闲充足;ComfyUI‑manager 信号灯超时只是网络警告,和本次采样崩溃无关。

修复方案(按优先级,优先 1、2)

方案 1:关闭 SageAttention(最快,可直接跑通 Wan2.1)

  1. 修改启动命令:删掉启动参数里的 --use-sage-attention
  2. 工作流中,找到 comfyui‑kjnodes 的 SageAttention 优化节点,直接删除该节点,不要启用 Sage 注意力覆盖。
  3. 重启 ComfyUI,重新跑 Wan2.1 工作流。

效果:不再调用 triton+tcc,规避编译失败;会回退到原生的 torch 注意力,速度略降,生成正常。

方案 2:环境层面规避 Windows triton tcc 编译 bug

Windows 下 Triton 的 tcc 后端对 Python3.13 支持很差。

可设置环境变量,强制 Triton 不使用内置 tcc 编译器:

在启动 ComfyUI 之前设置系统环境变量:

plaintext

TRITON_USE_TCC=0

便携版操作:修改 run_nvidia_gpu.bat,在文件最顶部加入:

bat

set TRITON_USE_TCC=0

然后重启 ComfyUI。

⚠️ Windows 下 TRITON_USE_TCC=0 需要本地安装 MSVC Visual Studio Build Tools,否则 triton 编译依然失败。如果不想装 VS,优先用方案 1 关闭 SageAttention

方案 3:如果你需要保留 SageAttention(不推荐在 Windows 便携版上折腾)

  • Python3.13 在 Windows 上 triton/sageattention 兼容性很差,建议降级 Python 3.11;但你是嵌入式便携包,改动成本很高。
  • 不建议在 Windows 便携版中强行使用 SageAttention,Wan2.1 原生注意力足够可用。

排查清单

  1. ✅ 删除工作流中 comfyui‑kjnodes 的 SageAttention 优化节点
  2. ✅ 启动脚本移除 --use‑sage‑attention 参数
  3. ✅ (可选)bat 脚本添加 set TRITON_USE_TCC=0
  4. ✅ 完全关闭 ComfyUI,重新启动,再跑图

补充说明

  • 报错里 \\\\?\\ 长路径前缀是 triton 内部逻辑,不是路径问题
  • CUDA13.0 toolkit 安装存在,但 tcc.exe 链接 python313.lib 失败,属于 tcc 对高版本 python 的链接器兼容缺陷;
  • ComfyUI‑manager 的 WinError121 信号灯超时,仅网络拉取列表失败,不影响模型推理,可以忽略。
正文完
可以使用微信扫码关注公众号(ID:xzluomor)
post-qrcode
 0
评论(没有评论)
验证码