Skip to content

EncodeTileInt8 (INT8 and INT8_TWO_TRANSPOSITIONS) and EncodeTileInt8VNNI - #1055

Merged
copybara-service[bot] merged 1 commit into
devfrom
test_997791704
Oct 12, 2026
Merged

copybara-service[bot] merged 1 commit into
devfrom
test_997791704

Conversation

@copybara-service

Copy link
Copy Markdown

EncodeTileInt8 (INT8 and INT8_TWO_TRANSPOSITIONS) and EncodeTileInt8VNNI
stored each token's scale as bf16 but quantized with 1 / scale from the
unrounded float scale. Decoding multiplies by the stored bf16 scale, so values
near the absmax could decode up to ~0.75 of a quantization step off instead of
at most 0.5.

Quantize with the stored scale instead, as tiled_attention.cc (when it writes
int8 tiles) and EncodeTileInt8MatrixAccumulation already do. This only
changes the int8 values of affected tokens; the layout and scales are
unchanged.

Add a test that the encode/decode error of every int8 encoding is within half a
step. It fails for the three fixed encoders without this change.

@copybara-service
copybara-service Bot force-pushed the test_997791704 branch 3 times, most recently from 4b0c64e to 7326b8f Compare October 12, 2026 11:28
…t8VNNI`

stored each token's scale as bf16 but quantized with `1 / scale` from the
unrounded float scale. Decoding multiplies by the stored bf16 scale, so values
near the absmax could decode up to ~0.75 of a quantization step off instead of
at most 0.5.

Quantize with the stored scale instead, as `tiled_attention.cc` (when it writes
int8 tiles) and `EncodeTileInt8MatrixAccumulation` already do. This only
changes the int8 values of affected tokens; the layout and scales are
unchanged.

Add a test that the encode/decode error of every int8 encoding is within half a
step. It fails for the three fixed encoders without this change.

PiperOrigin-RevId: 997838762
@copybara-service
copybara-service Bot merged commit 985c6f9 into dev Oct 12, 2026
11 checks passed
@copybara-service
copybara-service Bot deleted the test_997791704 branch October 12, 2026 11:45
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