-
Notifications
You must be signed in to change notification settings - Fork 561
Fix a corner case where view tensor update will be ignore by mark_step #4232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@wonjoolee95 let's revert this change once functionization pass migration is completed, we need to make newly added test still works through. |
|
Thanks for the heads up. Are the CI tests failures expected? |
|
@wonjoolee95 lol I need to rebase, let me do that. |
75451ef to
119155e
Compare
torch_xla/csrc/tensor.cpp
Outdated
| // A tensor's xla_data might not be up to date if there is a view | ||
| // associated with it. Make sure to sync those tensors here too. | ||
| (tensors[i]->CurrentXlaData() == nullptr || | ||
| tensors[i]->data()->view != nullptr)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, @JackCaoG
| xm.mark_step() | ||
| t1[12] = 1123 | ||
| xm.mark_step() | ||
| self.assertNotIn('update_slice', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't the graph be trimmed anyway after mark_step()? I just tried on my branch without this patch, and it doesn't have the update_slice after. But maybe I am not following / understanding 🥟
nit. It might be helpful to add a brief comment explaining what this assertion is about -- esp for the future readers who haven't been following the original issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, without this change, the test failed at my end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The bug is that the second mark_step won't execute the IR of t1, can you verify?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh, it failed -- sorry for the false alarm. I can verify that the graph wasn't trimmed after the second mark_step.
yeounoh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One nit comment
|
weird that test still failing, trying to repo on my end. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM -- with a nit comment. Feel free to merge once you resolve the test failures.
|
ok error is real and it is a regression, I will look into it a bit. |
|
Seems like I need to make this check smarter currently it will execute a graph that only contains a single |
|
This is an interesting bug/fix. |
|
not really, this should be a rare case since most tensor should not outlive the scope of a single |
This is to fix #4189. Even if a tensor has
xla_data, we might still have to update it if there is an active view associated with the tensor.FYI @Liyang90 @alanwaketan