Adds Intel AMX TMUL hardware acceleration for FlashAttention using INT8 - #1046
Merged
Merged
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
copybara-service
Bot
force-pushed
the
test_992460558
branch
from
October 2, 2026 23:33
c967ed6 to
29ab8ef
Compare
PiperOrigin-RevId: 992610584
copybara-service
Bot
force-pushed
the
test_992460558
branch
from
October 2, 2026 23:52
29ab8ef to
eb083c9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds Intel AMX TMUL hardware acceleration for FlashAttention using INT8
quantization:
TileFlashAttentionAMX_Int8_Impl(TileFlashAttentionAMX_Int8_ImplT)on top of Highway's AMX-INT8
Tile64BMatMulwrappers (ComputeQKPinQ256AMX_Int8,ComputeQKTileAMX_Int8,SoftmaxAndQuantizeAMX_Int8,ComputePVGroupAMX_Int8,AccumulatePVTileInt8). Theda/dbsignedness tags selectTDPBSSD(
int8 x int8) forQ*K^TandTDPBUSD(uint8 x int8) forP*V; tileconfig is compiler-managed via
__tile1024i, and runtime detection useshwy::HaveTile64BMatMulI8()(gated byGEMMA_HAVE_AMX_INT8).qkv_dim == 256(ComputeQKPinQ256AMX_Int8) by pinning a 16-queryhalf-block of
Qacrosstmm4..tmm7(4 x 64bytes) and streaming four32-token
Ktiles throughtmm2..tmm3, cuttingQtile loads by 4x andmaking post-
tilestoreddequantization contiguous.SoftmaxAndQuantizeAMX_Int8)with AVX-512 shuffle/permute intrinsics, and groups up to 4 query blocks
(128 queries) per 128-token KV macro-step (
ComputePVGroupAMX_Int8) withchannel-outer / query-inner loop ordering to keep
K,V, andP_vnnislicesin the 48 KB L1D cache and the KV step slice in the 2 MB L2 cache.
AttentionImpl::kFlashAMXInt8with quantized KV cache and querycompression.
flash_attention_test.ccandbenchmarks in
google_attention_benchmark_test.cc.helpers called
Tile64BRelease(), but once inlined into the kernel loop thecompiler does not reload the tile config after it, so the next iteration's
tile ops raised #UD. Release now happens once after the loop.
353597727402dfc7b28e5b1474766e366ceafd24, which adds the AMX-INT8 wrappers.