Default explicit donation for step barriers#8982
Merged
qihqi merged 1 commit intopytorch:masterfrom Apr 18, 2025
Merged
Conversation
5b75598 to
c092a6f
Compare
c092a6f to
6535efe
Compare
Collaborator
Author
|
Hey @tengyifei, do you see concerns with this? I also aligned with @mcuiaws, who had done the some of the refactorings on the code path. |
qihqi
approved these changes
Apr 18, 2025
This was referenced Apr 18, 2025
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.
We currently rely on the user to enable
GetAliasWithBufferDonorConfig, so that the explicitly marked tensors for donation can be included in the buffer donor indices. However, it is unnecessary to have this constraint during step barrier, where the graph is expected to break, requiring the donation to happen (force_ltc_data) for all live tensors. Instead, we choose to default explicit donation for the step barrier (mark step), and only make it optional, depending on the buffer donor config, for other graph synchronizations (e.g._xla_sync_live_tensorsor_xla_warm_up_cache), where it requires an opt-in by the user to donate at that point (knowingly that the tensors won't be accessible anymore).Originally, the explicit donation config was mostly to decide whether to run LTC or explicit donations. Now that these can be used simultaneously, there is no added benefit in requiring the option, at least for the step barrier.