fix p2p update error when disable_h2d_buffer is true #76
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.
This MR fixes an issue introduced by #28.
The MR #28 modified the trigger condition of the P2P broadcast operation, requiring the H2D buffer. If the free GPU memory could not meet the condition for H2D operations, it would set the H2D buffer to None, preventing any communication buffer from being registered with the P2P store. This caused subsequent synchronization of the weight buffer to follow the wrong path, resulting in GPU memory synchronization errors.
In this fix MR, if H2D operations are available, the H2D buffer is registered with the P2P store when P2P operation are used to update weights; otherwise, the receive buffer is directly registered with the P2P store. And then, the corresponding
copy_to_bufferoperation is then executed through the right path.