Add bf16 gemm pingpong with num_stages=3 - #818
Open
jungpark-mlir wants to merge 2 commits into
Open
jungpark-mlir wants to merge 2 commits into
jungpark-mlir wants to merge 2 commits into
Conversation
Transforms 'BLOCK_SIZE_M': 256, 'BLOCK_SIZE_N': 256, 'BLOCK_SIZE_K': 32 with num_stages=3, it can deal hazard between waves more easily. Requires carrying wait token over the loop, waits are merged in the pingpong pass.
antiagainst
approved these changes
May 30, 2025
guacamoleo
reviewed
May 30, 2025
| return; | ||
| } | ||
|
|
||
|
|
| return success(); | ||
| } | ||
|
|
||
| LogicalResult Pingponger::transformNS3(OpBuilder &builder, Location loc) { |
There was a problem hiding this comment.
I see there's already a comment for documentation; but it would be great to capture what these transform functions do; e.g. what is the assumed state of the IR before tranformation, how/when is conditional barrier inserted, what the execution mode looks like before/after the transformation.
| amd.passes.ttgpuir.add_reorder_instructions(pm) | ||
| use_block_pingpong = is_pingpong_schedule_enabled(options.arch) | ||
| if use_block_pingpong and options.num_stages in [2, 4]: | ||
| if use_block_pingpong and options.num_stages in [2, 3, 4]: |
There was a problem hiding this comment.
Do we only allow pingpong to be enabled for pre-vetted scenarios where we know that pingpong is faster than non-pingpong? Or do we allow the user to enable pingpong even when it's slower (e.g. for testing or analysis...)?
I ask because I'm wondering if we distinguish between "supported" cases being numerically correct or performant also.
jungpark-mlir
commented
May 30, 2025
Try to reduce salu/valu stalls by using sched.group.barrier to interleave MFMA and salu/buffer_load using sched.barrier to split ds_read and interleave address calcs.
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.
Transforms 'BLOCK_SIZE_M': 256, 'BLOCK_SIZE_N': 256, 'BLOCK_SIZE_K': 32 with num_stages=3.
With tripke buffering, it can deal hazard between waves more easily. e.g., wait/copy/dot can be freely ordered.
This requires carrying wait token over the loop (TRITON_HIP_ENABLE_F16_ASYNC_PINGPONG=1).
Waits are merged in the pingpong pass for now, since pipeliner is not able to merge it correctly.