Skip to content

perf: pad small attention heads to 64 for MMA Flash Attention - #1992

Merged
leejet merged 1 commit into
masterfrom
perf/cuda-fa-head-padding
Sep 18, 2026
Merged

leejet merged 1 commit into
masterfrom
perf/cuda-fa-head-padding

Conversation

@leejet

@leejet leejet commented Sep 18, 2026

Copy link
Copy Markdown
Owner

Summary

Small attention heads, such as SD1.5's 40-channel heads, cannot use CUDA MMA Flash Attention directly. Automatically zero-pad compatible F32 Q/K/V heads below 64 channels to 64 when Flash Attention is enabled and both the CUDA device and compiled backend support MMA.

Related Issue / Discussion

N/A

Additional Information

.\bin\Release\sd-cli.exe -m ..\..\stable-diffusion-webui\models\Stable-diffusion\v1-5-pruned-emaonly.safetensors -p "a lovely cat" -v --fa

14.36it/s -> 16.28it/s

Checklist

@leejet
leejet merged commit adcac69 into master Sep 18, 2026
9 checks passed
@leejet
leejet deleted the perf/cuda-fa-head-padding branch September 20, 2026 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant