[PJRT] Only alias inputs and outputs when force_ltc_sync == True - #4575
Merged
Conversation
will-cromar
force-pushed
the
wcromar/aliasing
branch
from
February 6, 2023 19:41
51a3639 to
00fd8db
Compare
JackCaoG
approved these changes
Feb 6, 2023
Collaborator
Author
|
I ran our imagenet benchmark on TPU v4 with the PJRT C API. Performance is actually a little better than the last time I checked, but that could be related to another change. |
will-cromar
marked this pull request as ready for review
February 6, 2023 21:22
alanwaketan
reviewed
Feb 6, 2023
alanwaketan
left a comment
Collaborator
There was a problem hiding this comment.
Generally speaking, LGTM. Let's see how CI respond.
JackCaoG
reviewed
Feb 7, 2023
| // shapes which can lead to an incorrect aliasing pairs if sharded. | ||
| if (enable_aliasing && coll.config.sync_ltc_data && !is_sharded) { | ||
| if (enable_aliasing && coll.config.sync_ltc_data && | ||
| coll.config.force_ltc_data && !is_sharded) { |
Collaborator
There was a problem hiding this comment.
as a follow up, we should add a test to https://github.com/pytorch/xla/blob/master/test/test_input_output_aliases.py and make sure only mark_step trigger the aliasing.
chandrasekhard2
pushed a commit
that referenced
this pull request
Feb 22, 2023
chandrasekhard2
pushed a commit
that referenced
this pull request
Feb 22, 2023
mateuszlewko
pushed a commit
that referenced
this pull request
Mar 15, 2023
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.
Updating logic to match comment.
According to the documentation for PJRT, when an input buffer is aliased to an output of an executable, the original input buffer is no longer available. When we reference the
DataPtrthat holds the buffer again, we will inevitably see this error:RuntimeError: ./tensorflow/compiler/xla/xla_client/pjrt_computation_client.h:140 : Check failed: HasValue()Fixes the following failing C++ tests on CPU: