• Stefy Lanza (nextime / spora )'s avatar
    longcat: block-sparse attention is additive, not a replacement (v0.2.74) · df816c76
    Stefy Lanza (nextime / spora ) authored
    v0.2.69 turned the dense backend OFF when enabling BSA, reasoning that
    _process_attn tests enable_bsa first so anything else would be a silent second
    opinion. That is true of SELF-attention and wrong about the model:
    
        attention.py:248, _process_cross_attn
          elif self.enable_xformers: ...
          else: raise RuntimeError("Unsupported attention operations.")
    
    Cross-attention has no enable_bsa branch at all. With the dense backend off,
    every cross-attention call in all 48 blocks raised — the first real BSA run died
    on step 0 of the first generation.
    
    So enable_bsa is now set alongside the chosen dense backend: BSA wins for
    self-attention on video because it is tested first, and cross-attention keeps a
    path to run on.
    
    Measured on the 3090, 29 frames, warm steady-state per step:
      dense  480x832 (30 latent rows)  8.13 s/it
      BSA    448x832 (28 latent rows)  6.34 s/it
    Adjusting for the 6.7% token difference the two geometries force (BSA needs
    sides divisible by 64), that is roughly 10-15% per step — well short of the 16x
    the 0.9375 sparsity suggests, because at this size attention is not the
    dominant cost; the weight-only INT8 linears are. BSA should matter more at 93
    frames and 720p, where attention grows quadratically. It also pays a one-time
    Triton compile of about four minutes per service.
    Co-Authored-By: 's avatarClaude Opus 5 (1M context) <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_0185zEBiy3KWB37xNGSrxL7w
    df816c76
test_longcat_bsa.py 8.82 KB