[bugfix] take start time of all ranks into account for performance measurements - #772
Open
Arech8 wants to merge 1 commit into
Open
[bugfix] take start time of all ranks into account for performance measurements#772Arech8 wants to merge 1 commit into
Arech8 wants to merge 1 commit into
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.
Current implementation measures the latency of each rank in isolation and then returns the latency of the last rank as the latency of the whole model execution. This is based on 2 assumptions:
While the second assumption usually holds (with exception of SD3.5 and possibly other DP models; And it is not asserted, which is problematic), the first assumption is completely broken.
This change places a world-scale barrier for all ranks before start of the execution, so all ranks start as closely to each other as possible, and then the latency of current rank is measured and is returned, which for the last rank (following the second assumption) yields the best estimate of the model run time that user cares about.
Implementation on the world-scale barrier is simple, but not ideal. The problem is, making anything better seems to require a perfect clock synchronization between ranks, and an API update to return timestamps of
torch.cudaevents instead of providing onlyelapsed_time(start).Effect
Effect of the change was measured 3 times using the following 8 configurations
on 8 x MI355x and compared to the original implementation and to an implementation collecting the longest across all ranks latency. Overall, the original implementation very slightly underestimates the run time for all these configurations with the exception of SD3.5, where underestimation is more than 4-5+%.
Full performance report