Repository navigation
vulkan: pack FMA for f16 accumulation, no dot product op - #29877
Merged
Merged
Conversation
Contributor
|
This all feels very roundabout to me. Like, the dot_product function (when DOT2_F16 is not defined) should just be |
Contributor
Author
|
I tried a couple of methods but couldn't get RADV to pack:
The CI tests passed on 26.0.8. The |
0cc4m
reviewed
Oct 8, 2026
| const uint sums_idx = (wsic * TN + cc) * WMITER * (TM / 2) + wsir * (TM / 2) + cr; | ||
| sums[sums_idx].x = dot_product(cache_a[wsir * TM + 2 * cr ], cache_b, sums[sums_idx].x); | ||
| sums[sums_idx].y = dot_product(cache_a[wsir * TM + 2 * cr + 1], cache_b, sums[sums_idx].y); | ||
| sums[sums_idx] = dot_product(cache_a[wsir * TM + 2 * cr], cache_a[wsir * TM + 2 * cr + 1], cache_b, sums[sums_idx]); |
Contributor
There was a problem hiding this comment.
I don't mind the change, but the function name shouldn't be the same, it's not a normal dot product anymore. You can name it e.g. dot_product_v2(.
Contributor
Author
There was a problem hiding this comment.
I made this change. Let me know if there is anything else want to see done!
amitmi704
force-pushed
the
vulkan-pk-fma
branch
from
October 8, 2026 17:00
6e28751 to
aba071e
Compare
0cc4m
approved these changes
Oct 12, 2026
jeffbolznv
approved these changes
Oct 12, 2026
1 task done
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
Add vector path for an f16 accumulator operation when no dot-product instruction exists. Two scalar FMA operations become one
f16vec2FMA accumulated asv_pk_fma_f16in the same order so results are bit-identical. Uses a helper with a guard so RADV packs them when applicable hardware executes the code.The guard keeps pipelines identical to master: 5/61 MUL_MAT (the remaining 56 are the f16-accumulate ones that are subject to change under this PR), 61/61 forced f32 accumulation, 61/61 fp16 off, 650/650 FLASH_ATTN_EXT on Navi 10.
Only applies to devices that meet these criteria:
mul_mmqinstead ofmul_mm)Additional information
Found a peak actual vs theoretical throughput gap in prefill-shaped
MUL_MATshapes (n=512) measured withtest-backend-ops perfon a GFX1013 (BC-250) using q8_0 and f16 for control. Both showed the same throughput peak of ~37% of theoretical throughput (6 TFLOPS vs 16.4 TFLOPS) ruling out dequantization bottlenecks.Results
ci/run.shwith Vulkan,19029/19029 test-backend-opson99b95488cusing Mesa 26.0.8.Measured
llama-bench -ngl 100 -fa 0,1(the scoreboard command from discussion Performance of llama.cpp with Vulkan #10879)test-backend-ops -o MUL_MATvs CPUllama-perplexityStatic Analysis
v_fma_f16against packedv_pk_fma_f16in each f16accmul_mmpipeline to validate changesq8_1shadersRequirements