Nodes/ComfyUI-ComfyUI-Flash-Attention_v100/⚡ Flash Attn V100 Controller
ComfyUI Node

⚡ Flash Attn V100 Controller

Flash Attention for the Tesla V100 and T4 that everything else locks out

By FearL0rd·Created 6 months ago·Updated 6 months ago· 15
⚡ Flash Attn V100 Controller
  • model
  • model
  • status
enable_v100_opttrue

Every "install Flash Attention" guide you'll find assumes you're on an Ampere card or newer, because FlashAttention-2 hard-requires Compute Capability 8.0+. If you're running a Tesla V100 or T4 - cheap-ish data-center cards a lot of people end up with from a decommissioned server or a cloud spot instance - that requirement locks you out entirely. FlashAttnV100Controller works around it: it wires in an older FlashAttention-1 build that a separate project (ai-bond/flash-attention-v100) patched to run on sm_70/sm_75, and gives you a toggle to turn it on or off per-run.

Attention is the part of a diffusion model that scales worst with resolution and frame count, and it's also what every mainstream speedup - xformers, PyTorch's SDPA, SageAttention - targets first, because shaving memory and time off it pays off everywhere at once. Those newer options either require Ampere+ or perform noticeably worse on older architectures. This node is that same category of optimization, scoped to the two GPU generations everyone else forgot about.

How it works

The pack monkey-patches comfy.ldm.modules.attention.optimized_attention - ComfyUI's actual attention call - with a wrapper. When it's active, that wrapper reshapes tensors from ComfyUI's internal layout into the shape Flash Attention expects, calls the compiled kernel with causal=False (diffusion models attend to the whole sequence, not just what came before, so this isn't optional), and reshapes the result back. If the kernel throws a CUDA out-of-memory error, it falls back to standard SDPA or vanilla attention automatically rather than crashing your run. The patch is non-destructive - the pack can call restore() to put ComfyUI's original attention function back, which is effectively what the enable_v100_opt toggle does under the hood.

It also gates itself on hardware: the pack only activates on GPUs below Compute Capability 8.0. On an Ampere-or-newer card, toggling this node on does nothing useful, because you're not the audience - you already have FlashAttention-2 available through ComfyUI directly.

The inputs and outputs that matter

  • model (MODEL, required) - your loaded checkpoint. This node sits between your loader and your sampler.
  • enable_v100_opt (BOOLEAN, default true) - the toggle. Flip it off to compare against standard attention without rewiring anything, which is the fastest way to confirm the patch is actually buying you something on your specific card and workflow.
  • model (MODEL, output) - the patched model. Feed this straight into your KSampler in place of the checkpoint loader's output.
  • status (STRING, output) - reports what got detected and whether the patch is live, e.g. "ACTIVE sm_70". Wire it into a Show Text node if you want to actually see it. This is the same readout the standalone FlashAttnV100Status node in this pack provides - use that one if you want a permanent check elsewhere in the graph instead of reading it off this node every time.

Installing it

The node install is the easy part:

cd ComfyUI/custom_nodes
git clone https://github.com/FearL0rd/ComfyUI-Flash-Attention_v100.git

The real work is compiling the V100-compatible kernel, and it's not fast:

pip install packaging ninja
git clone https://github.com/ai-bond/flash-attention-v100.git /tmp/flash-attn-v100
cd /tmp/flash-attn-v100
python setup.py install
# short on RAM? MAX_JOBS=2 python setup.py install

Plan for 20–30 minutes and 15GB+ of free RAM - this is building CUDA kernels from source, not downloading a wheel. Linux is the supported path; Windows works through WSL2 but native Windows is explicitly untested by the author. Restart ComfyUI when it's done, add the node from attention → ⚡ Flash Attn V100 Controller, and wire it Load Checkpoint → Controller → KSampler.

Common issues & troubleshooting

The build fails or the status node reports fallback attention. The README is explicit that your CUDA Toolkit version has to match the CUDA version your PyTorch install was built against - this is the single most common way a source-compiled CUDA extension breaks, silently or otherwise, and it's worth checking before you re-run a 30-minute build hoping it fixes itself.

Nothing changes when you toggle it. If you're on any RTX 30-series card or newer, this is expected - the pack only kicks in below sm_80, and standard ComfyUI already gives you real FlashAttention-2 on those cards. This node has nothing to offer there.

It worked, then stopped after an update. Compiling from source ties the kernel to the exact PyTorch/CUDA combo you built it against. Upgrade PyTorch and the extension can silently stop loading - check status first; fallback instead of an outright error is the tell, and a rebuild against the new versions is the fix.

Worth weighing before you sink 30 minutes into the build: this modifies a core inference path at runtime, on hardware two generations behind current - the author's own disclaimer says as much. It's genuinely worth it if a V100 or T4 is what you've got. It's not something to reach for on modern hardware, and it's a real compile, not a pip install.

Categoryattention

Inputs (2)

NameTypeDefaultDescription
enable_v100_optBOOLEANtrue
modelMODEL

Outputs (2)

NameTypeDescription
modelMODEL
statusSTRING