Use fp16 fdot2 for bf16 int4 GEMV dequant on RDNA 3.5#877
Draft
mgehre-amd wants to merge 1 commit intogfx11from
Draft
Use fp16 fdot2 for bf16 int4 GEMV dequant on RDNA 3.5#877mgehre-amd wants to merge 1 commit intogfx11from
mgehre-amd wants to merge 1 commit intogfx11from
Conversation
Replace the scalar bf16→f32 dequant path in wvSplitK_int4 with an optimized path that dequantizes INT4 weights to fp16 using the bit-trick (same as the fp16 path), converts bf16 activations to fp16, then uses the native __builtin_amdgcn_fdot2 instruction for the dot product. This is ~2.5x fewer ALU ops than the scalar bf16 conversion path. Signed-off-by: Matthias Gehre <matthias.gehre@amd.com>
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.
Replace the scalar bf16→f32 dequant path in wvSplitK_int4 with an optimized path that dequantizes INT4 weights to fp16 using the bit-trick (same as the fp16 path), converts bf16 activations to fp16, then uses the native __builtin_amdgcn_fdot2 instruction for the dot product.
This is ~2.5x fewer ALU ops than the scalar bf16 conversion path.