[Kernel][MI350] Add cache-aware 8-wave BF16/FP16 GEMM#888
Draft
zhanglx13 wants to merge 2 commits into
Draft
Conversation
Signed-off-by: Lixun Zhang <[email protected]>
Signed-off-by: Lixun Zhang <[email protected]>
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.
Summary
Add a gfx950 8-wave GEMM specialized for BF16 and FP16, plus reusable XCD-aware and grouped-M workgroup mappings. The existing FP8 8-wave GEMM now uses the same composable locality mapping.
The half-precision kernel keeps BF16 and FP16 in one compile-time-specialized implementation because they share the 2-byte operand geometry, 16x16x32 MFMA tiling, LDS layout, pipeline, and epilogue. FP8 remains a separate hot loop.
Motivation
The current generic half GEMM does not implement the slice-MN inter-wave pipeline used by the gfx950 Gluon tutorial. Splitting the 256x256 tile into four independently addressable LDS regions lets two four-wave groups overlap MFMA work with direct-to-LDS loads without overwriting operands that peer waves still consume.
PID locality is independent of wave count, so this PR places it in a general helper rather than an 8-wave-specific utility.
Changes
Pipeline design reference: https://github.com/ROCm/gfx950-gluon-tutorials/tree/main/kernels/gemm/inter_wave/a16w16
Performance
Hardware: gfx950 MI350X-profile system, 256 CUs, 1000 W socket power limit. The device market string reports MI355 OAM and the firmware reports MI350X.
Protocol: AMD_SERIALIZE_KERNEL=3, prepared compiled launch, three rotating tensor sets, 10 warmups, 1,000 measured dispatches, and the mean kernel duration of the final 100 matching rocprofv3 dispatches. TFLOP/s is 2MN*K/time.
BF16 locality ablation within the new pipeline:
The generated BF16 kernel uses 128 KiB LDS, 128 VGPRs, 112 SGPRs, and no scratch.
Testing
Dependencies
Breaking Changes
None. Existing call sites continue to work; the FP8 8-wave kernel gains optional locality controls with gfx950 defaults.