Placed MMA gateway over WMMA gateway#25507
Draft
adam-kabbara wants to merge 1 commit into
Draft
Conversation
|
Hi @adam-kabbara, thanks for your contribution! Per our contribution guidelines, the automated PR checker found the following issue(s) that need your attention:
Please note that maintainers reserve the right to make final decisions on PRs. If you believe there is a mistake, please comment below. |
Member
|
Can you add |
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.
Overview
When the build parameter
GGML_HIP_ROCWMMA_FATTN=ONis added, it forces all fast attention kernel pathways toBEST_FATTN_KERNEL_WMMA_F16given a large enough batch size, and applicable head sizes (else we fall back toVECorTILE). However, theBEST_FATTN_KERNEL_MMA_F16path is faster for models with head sizes <=128 as seen in the two benchmark tests performed on RDNA3 and RDNA4 below.This patch fixes two things in one.
MMApath is applicable and trying it out beforeWMMA, performance for models with head sizes <= 128 improves.GGML_HIP_ROCWMMA_FATTNto follow its definition in CMakeLists.txt more tightly.Additional information
Benchmarking using two
llama-benchrun linesUsing the following build line for both before and after patch.
Tables below show % difference in tok/s from pre-patch to post-patch.
RDNA4 Benchmark
GGML_HIP_ROCWMMA_FATTN Definition
In CMakeLists.txt it mentions
This build parameter should just enable rocWMMA, not force rocWMMA. Before this patch, if the above build parameter is turned on, it forces the fattn kernel path to
WMMAgiven a large enough batch size. However, with this patch, the compiler choses eitherWMMAorMMApath depending on which is fast for the given model. If the build parameter is off, this patch will not have an effect.Requirements