Repository navigation
CUDA: fix ROCm CI, do not pick the tile FA kernel for DKQ 576 with a GQA ratio not divisible by 4 - #33045
Conversation
|
If we don't have any models actually using that configuration, either return false in |
The tile kernel for 576/512 only had variants for GQA ratios that are multiples of 4, while the kernel selection accepts any ratio from 2, so an MLA attention with a ratio of 2 aborted on GPUs that use the tile kernel, such as RDNA. Add the 2 column configuration, copied from the 512/512 one of each table, and dispatch even ratios to it. Odd ratios have no tile variant: the selection now reports them as unsupported instead of picking the tile kernel. Cover the ratios 2 and 3 in test-backend-ops.
14a89da to
70ccc89
Compare
…of 2 #32901 added the K and V types as template parameters of the tile kernel, the ratio 2 dispatch for DKQ 576 still used the old parameter list.
…ed by the tile kernel Use the selection instead of a new tile specialization, as suggested in review: drop the 2 column variant and only pick the tile kernel for 576/512 when the GQA ratio is a multiple of 4, the ncols2 = 4 and 16 variants it has. The ncols2 = 4 variant cannot serve a ratio of 2, a block reads a single K/V head.
Thanks. I tried the ncols2 == 4 fallback first, but on an R9700 it hits an illegal memory access for a ratio of 2: a tile block reads a single K/V head (head0 / gqa_ratio), and with 2 Q heads ne02 / ncols2 is 0. So I went with supports_op: the 2 column variant is gone, and the tile kernel is only picked for 576 when gqa_ratio is a multiple of 4. The other cases fall back like any unsupported op, and the MMA path is unchanged. No model uses that configuration, Hy4 flash itself has ratios of 32 and 64, so nothing real changes path. The ratio of 2 comes from the hy_v4_flash fixture in test-llama-context, which has made the ROCm CI red on master since #32960, so this is now a ROCm CI fix. On the R9700, the whole FLASH_ATTN_EXT set passes (4371 OK, 0 failures) and so does that fixture. |
Overview
Fixes the ROCm CI, red on master since #32960.
The flash attention tile kernel for DKQ 576 / DV 512 (the MLA shape) only has variants for GQA ratios that are multiples of 4, but the kernel selection accepts any ratio from 2. On GPUs that use the tile kernel for this shape, such as RDNA, a ratio of 2 hits
GGML_ABORTinfattn-tile.cuh. The hy_v4_flash fixture of test-llama-context has such a ratio, so the test aborts on both ROCm runners.The selection now only picks the tile kernel for 576 when the GQA ratio is a multiple of 4. Other ratios are reported unsupported and fall back like any unsupported op. No template is added, and the MMA path is unchanged.
Additional information
No released model uses these ratios: they are 16 to 128 for this shape (Hy4 flash itself has 32 and 64), so real models keep the same kernels on every backend.
test-backend-ops now covers 576/512 with GQA ratios 2 and 3. Tested with ROCm 7.13 on a Radeon AI PRO R9700 (gfx1201): ratios 2 and 3 are reported unsupported instead of aborting, the whole FLASH_ATTN_EXT set passes (4371 OK, 0 failures), and the hy_v4_flash fixture passes test-llama-context. On CUDA (RTX PRO 6000), both ratios still run through the MMA path.
Requirements