Skip to content
,

How to Install SageAttention on Windows for ComfyUI (2026): RTX 50, 40 and 30 Step-by-Step

14โ€“21 minutes
Speeding up ComfyUI on Windows with SageAttention

SageAttention is the single biggest free speed-up for video models in ComfyUI. It replaces the standard attention maths with a quantized INT8/FP8 version, and on long Wan 2.2, LTX-2.5 or MiniMax H3 clips that is where most of the time goes. The problem is the install: on Windows you need a Triton build that matches your PyTorch, a SageAttention wheel that matches both, and the right launch flag. Get one piece wrong and you see DLL load failed, a silent fallback to normal attention, or black frames. This guide walks through a clean SageAttention install on Windows for ComfyUI in November 2026, for the portable build, a normal venv and ComfyUI Desktop, with the right settings for RTX 50, 40 and 30 cards.

TL;DR

  • Do not run pip install sageattention on Windows. It installs the old 1.0.6 package. Use a prebuilt SageAttention 2.2.0 wheel from woct0rdho/SageAttention.
  • Order: check your torch + CUDA version, install the matching triton-windows (<3.8 for PyTorch 2.12 and 2.13), test Triton, then install the SageAttention wheel with the same CUDA tag (cu128 or cu130).
  • Turn it on with --use-sage-attention in run_nvidia_gpu.bat, or per workflow with the Patch Sage Attention KJ node from KJNodes.
  • Best mode: sageattn_qk_int8_pv_fp8_cuda++ on RTX 40/50, sageattn_qk_int8_pv_fp16_cuda on RTX 30.
  • Reported gain: about 30-35% faster on an RTX 5090 (Qwen Image Edit, 40 steps, 14m30s to 9m30s). Long video gains the most.
  • No wheel at all? ComfyUI’s built-in --use-ck-attention (Comfy Kitchen INT8) gives a similar idea with nothing to install.

What SageAttention Does and How Much Faster It Is

SageAttention comes from Tsinghua University’s ML group. It quantizes the query and key matrices to INT8 (and in the “++” kernels, part of the value path to FP8) before the attention step, while keeping the output accurate enough that images and videos look the same. The cost of attention grows with the square of the number of tokens, so the longer and larger your output, the more SageAttention saves:

  • Video models (Wan 2.2, LTX-2.5, MiniMax H3, HunyuanVideo) have tens or hundreds of thousands of tokens per clip. This is where you see the big gains.
  • Large image models (Qwen-Image 2.1, FLUX 3 Klein at 2K) gain a useful amount.
  • Small, fast image models at 1024 px gain little, because attention is only a small part of each step.

For a real number: the author of the ComfyUI GitHub discussion “SageAttention on NVIDIA RTX 50-series (Blackwell)” reported about 30-35% faster generation on an RTX 5090, with a 40-step Qwen Image Edit job going from 14 min 30 s to 9 min 30 s. Treat that as a guide, not a promise. Your gain depends on the model, resolution, clip length and whether you are already short on VRAM.

Version Matching: The Part Everyone Gets Wrong

Three things have to agree: your PyTorch version, its CUDA build, and the Triton and SageAttention builds you install on top. Here is where each one stands in November 2026:

Part Current state What it means for you
ComfyUI portable Ships with Python 3.13 and a PyTorch CUDA 13.0 (cu130) build Use cu130 wheels unless you changed torch yourself
PyTorch 2.14.0 went GA on 2 Sep 2026; PyPI CUDA wheels moved to CUDA 13.0 from 2.11 cu130 is now the normal build for RTX 20 and newer
triton-windows 3.7 is listed for PyTorch 2.12 and 2.13; install with "triton-windows<3.8" Each PyTorch minor version only works with one Triton minor version, so check the table in the README
SageAttention for Windows 2.2.0-windows.post6 (fixes black or noise output from an out-of-bound bug) Wheels built against the libtorch stable ABI, named ...torch2.9.0andhigher... or ...torch2.10.0andhigher..., work across newer PyTorch versions
Python ABI Wheels are cp39-abi3 or cp310-abi3 One wheel works for Python 3.10 to 3.13

The woct0rdho release notes say the SageAttention2++ kernels support RTX 40 (sm89) and RTX 50 (sm120) with CUDA 12.8 or newer, which means PyTorch 2.7 or newer. RTX 20 (sm75) cards no longer have CUDA kernels in these wheels and run the Triton kernels instead.

One more gotcha from the Blackwell discussion: older wheels built for one exact PyTorch version give a DLL load error on a newer PyTorch. The stable-ABI “andhigher” wheels exist to fix exactly that, so prefer them.

Before You Start

  • Update your NVIDIA driver. CUDA 13.0 builds of PyTorch need a recent driver. If the portable build does not start at all, the ComfyUI docs say to update the driver first.
  • Install the Microsoft Visual C++ Redistributable (x64) from aka.ms/vs/17/release/vc_redist.x64.exe. A missing or broken redistributable causes c10.dll and other DLL errors.
  • Back up your ComfyUI folder, or at least note your current torch version, so you can roll back.
  • Close ComfyUI before you install anything into its Python.

You do not need to install the CUDA Toolkit or Visual Studio to use prebuilt wheels. Those are only needed if you compile SageAttention yourself.

Install on ComfyUI Portable (Step by Step)

Open a Command Prompt or PowerShell in the ComfyUI_windows_portable folder (the one that contains python_embeded and run_nvidia_gpu.bat). Every command below uses the embedded Python, never your system Python.

Step 1: Check your PyTorch and CUDA version

.\python_embeded\python.exe -c "import sys, torch; print(sys.version); print(torch.__version__, torch.version.cuda, torch.cuda.get_device_name(0))"

Write down the three values, for example 3.13.x, 2.13.0+cu130, 13.0 and your GPU name. The CUDA number (12.8 or 13.0) decides which SageAttention wheel you download, and the torch minor version decides your Triton version.

Step 2: Install the matching triton-windows

.\python_embeded\python.exe -m pip uninstall -y triton
.\python_embeded\python.exe -m pip install -U "triton-windows<3.8"

That is the command for PyTorch 2.12 and 2.13 (Triton 3.7). If step 1 showed a newer PyTorch, open the triton-windows README and use the version the table lists for it. Always remove any plain triton package first, because it is the Linux build and conflicts with triton-windows.

Step 3: Add the include and libs folders (embedded Python only)

The embedded Python in the portable build has no C headers, and Triton compiles small kernels on the fly, so it needs them. The triton-windows README says to put two folders, include and libs, inside python_embeded. Copy them from a normal Python install of the same version (for example from C:\Users\<you>\AppData\Local\Programs\Python\Python313\), or use the ready-made zip linked in the README’s “Special notes for embeded Python” section.

The final layout should be:

ComfyUI_windows_portable\python_embeded\include\   (Python.h and friends)
ComfyUI_windows_portable\python_embeded\libs\      (python313.lib etc.)
ComfyUI_windows_portable\python_embeded\Lib\       (already there, do not touch)

Note the spelling: it is libs, not lib, and you should not change the existing Lib folder.

Step 4: Test Triton on its own

Save this as test_triton.py in the portable folder. It is the test script from the triton-windows README:

import torch, triton, triton.language as tl

@triton.jit
def add_kernel(x_ptr, y_ptr, output_ptr, n_elements, BLOCK_SIZE: tl.constexpr):
    pid = tl.program_id(axis=0)
    offs = pid * BLOCK_SIZE + tl.arange(0, BLOCK_SIZE)
    mask = offs < n_elements
    x = tl.load(x_ptr + offs, mask=mask)
    y = tl.load(y_ptr + offs, mask=mask)
    tl.store(output_ptr + offs, x + y, mask=mask)

def add(x, y):
    out = torch.empty_like(x)
    n = out.numel()
    add_kernel[(triton.cdiv(n, 1024),)](x, y, out, n, BLOCK_SIZE=1024)
    return out

a = torch.rand(3, device="cuda")
print(add(a, a) - (a + a))
.\python_embeded\python.exe test_triton.py

If it prints tensor([0., 0., 0.], device='cuda:0'), Triton works. If it fails, fix that first (see Errors and Fixes); SageAttention will not work until Triton does.

Step 5: Download and install the SageAttention wheel

  1. Open the woct0rdho/SageAttention releases page and expand the newest release (2.2.0-windows.post6 at the time of writing).
  2. Pick the .whl whose CUDA tag matches step 1: cu130 for CUDA 13.0, cu128 for CUDA 12.8. Choose a file with andhigher in the torch part of the name and abi3 at the end, for example sageattention-2.2.0+cu130torch2.10.0andhigher.post6-cp310-abi3-win_amd64.whl.
  3. Install it with the embedded Python:
.\python_embeded\python.exe -m pip install C:\Downloads\sageattention-2.2.0+cu130torch2.10.0andhigher.post6-cp310-abi3-win_amd64.whl

You can also paste the wheel’s download URL directly after pip install instead of a local path.

Step 6: Check it imports

.\python_embeded\python.exe -m pip show sageattention
.\python_embeded\python.exe -c "from sageattention import sageattn; print('SageAttention OK')"

pip show should report version 2.2.0 (with your build tag). If it says 1.0.6, you installed the wrong package from PyPI; uninstall it and repeat step 5.

Install in a Normal venv or ComfyUI Desktop

For a manual install (git clone with a venv), the steps are the same, but you use the venv’s Python and skip step 3, because a normal Python install already has include and libs:

cd C:\AI\ComfyUI
.\venv\Scripts\activate
python -c "import torch; print(torch.__version__, torch.version.cuda)"
pip uninstall -y triton
pip install -U "triton-windows<3.8"
pip install C:\Downloads\sageattention-2.2.0+cu130torch2.10.0andhigher.post6-cp310-abi3-win_amd64.whl

ComfyUI Desktop keeps its own Python environment in a .venv folder inside the base folder you chose at install. Open the terminal built into Desktop (it runs inside that environment) and run the same pip commands, or call <base folder>\.venv\Scripts\python.exe -m pip ... directly. Desktop has no .bat file to edit, so add --use-sage-attention through its server settings if your version has an extra launch arguments field, or use the KJNodes node described next.

Linux users have it easier: there is no triton-windows, the normal triton comes with PyTorch, and you can build SageAttention from source with pip install git+https://github.com/thu-ml/SageAttention.git --no-build-isolation (it needs the CUDA toolkit for your torch build).

Turn SageAttention On in ComfyUI

Installing the package does nothing by itself. You have two ways to switch it on.

Option A: The global launch flag

Edit run_nvidia_gpu.bat in the portable folder and add the flag to the ComfyUI line:

.\python_embeded\python.exe -s ComfyUI\main.py --windows-standalone-build --use-sage-attention
pause

For a venv install, add it to your usual command: python main.py --use-sage-attention. When ComfyUI starts, the console should say it is using sage attention. If the package is missing, ComfyUI stops with “To use the --use-sage-attention feature, the sageattention package must be installed first.” If SageAttention fails on a particular model, ComfyUI prints “Error running sage attention: …, using pytorch attention instead” and carries on at normal speed, so search the console for that line when you see no speed-up. All other launch flags are in my ComfyUI command line arguments guide.

Option B: Per workflow with KJNodes (more control)

Install ComfyUI-KJNodes from the Manager (search “KJNodes”), or manually:

cd ComfyUI\custom_nodes
git clone https://github.com/kijai/ComfyUI-KJNodes
..\..\python_embeded\python.exe -m pip install -r ComfyUI-KJNodes\requirements.txt

The pack installs into ComfyUI/custom_nodes/ComfyUI-KJNodes/. Add the Patch Sage Attention KJ node between your model loader and the sampler (Load Diffusion Model or Unet Loader (GGUF) > Patch Sage Attention KJ > KSampler). Its sage_attention dropdown lets you pick the exact kernel, and only this workflow is affected. Leave the global flag off when you use the node.

The Blackwell discussion recommends this route over the global flag for RTX 50 cards, because the author saw black output with some Qwen and Wan models when ComfyUI picked a Triton kernel, and fixed it by forcing the CUDA kernel in the node. KJNodes is one of my must-have ComfyUI custom nodes anyway.

Which Mode for RTX 50, 40, 30 and 20

These are the options in the Patch Sage Attention KJ dropdown and when to use them:

Mode Use it on Notes
auto Any card, first try Lets SageAttention pick the kernel for your GPU
sageattn_qk_int8_pv_fp8_cuda++ RTX 50 (sm120), RTX 40 (sm89) The SageAttention2++ kernel, usually the fastest on these cards
sageattn_qk_int8_pv_fp8_cuda RTX 40, RTX 50 Fallback if “++” gives artefacts
sageattn_qk_int8_pv_fp16_cuda RTX 30 (sm86), and RTX 50 if you see black frames The safe CUDA kernel recommended in the Blackwell discussion
sageattn_qk_int8_pv_fp16_triton RTX 20 (sm75), or when CUDA kernels fail Uses Triton; slower than the CUDA kernels
sageattn3, sageattn3_per_block_mean RTX 50 only Needs the separate SageAttention 3 package (see below)
disabled Any Turns the patch off for this workflow

A sensible order for any card: start with auto, and only drop to the fp16 CUDA kernel if a model gives black, noisy or broken frames.

SageAttention 3 on RTX 50: Should You Use It?

SageAttention 3 uses the FP4 tensor cores that only Blackwell (RTX 50, RTX PRO 6000 Blackwell) has, and needs CUDA 12.8 or newer. It is a separate package from sageattention, so having one installed does not give you the other. woct0rdho’s release page points to a community Windows build at mengqin/SageAttention. ComfyUI and KJNodes both have code paths for it, and ComfyUI falls back to PyTorch attention with “Error running SageAttention3” if it fails.

My advice: get SageAttention 2.2 working first. FP4 attention is more aggressive and more likely to change fine detail, so treat SageAttention 3 as an experiment for long video jobs and compare outputs side by side before you rely on it.

No-Install Alternative: Comfy Kitchen Attention

Recent ComfyUI versions include their own INT8 attention through the Comfy Kitchen package. The official startup flag list describes --use-ck-attention as “use Comfy Kitchen attention, requires hardware that supports INT8 kernels”, and the built-in Model Attention Backend node offers “pytorch attention” or “comfy kitchen attention” per model (NVIDIA and AMD only; it falls back to PyTorch if not available). If the SageAttention install keeps fighting you, try this first; it needs no extra wheel. Only use one attention flag at a time, as the cross-attention flags are mutually exclusive.

You can also combine any of these with --fast fp16_accumulation for a further speed-up on RTX 40/50, at a small risk to quality.

Errors and Fixes

Error or symptom Cause Fix
ImportError: DLL load failed while importing ... when SageAttention loads Wheel built for a different torch or CUDA version Install the andhigher stable-ABI wheel with your CUDA tag
c10.dll or other DLL error, ComfyUI will not start Visual C++ Redistributable missing or broken, or old driver Repair or install vc_redist.x64, update the NVIDIA driver
Triton error mentioning Python.h or python3xx.lib No include/libs in python_embeded Do step 3 with folders from the same Python version
No module named 'triton' triton-windows not installed in the Python ComfyUI uses Install with python_embeded\python.exe -m pip, not plain pip
“not a supported wheel on this platform” Wrong file (Linux wheel, or a cp-tag your Python cannot use) Download a win_amd64 abi3 wheel
Black images or frames Old SageAttention 1.0.6, an out-of-bound bug fixed in post6, or the Triton kernel on some models Install 2.2.0 post6, or set the KJ node to sageattn_qk_int8_pv_fp16_cuda
Pure noise on very long videos Open ComfyUI issue with very large token counts (around 160K+) Shorten the clip or lower resolution, or set the KJ node to auto
No speed-up at all Flag not in the .bat you actually run, or silent fallback Search the console for “using pytorch attention instead”
Fatal Python error: Aborted on MiniMax H3 Open issue with fp8_scaled H3 and huge token counts Drop the flag for that workflow or use a smaller video (see my H3 16 GB fixes)

For errors outside attention, my list of 22 common ComfyUI errors has the rest.

How to Remove SageAttention

  1. Remove --use-sage-attention from your .bat file and delete or bypass any Patch Sage Attention KJ nodes.
  2. Run .\python_embeded\python.exe -m pip uninstall -y sageattention.
  3. Optionally remove Triton with pip uninstall -y triton-windows. Some other nodes use it for torch.compile, so only remove it if nothing else needs it.

Frequently Asked Questions

Does SageAttention work on Windows?

Yes. There is no official Windows build, but the community wheels from woct0rdho/SageAttention (2.2.0-windows releases) work with ComfyUI portable, venv installs and ComfyUI Desktop, together with triton-windows.

Which SageAttention version should I install for an RTX 5090 or 5080?

SageAttention 2.2.0 (post6 or newer) with the cu130 or cu128 wheel that matches your PyTorch build. Its SageAttention2++ kernels support RTX 50 (sm120). SageAttention 3 is an optional extra for Blackwell.

Why does pip install sageattention not work?

On Windows, pip install sageattention fetches the old 1.0.6 release, which is slower and can give black output. Install a 2.2.0 wheel from the woct0rdho releases page instead.

How do I know SageAttention is working in ComfyUI?

Check the startup console for sage attention, and make sure you never see “Error running sage attention … using pytorch attention instead” during a run. Compare the seconds per step with the flag on and off on the same workflow.

Is SageAttention worth it for image generation?

For large image models at 2K or for many steps, yes. For small models at 1024 px the gain is small. Video models gain the most, because their attention cost is far higher.

Does SageAttention reduce quality?

Normally the difference is not visible. If you see black frames, noise or artefacts, switch to the sageattn_qk_int8_pv_fp16_cuda kernel or turn it off for that model.

Do I need the CUDA Toolkit or Visual Studio?

No, not for the prebuilt wheels. You only need them to compile SageAttention from source. You do need the Visual C++ Redistributable and, for the portable build, the include and libs folders for Triton.

Final Thoughts

The whole install comes down to one rule: match everything to the torch and CUDA version your ComfyUI already uses. Check the version, install the matching triton-windows, test Triton, install the stable-ABI SageAttention 2.2 wheel, then enable it with the flag or the KJ node. Once it works, it pays off most on video. Try it with my Wan 2.2 16 GB setup and the LTX-2.5 GGUF guide, and if you are still choosing a GPU, see how much VRAM ComfyUI needs.

Sources