Skip to content

How-ToGPU

How to Install SageAttention in ComfyUI on Windows and Linux

How to install Triton and SageAttention into ComfyUI on Windows or Linux, which SageAttention version pip actually offers, and how to switch it on with the --use-sage-attention flag.

By , Systems & Technical Editor

5 min read

How to Install SageAttention in ComfyUI on Windows and Linux

The steps come from the SageAttention, triton-windows and ComfyUI GitHub pages, plus the Python Package Index (PyPI), all read on 2 December 2026. Any speed figures are the developers' own claims.

SageAttention is a free, Apache-2.0-licensed set of GPU kernels from the thu-ml research group. It speeds up the "attention" step inside transformer models by quantising parts of it to 8-bit (INT8 and FP8) instead of running it all at 16-bit. Modern image models such as FLUX are diffusion transformers (DiT), so they run attention at every step. ComfyUI has a built-in switch for it: the --use-sage-attention launch flag.

The project's own description claims a 2 to 5 times speed-up over FlashAttention for the attention step "without losing end-to-end metrics", and the README says that on an RTX 5090 SageAttention reaches "560T", 2.7 times faster than FlashAttention2. Those are kernel figures from the researchers. A whole image generation includes other work too, so don't expect your total render time to shrink by the same amount.

Read this before you start

ComfyUI's own troubleshooting advice is blunt: "Remove all command line flags from ComfyUI. All of the command line flags that people claim improve performance do the opposite." The maintainers don't single out SageAttention, but the message is clear: a flag isn't automatically faster on your set-up. Time a few generations before and after, and remove the flag if it doesn't help. Make a note of your ComfyUI version and back up your install (or update ComfyUI first), because Triton and SageAttention install into the same Python environment as everything else.

What you need

  • An NVIDIA RTX 30-series card or newer for the current version. The README says SageAttention 2 has optimised kernels for Ampere (RTX 30), Ada (RTX 40) and Hopper GPUs, and the compilation code was updated for the RTX 5090. Blackwell cards (RTX 50-series) need CUDA 12.8 or newer.

  • Python 3.9+, PyTorch 2.3+ and Triton 3.0+, according to the README's base requirements. CUDA 12.0 or newer for Ampere, 12.4+ for FP8 on Ada, 12.8+ for Blackwell or SageAttention2++.

  • On Windows, the triton-windows package, because the official Triton isn't built for Windows.

Older cards: triton-windows says Turing (RTX 20 and GTX 16-series) only works with Triton 3.2, and consumer Pascal (GTX 10-series) isn't supported at all. triton-windows also lists recent AMD Radeon cards, but SageAttention's README only lists NVIDIA GPUs, so we wouldn't count on it with a Radeon.

Step 1: Find the right Python

This is where most installs go wrong. If you use the ComfyUI Windows portable build, it has its own Python in the python_embeded folder. triton-windows warns not to run plain python or pip in that case, because they may point to a different Python on your PC. Use the full path instead:

C:\path\to\python_embeded\python.exe -m pip ...

If you use the ComfyUI desktop app, a venv, uv or conda, run everything from that environment. Our ComfyUI desktop vs portable comparison explains the two Windows options.

Step 2: Install Triton (Windows only)

On Windows you need triton-windows, a fork of Triton with Windows support; on Linux, use the standard Triton that matches your PyTorch. Its README asks you to uninstall any old triton package first, then install a version that matches your PyTorch. Its compatibility table pairs each PyTorch minor version with one Triton version, for example PyTorch 2.7 with Triton 3.3, 2.8 with 3.4 and 2.9 with 3.5. The README's example for embedded Python is:

C:\path\to\python_embeded\python.exe -m pip install -U "triton-windows<3.9"

Change the upper limit to suit your PyTorch version using that table. A few more notes from the triton-windows README:

  • Recent wheels bundle a minimal CUDA toolchain and the TinyCC compiler, so packages that call triton.jit directly, which it says includes SageAttention, "just work" without installing CUDA or a C compiler yourself.

  • You do need the Visual C++ Redistributable (2015-2022) installed.

  • For embedded Python, you also need to put include and libs folders into the Python folder. The README links a download for ComfyUI portable builds that use Python 3.13.

triton-windows has a short test script in its README. Run it with the same Python before going any further: if it doesn't print a tensor of zeros, SageAttention won't work either.

Step 3: Install SageAttention

Here's a catch the README doesn't spell out. Its quick install line is pip install sageattention==2.2.0 --no-build-isolation, but when we checked PyPI on 2 December 2026 the newest version listed there was 1.0.6. That's SageAttention 1, the Triton-only version, which the README says is slower than SageAttention 2, 2++ and 3.

So you have two choices:

  • Quick: SageAttention 1 from PyPI. python -m pip install sageattention==1.0.6 (using your ComfyUI Python). It's pure Triton, so it only needs a working Triton.

  • Faster kernels: build SageAttention 2.2.0 from source. The README's route is to clone https://github.com/thu-ml/SageAttention.git and run python setup.py install. That compiles CUDA code, so you need a CUDA toolkit and compiler that match your PyTorch. It's straightforward on Linux and more fiddly on Windows.

SageAttention3, which targets Blackwell's FP4 hardware, sits in its own sageattention3_blackwell folder in the repo. The developers say they still recommend SageAttention2 when accuracy matters.

Step 4: Turn it on in ComfyUI

Add --use-sage-attention to your ComfyUI launch command. With a manual install that looks like:

python main.py --use-sage-attention

On the Windows portable build, add the flag to the end of the launch line in the .bat file you start ComfyUI with. Generate the same image at the same seed with and without the flag and compare the time and the output. If ComfyUI fails to start or throws errors, take the flag off first, then re-run the Triton test script.

Which GPU makes sense

Because SageAttention 2 targets Ampere and newer, even an older ASUS RTX 3060 12GB Dual Gaming OC V2 is covered. A Blackwell card such as the MSI RTX 5070 Ti 16GB Ventus 3X OC needs CUDA 12.8 or newer in the whole chain. If VRAM rather than speed is your problem, our low-VRAM ComfyUI guide and Nunchaku guide are better places to start, and our best GPUs for ComfyUI covers upgrades.

The bottom line

SageAttention can speed up attention in ComfyUI on NVIDIA RTX 30-series and newer cards. Install a matching Triton first (triton-windows on Windows, using ComfyUI's own Python), then either sageattention 1.0.6 from PyPI or SageAttention 2.2.0 built from source, and launch with --use-sage-attention. ComfyUI's maintainers warn that speed flags often backfire, so time it before and after and drop it if it doesn't help. Forge PC hasn't tested it.

In this article

Sources

  1. 01thu-ml, SageAttention GitHub README
  2. 02Python Package Index, sageattention release history
  3. 03triton-lang, triton-windows GitHub README
  4. 04Comfy Org, ComfyUI GitHub README
  5. 05Comfy Org, ComfyUI command-line arguments (comfy/cli_args.py)

About the author

Marcus Thorne

Systems & Technical Editor

Marcus writes Forge PC's step-by-step build, troubleshooting and system optimisation guides. His background spans Windows kernel and power-state diagnostics, UEFI/BIOS configuration, NVMe storage arrays, ATX 3.1 power delivery and running local AI and LLM workloads on consumer graphics cards.

More from Marcus Thorne

Read next

How to Fix ATTEMPTED_WRITE_TO_READONLY_MEMORY on Windows 11

How-To

How to Fix ATTEMPTED_WRITE_TO_READONLY_MEMORY on Windows 11

ATTEMPTED_WRITE_TO_READONLY_MEMORY (0xBE) means a driver tried to write to protected memory. Here's how to find the driver from the blue screen or minidump, update, roll back or remove it, use safe mode and Driver Verifier, and rule out RAM, system files and malware.

Marcus Thorne5 min

How to Fix UNMOUNTABLE_BOOT_VOLUME on Windows 11

How-To

How to Fix UNMOUNTABLE_BOOT_VOLUME on Windows 11

UNMOUNTABLE_BOOT_VOLUME (0xED) means Windows couldn't mount the drive it boots from. Here's how to check the drive and its connection, get into the recovery environment, and run Microsoft's fixes: Startup Repair, chkdsk /r and bootrec, plus what to do if the drive itself has failed.

Marcus Thorne5 min

Best Free CD Ripping Software for Windows (2026)

Best Picks

Best Free CD Ripping Software for Windows (2026)

The best free CD ripping software for Windows, ranked: Exact Audio Copy, fre:ac, CUERipper, foobar2000 and MusicBee. We explain which ones verify rips with AccurateRip, which are easiest, and who each one suits.

Hannah Vance5 min