ggml-cuda: tune D=256 tile flash-attn config for RDNA3.5 - #41
Merged
Conversation
With rocWMMA FlashAttention off, D=256 prefill runs on the tile kernel. Add an RDNA3.5 config that overrides the D=256, ncols=32 row with a smaller K tile and higher occupancy (nbatch_K 128->64, occupancy 3->4); other cases fall back to the shared RDNA table. Selection is matched on host (cc) and device (RDNA3_5 macro). Assisted-by: Claude Opus 4 (1M context)
mgehre-amd
approved these changes
Jul 10, 2026
Collaborator
|
Does llama.cpp repo provide a way to just test this kernel on various shapes instead of testing the whole model? |
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.
What this changes
A tile flash-attn tuning for RDNA3.5. With rocWMMA FlashAttention off (
-DGGML_HIP_ROCWMMA_FATTN=OFF), D=256 prefill runs on the tile kernel, and the shared RDNA tile config is not optimal on RDNA3.5 for the D=256, ncols=32 case. This addsggml_cuda_fattn_tile_get_config_amd_rdna3_5, which overrides just that row with a smaller K tile and higher occupancy (nbatch_K 128->64, occupancy 3->4) and falls back to the shared RDNA table for every other case.Selection is matched consistently on both sides: the host path checks
GGML_CUDA_CC_IS_RDNA3_5(cc)before the generic RDNA branch, and the device path uses theRDNA3_5macro ahead ofRDNA. Only RDNA3.5 sees the new config; all other architectures are unchanged.Benchmarks
Measured on gfx1151 (Radeon 8060S), Qwen3.6-35B-A3B Q4_K_M,
-ngl 999 -r 1, built with-DGGML_HIP_ROCWMMA_FATTN=OFF. Baseline isgfx11at the same commit base.On this model the effect is small - Qwen3.6-35B-A3B does not lean heavily on the D=256 tile path - so most of the movement is within run-to-run noise at
-r 1. The change is a targeted config override that only affects the D=256 tile kernel, which is exercised more directly by models with a 256-wide head dim.