mirror of
https://github.com/Comfy-Org/comfy-kitchen.git
synced 2026-11-04 23:37:42 +00:00
[PR #117] [MERGED] feat: Add int8 Sol-attention (CORE-391) #156
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Comfy-Org/comfy-kitchen#156
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Comfy-Org/comfy-kitchen/pull/117
Author: @kijai
Created: 8/13/2026
Status: ✅ Merged
Merged: 8/29/2026
Merged by: @comfyanonymous
Base:
main← Head:sol_attn📝 Commits (10+)
ad9a4a8initial int8 sol-attn implemenation75113d3Merge remote-tracking branch 'upstream/main' into sol_attn6716dfaMerge remote-tracking branch 'upstream/main' into sol_attnc27d802sol_attn: centroid-tail routing (1.38x), u8 P quantization, and key_bias masks79a7532Fixesd7fc603Merge remote-tracking branch 'upstream/main' into sol_attn883e710ruffc04ef20Add reuse_qkv_memory to reduce peak VRAM85c4142Merge remote-tracking branch 'upstream/main' into sol_attnb17db5dOptimize routing📊 Changes
18 files changed (+3337 additions, -29 deletions)
View changed files
📝
README.md(+1 -0)📝
comfy_kitchen/__init__.py(+62 -0)📝
comfy_kitchen/backends/cuda/CMakeLists.txt(+6 -0)📝
comfy_kitchen/backends/cuda/__init__.py(+380 -0)📝
comfy_kitchen/backends/cuda/dlpack_bindings.cpp(+232 -0)📝
comfy_kitchen/backends/cuda/sage_attention/attn_utils.cuh(+9 -29)📝
comfy_kitchen/backends/cuda/sage_attention/mma.cuh(+20 -0)➕
comfy_kitchen/backends/cuda/sage_attention/sol_attn.cu(+250 -0)➕
comfy_kitchen/backends/cuda/sage_attention/sol_attn_exact.cu(+305 -0)➕
comfy_kitchen/backends/cuda/sage_attention/sol_attn_preprocess.cu(+262 -0)➕
comfy_kitchen/backends/cuda/sage_attention/sol_attn_producer.cu(+141 -0)➕
comfy_kitchen/backends/cuda/sage_attention/sol_attn_route.cu(+286 -0)➕
comfy_kitchen/backends/cuda/sage_attention/sol_attn_vtranspose.cu(+99 -0)➕
comfy_kitchen/backends/cuda/sage_attention/sol_layout.cuh(+309 -0)📝
comfy_kitchen/backends/eager/__init__.py(+12 -0)➕
comfy_kitchen/backends/eager/sol_attn.py(+275 -0)📝
comfy_kitchen/constraints.py(+58 -0)➕
tests/test_sol_attn.py(+630 -0)📄 Description
Add sol_attn: training-free block-sparse attention (CUDA + eager)
Sol-Attn (arXiv 2607.24027): each 64-token query block attends a routed subset of key blocks exactly; all other blocks contribute one pooled term, so nothing leaves the softmax. Cost becomes O(T² · density) with a quality knob (tau).
MiniMax-H3 at T=80k/56 heads: 23.4 → 13.0 s/it (1.80x) end to end vs dense INT8 attention, at cos ≈ 0.97 vs dense (≥ 0.998 vs its own full-precision reference).
Additions to the original method:
key_bias: key-only additive bias, SDPA-style shapes incl. bool (e.g. LTX guide strength / padding).
Below ~12k tokens dense is usually faster.
Cost of the PR: +213 KB SASS (+0.96%), ~+1.5–2 MB per CI wheel, zero wall-time change, ~40 s extra CPU per wheel job.
Temporary custom node to test it:
sol_attn_minimax_v5.py
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.