fix MMA Pipeline theoretical race#190
Open
Topologized wants to merge 1 commit intoHazyResearch:mainfrom
Open
Conversation
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.
The current B200 MMA pipeline synchronization mechanism has a theoretical bug with MMA_PIPE_DEPTH > 1 and CLC_PIPE_DEPTH > 1, where the MMA warp can arrive twice before the epilogue warp(s) wait for the inputs to arrive. Although the work of a MMA is typically quite large compared to the epilogue so that this race is unlikely to occur in practice, one can reliably reproduce the bug by a configuration such as:
If one then sets CLC_PIPE_DEPTH=2 and runs
compute-sanitizer --tool synccheck, errors are reported. A reliable crash will happen with CLC_PIPE_DEPTH=4 without compute-sanitizer. If CLC_PIPE_DEPTH=1, theschedule_arrivedmbarrier acts as a synchronization mechanism to not cause this bug.Although mbarriers are cheap in terms of shared memory usage, a wontfix could be acceptable if appropriate comments are added to warn the reader of this potential bug.
I tested the bf16 and fp8 normal gemms on my B200 machine; I haven't tested the ag_gemm patches, but it should work (I can look into setting the parallel GEMM up on my machine if required).