KEMBAR78
Fix index_add for int64 input + zerodim index by manuelcandales · Pull Request #161511 · pytorch/pytorch · GitHub
Skip to content

Conversation

@manuelcandales
Copy link
Contributor

@manuelcandales manuelcandales commented Aug 26, 2025

[ghstack-poisoned]
@pytorch-bot
Copy link

pytorch-bot bot commented Aug 26, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/161511

Note: Links to docs will display an error until the docs builds have been completed.

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

❌ 2 New Failures

As of commit ac6d1f0 with merge base 818ba43 (image):

NEW FAILURES - The following jobs have failed:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@pytorch-bot pytorch-bot bot added ciflow/mps Run MPS tests (subset of trunk) release notes: mps Release notes category labels Aug 26, 2025
manuelcandales added a commit that referenced this pull request Aug 26, 2025
[ghstack-poisoned]
manuelcandales added a commit that referenced this pull request Aug 26, 2025
@malfet malfet added the topic: bug fixes topic category label Aug 26, 2025
Copy link
Contributor

@malfet malfet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a regression test please?

indices.emplace_back();
}
indices.emplace_back(index.to(at::kLong));
const Tensor index_ = (index.dim() == 0) ? index.view(1).to(at::kLong) : index.to(at::kLong);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Binding result to a tensor creates unnecessary copy

Suggested change
const Tensor index_ = (index.dim() == 0) ? index.view(1).to(at::kLong) : index.to(at::kLong);
const auto&& index_ = (index.dim() == 0) ? index.view(1).to(at::kLong) : index.to(at::kLong);

const Tensor result_ = (result.dim() == 0) ? result.view(1) : result;
const Tensor source_ = (source.dim() == 0) ? source.view(1) : source;
result_.index_put_(indices, source_.mul(alpha), true);
const Tensor alpha_ = at::scalar_tensor(alpha, source_.options());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this one is needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the issue, there was also an error when alpha was floating point

[ghstack-poisoned]
manuelcandales added a commit that referenced this pull request Aug 26, 2025
[ghstack-poisoned]
manuelcandales added a commit that referenced this pull request Aug 26, 2025
[ghstack-poisoned]
manuelcandales added a commit that referenced this pull request Aug 26, 2025
@malfet
Copy link
Contributor

malfet commented Aug 27, 2025

@pytorchbot merge -f "Lint + MPS are green"

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use -f as last resort and instead consider -i/--ignore-current to continue the merge ignoring current failures. This will allow currently pending tests to finish and report signal before the merge.

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@clee2000
Copy link
Contributor

@pytorchbot revert -m "broke test_indexing.py::TestIndexingCPU::test_index_add_zerodim_index_floating_alpha_cpu GH job link HUD commit link on dynamo?" -c ignoredsignal

@pytorchmergebot
Copy link
Collaborator

@pytorchbot successfully started a revert job. Check the current status here.
Questions? Feedback? Please reach out to the PyTorch DevX Team

pytorchmergebot added a commit that referenced this pull request Aug 27, 2025
This reverts commit d514866.

Reverted #161511 on behalf of https://github.com/clee2000 due to broke test_indexing.py::TestIndexingCPU::test_index_add_zerodim_index_floating_alpha_cpu [GH job link](https://github.com/pytorch/pytorch/actions/runs/17257089116/job/48971728595) [HUD commit link](https://hud.pytorch.org/pytorch/pytorch/commit/d51486616cb3fe54bc298669a88059be56c1fb22) on dynamo? ([comment](#161511 (comment)))
@pytorchmergebot
Copy link
Collaborator

@manuelcandales your PR has been successfully reverted.

@pytorchmergebot pytorchmergebot added the ci-no-td Do not run TD on this PR label Aug 27, 2025
markc-614 pushed a commit to markc-614/pytorch that referenced this pull request Sep 17, 2025
markc-614 pushed a commit to markc-614/pytorch that referenced this pull request Sep 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-no-td Do not run TD on this PR ciflow/mps Run MPS tests (subset of trunk) Merged release notes: mps Release notes category Reverted topic: bug fixes topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants