Skip to content

restore generic IndexToScatterGatherOffset specialization#40349

Closed
ngimel wants to merge 2 commits intopytorch:masterfrom
ngimel:indexing_template
Closed

restore generic IndexToScatterGatherOffset specialization#40349
ngimel wants to merge 2 commits intopytorch:masterfrom
ngimel:indexing_template

Conversation

@ngimel
Copy link
Copy Markdown
Collaborator

@ngimel ngimel commented Jun 20, 2020

#39963 erroneously removed template specialization to compute offsets, causing cases relying on this specialization (topk for 4d+ tensors with topk dimension >= 1024/2048 depending on the type) to produce bogus results.

@dr-ci
Copy link
Copy Markdown

dr-ci Bot commented Jun 20, 2020

💊 CI failures summary and remediations

As of commit c577769 (more details on the Dr. CI page):


💚 💚 Looks good so far! There are no failures yet. 💚 💚


This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.

Please report bugs/suggestions on the GitHub issue tracker or post in the (internal) Dr. CI Users group.

See how this bot performed.

This comment has been revised 5 times.

@mruberry mruberry self-requested a review June 21, 2020 04:26
Copy link
Copy Markdown
Collaborator

@mruberry mruberry left a comment

Choose a reason for hiding this comment

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

Stamped.

Copy link
Copy Markdown
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@ngimel has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@ngimel merged this pull request in 3bbedb3.

@ezyang
Copy link
Copy Markdown
Contributor

ezyang commented Jun 22, 2020

Whoops, thanks for the catch. CC @kurtamohler

@ngimel
Copy link
Copy Markdown
Collaborator Author

ngimel commented Jun 22, 2020

@kurtamohler you can get rid of THC gather if you wrap a TH tensor using THTensor_wrap and call ATen gather on the wrapped tensor. Then the remaining kernel can be removed from THC.

@kurtamohler
Copy link
Copy Markdown
Collaborator

Darn, sorry about that. I shouldn't have assumed that an existing test would fail if that template was actually needed.

@ngimel
Copy link
Copy Markdown
Collaborator Author

ngimel commented Jun 22, 2020

np, it is failing under very specific conditions and unfortunately we did not have a test to catch that. It could have gone unnoticed for a long time, but another PR exposed this bug.

laurentdupin pushed a commit to laurentdupin/pytorch that referenced this pull request Apr 24, 2026
)

Summary:
pytorch#39963 erroneously removed template specialization to compute offsets, causing cases relying on this specialization (topk for 4d+ tensors with topk dimension >= 1024/2048 depending on the type) to produce bogus results.
Pull Request resolved: pytorch#40349

Differential Revision: D22153756

Pulled By: ngimel

fbshipit-source-id: cac04969acb6d7733a7da2c1784df7d30fda1606
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants