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
add batch impl. for inplace index_add
operation
#112276
add batch impl. for inplace index_add
operation
#112276
Conversation
[ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/112276
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (2 Unrelated Failures)As of commit e9bd676 with merge base c120e56 (): FLAKY - The following jobs failed but were likely due to flakiness present on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
ghstack-source-id: a845ffe9edc81ea23ffc7ac99fc1dd2527b6e7ec Pull Request resolved: #112276
ref: #105539 |
[ghstack-poisoned]
ghstack-source-id: 5c48a2db610752992519c4f1bd97d571bf0dffb1 Pull Request resolved: #112276
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.
Looks good but have couple of questions. Thank you!
@@ -956,6 +955,7 @@ def vjp_of_vjp(*args_and_cotangents): | |||
{torch.float32: tol(atol=5e-04, rtol=1e-04)}, device_type="cuda"), | |||
)) | |||
@skipOps('TestOperators', 'test_vmapvjp', vmapvjp_fail.union({ | |||
xfail('as_strided'), |
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.
We are just moving above xfail here? Is that correct?
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.
Yes, that's correct. Before the xfail was in vmapvjp_fail
, which is used in other places of this file. With the addition of index_add
, there is a batch rule for as_strided
, but it fails on some specific cases.
@@ -977,11 +991,40 @@ std::tuple<Tensor,optional<int64_t>> index_add_batch_rule( | |||
other.select(*other_bdim, i) : other; | |||
const auto& index_slice = index_bdim.has_value() ? | |||
index.select(*index_bdim, i) : index; | |||
results.push_back(at::index_add(self_slice, dim, index_slice, other_slice, alpha)); | |||
|
|||
if (inplace) { |
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.
Is there a simple way to not initialize results
for inplace case (as it is not used then).
Or maybe we should guard call to reserve with if (!inplace) { results.reserver(batch_size)}
Wdyt?
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.
Done! I've guarded the initialization as you suggested.
cc zou3519 Chillee samdow kshitij12345 janeyx99 [ghstack-poisoned]
ghstack-source-id: 426b5d4e54220922af1d693c77eefa2d3a450336 Pull Request resolved: #112276
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, thanks @guilhermeleobas
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
@pytorchbot revert -m "breaking linux binary builds" -c "nosignal" You can find the breakage here: https://hud.pytorch.org/pytorch/pytorch/commit/e3c8c63deaf594699d827e84869a3ecd7e2ab494 |
@pytorchbot successfully started a revert job. Check the current status here. |
@guilhermeleobas your PR has been successfully reverted. |
This reverts commit e3c8c63. Reverted #112276 on behalf of https://github.com/PaliC due to breaking linux binary builds ([comment](#112276 (comment)))
Hi @PaliC, failure doesn't seem to be related to the changes I did in this PR:
Can I just rebase and merge it again? |
@pytorchbot merge -f "Revert was in error, sorry about that" |
I think failure is unrelated, as revert clearly did not help, cause of regression is pytorch/builder@7790132 that modified docker images for main, even though it should have targeted only 2.1 Also, nosignal is wrong classification here, as those builds were triggered at the time of merge, see https://github.com/pytorch/pytorch/actions/runs/6698655783/job/18201217605 |
Merge startedYour change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Pull Request resolved: pytorch#112276 Approved by: https://github.com/zou3519, https://github.com/kshitij12345
…2276)" This reverts commit e3c8c63. Reverted pytorch#112276 on behalf of https://github.com/PaliC due to breaking linux binary builds ([comment](pytorch#112276 (comment)))
Pull Request resolved: pytorch#112276 Approved by: https://github.com/zou3519, https://github.com/kshitij12345, https://github.com/malfet
Pull Request resolved: pytorch#112276 Approved by: https://github.com/zou3519, https://github.com/kshitij12345
…2276)" This reverts commit e3c8c63. Reverted pytorch#112276 on behalf of https://github.com/PaliC due to breaking linux binary builds ([comment](pytorch#112276 (comment)))
Pull Request resolved: pytorch#112276 Approved by: https://github.com/zou3519, https://github.com/kshitij12345, https://github.com/malfet
Pull Request resolved: pytorch#112276 Approved by: https://github.com/zou3519, https://github.com/kshitij12345
…2276)" This reverts commit e3c8c63. Reverted pytorch#112276 on behalf of https://github.com/PaliC due to breaking linux binary builds ([comment](pytorch#112276 (comment)))
Pull Request resolved: pytorch#112276 Approved by: https://github.com/zou3519, https://github.com/kshitij12345, https://github.com/malfet
Stack from ghstack (oldest at bottom):
index_add
operation #112276cc @zou3519 @Chillee @samdow @kshitij12345 @janeyx99