Skip to content

INT8 attention: keep large values finite (0.17.1) - #28

Merged
iamwavecut merged 1 commit into
mainfrom
fix/int8-attention-v-range
Nov 9, 2026
Merged

iamwavecut merged 1 commit into
mainfrom
fix/int8-attention-v-range

Conversation

@iamwavecut

Copy link
Copy Markdown
Owner

INT8 attention (int8_attention_with_triton) accumulates each 64-key tile of P·V in FP16. With equal scores a tile sum reaches 64 × max|v|, which overflows FP16 when |v| exceeds about 1023. Vimoo 1.0 Lite reaches |v| = 7136 (block 38, about step 29 of 50, 1280×720, 61 frames): the output became inf/NaN and the whole video was black.

Change

  • Per kv head, values above V_LIMIT = 512 are divided by a power of two before the FP16 conversion, and the kernel multiplies the output by the same factor.
  • The power-of-two scale is exact. Heads within the limit keep a factor of 1 and give the same bits as before.
  • The version is 0.17.1.

Checks

  • tests/test_fused_dit_kernels.py::test_int8_attention_keeps_large_values_finite: fails on 0.17.0 (non-finite output) and passes with this change.
  • tests/test_fused_dit_kernels.py, tests/test_fused_family_kernels.py, tests/test_fused_vimoo.py on an RTX PRO 6000 (Torch 2.12.1, CUDA 13.0): pass.
  • ruff check ., pytest: pass locally.

… (0.17.1)

A 64-key FP16 tile of P.V reaches 64 * max|v|. Vimoo 1.0 Lite reaches
|v| = 7136 in block 38 late in sampling, so the tile overflowed to inf and
the video turned to NaN. Heads above |v| = 512 are now divided by a power of
two before the FP16 conversion and the output is multiplied back; the scale
is exact, so heads within the limit give the same bits as before.
@iamwavecut
iamwavecut merged commit cd9fd48 into main Nov 9, 2026
3 checks passed
@iamwavecut
iamwavecut deleted the fix/int8-attention-v-range branch November 9, 2026 16:59
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