monkeypatch.attention.flash_attn_4

monkeypatch.attention.flash_attn_4

Route flash attention through native FA4 when it is available on SM90+ hardware.

Functions

Name Description
configure_fa4 Prepare the process to run native FA4.
fa4_usable Whether native FA4 can serve attention for this model on this GPU.

configure_fa4

monkeypatch.attention.flash_attn_4.configure_fa4()

Prepare the process to run native FA4.

Silences the harmless first-compile AuxData warning and, for an explicitly requested flash_attention_4, surfaces the stale-quack and Blackwell nested-election warnings (the auto-upgrade path checks both in fa4_usable before reaching here).

fa4_usable

monkeypatch.attention.flash_attn_4.fa4_usable(model_config=None)

Whether native FA4 can serve attention for this model on this GPU.

Checks GPU arch (SM90/100/110), flash_attn.cute import, FA4 head-dim limits, the quack-kernels floor, and the Blackwell nested-election hang. Warns (with the fix) when head dims, quack, or the Blackwell backward are the blocker.