Repository navigation
[Triton/Gluon] [GFX950] Add Unified Attention Gluon Kernel - #4614
Conversation
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
|
|
GPT-OSS 120b benchmark, bf16 kv cache: ISL/OSL 1024/1024
ISL/OSL 8192/1024
|
|
@vgokhale Due to triton version difference between CI and my local setup (both are 3.7 but at different commits), I was getting LLVM compilation error when using waves_per_eu=3 with sliding window in CI: I changed occupancy to 0 for that case, and it compiles to a kernel with occupancy 3 without any error in CI triton now. |
… the softmax0 to fix compilation issues related to sink
Chunked serving rebuilds padded block tables with changing strides, so storing the stride in `AttentionConfig` creates per-width Gluon binaries during live requests. Pass it as runtime `tl.int32` state through both KV loaders while retaining the cache-layout strides as compile-time constants.
azaidy
left a comment
There was a problem hiding this comment.
LGTM! Please address the following in a separate PR:
- Need a repr. Both gfx1250 unified-attention Gluon kernels have one.
- Several helpers are copies of code already in the tree.
elementwise_max_prop_nan,reduce_max_prop_nanand_MAX_PROPAGATE_NAN_ALLare byte-identical to the gfx1250 versions. test_triton_unified_attnnever reaches the 3d grid, because both itsseq_lenssets contain a prefill. The only decode test istest_triton_unified_attn_3d, and it is parametrizedhead_size=[64],sliding_window=[None]. That leaves 6 of the 8 attn_3d keys in the newDEFAULT.jsonunreachable, including everyWIDE_BLOCK_M_MULTentry. Please address test coverage in a followup PR.
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Unresolved routing and kernel safety issues block approval, with portability and coverage fixes also needed.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 2
| # clamp to the last column so the loop's j+2 prefetch | ||
| # never reads past the (padded) block table | ||
| if self.cfg.ALL_DECODE: | ||
| i = gl.minimum(i, self.block_table_stride - 1) | ||
| blk = gl.load(self.block_tables_ptr_shifted + i) |
| and params.head_size <= 256 | ||
| and triton.next_power_of_2(params.head_size) == params.head_size | ||
| and params.head_size_v == params.head_size | ||
| and params.q_dtype in (e4m3_dtype, torch.bfloat16) |
| @@ -0,0 +1,2001 @@ | |||
| import torch | |||


Motivation
This PR adds gfx950 gluon kernel for unified attention. It uses single kernel that supports both 2d and 3d grid.
Performance is tuned for head sizes [64, 128, 256], dtype fp8 x fp8 and bf16 x bf16.
Remaining Steps
Technical Details
Performance numbers are collected using Triton 3.7.1.
Geomean speedup by head_size against Triton
This is the geomean speedup of various run configs with varrying concurrency, kv/seq. length, number of KV/Q heads,
Detailed performance report:
gluon_gfx950_perf_report.md
Test Plan
Existing tests are routed to the gluon kernel if conditions are met
Test Result
Tests pass