SmartAttentionDispatcher
SageAttention without the command-line roulette
- model
- model
SageAttention is one of those speedups that's genuinely worth having on long sequences - and genuinely fiddly to install and configure. SmartAttentionDispatcher is the part of ComfyUI-rogala that tries to make it a node. You drop it into your graph, it patches the model's attention to use SageAttention kernels instead of PyTorch SDPA, and it picks the right kernel for your GPU automatically. It's the answer to the "I installed sageattention, now what" problem.
Here's the honest part you should read first: this isn't free speed on every card. On RTX 50xx (Blackwell) with a recent PyTorch, PyTorch's SDPA is already well optimized and SageAttention mostly adds overhead - the node's own docs say there's no measurable gain. On RTX 30xx/40xx at long sequences (Flux, SD3.5, Qwen), SA2 gives real wins, with image models around 8–12% and big video sequences up to 25–50% per the author's testing on an RTX 5060 Ti. Check your GPU tier before you get excited.
How it works
The node patches optimized_attention in ComfyUI's attention module at load time, then on each run detects your GPU's compute capability (Turing SM75 up through Blackwell SM120), your torch and CUDA versions, and which SageAttention packages are actually installed. From that it picks a kernel:
- SA2 (
sageattentionpackage):fp16for Turing/Ampere,fp8for Ada and newer (the docs claim bit-exact with SDPA on tested models),fp8++for a small extra speed bump with slightly different numerics,tritonas a fallback, andautoto choose for you. - SA3 (
sageattn3package): Blackwell-only (SM ≥ 100), needs CUDA 12.8+ and torch 2.8+. FP4 kernels, so expect quantization-y numerics.
There's also a combine mode that runs SA2 on the boundary diffusion steps and SA3 in the middle (or SDPA-SA3-SDPA if you set sa2_kernel to disable) - a nice middle ground when you trust SA3's speed but not its FP4 drift over a whole denoise. A status panel on the node tells you what actually ran: SDPA, SA2, SA3, or a fallback like SA3 (not installed) >>> SA2 with the reason in parentheses. That transparency is the best feature - you always know whether your "speedup" is real or silently degrades to baseline.
Inputs: model in, model (patched) out, plus sdpa_kernel (force SDPA for A/B comparisons), sa2_kernel, sa3_kernel, and combine.
Installing it
The node itself ships with the pack:
cd ComfyUI/custom_nodes
git clone https://github.com/rogala/ComfyUI-rogala
But here's the gotcha: the pack doesn't install SageAttention for you. Its pyproject declares zero dependencies, so the sageattention (and sageattn3, for Blackwell SA3) packages are on you:
pip install sageattention
# Blackwell + SA3 only:
pip install sageattn3
Restart ComfyUI and the node will detect them. No models to download.
Where people get burned
Three rules, all from the node's own compatibility notes, all easy to trip over. First, do not run ComfyUI with the --use-sage-attention launch flag - the node and the flag fight over the baseline and you get wrong results on SDPA mode. Second, --fast is safe and actually recommended alongside it. Third, attention masks (inpainting, outpainting) fall back to SDPA automatically, because SA kernels don't support arbitrary masks - that's a graceful degradation, not a bug. And one more from the community's wider SageAttention experience: install issues on Windows/ComfyUI Desktop are common enough that the node's kernel fallback logic exists precisely because people show up with half-installed packages. The status panel will tell you exactly which kernel didn't load.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| sdpa_kernel | BOOLEAN | false | Force PyTorch SDPA. Overrides all SA2/SA3 settings. |
| sa2_kernel | COMBO | disable | SA2 kernel: disable | auto (best for GPU) | fp16 (Turing/Ampere) | fp8 (Ada+) | fp8++ (Ada+, fp32+fp16 accum) | triton (fallback). |
| combine | BOOLEAN | false | Combine SA2 and SA3: SA2 on first and last step, SA3 on middle steps. Set sa2_kernel=disable for SDPA-SA3-SDPA mode. |
| sa3_kernel | COMBO | disable | SA3 kernel: disable | standard (per_block_mean=False) | per_block_mean (per_block_mean=True). |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| model | MODEL | — |