feat: Add int8 Sol-attention (CORE-391) - #117
Conversation
# Conflicts: # README.md # comfy_kitchen/backends/cuda/dlpack_bindings.cpp
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Build & test report on sm86 (RTX 3070 Laptop GPU, 8.6 GB) Environment (local):
1. Build failure (full build)
2. How I got a working build to test sol_attn
|
#" 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; attention-only 10.2 ms vs 71 ms at T=37k, at cos ≈ 0.97 vs
dense (≥ 0.998 vs its own full-precision reference).
Additions to the original method:
Sage-style smoothed-K INT8 QK and INT8 PV with u8 probabilities, targeting
consumer GPUs (sm_80+, tuned on sm_120)
block instead of per row (the routing decision already is), shrinking the
routing pass 64x for ~5e-4 cosine, selectable back to per-row via
centroid_tail=Falsekey_bias(key-only additive bias,SDPA-style shapes incl. bool, for example LTX guide strength / padding)
Four CUDA stages + an eager reference as test oracle, registry-dispatched
(bf16, head_dim 128). 52 tests covering the invariants that broke during
development: B>1, ragged tails, strided inputs, cap/sink/bias interactions,
stride agreement with
register_fake.Below ~12k tokens dense is usually faster; sm_89 compiles but is untuned.
Temporary custom node to test it:
sol_attn_minimax_v2.py