Skip to content
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

Fix sync on index_select decomposition when the index has one element #125973

Closed
wants to merge 1 commit into from

Conversation

lezcano
Copy link
Collaborator

@lezcano lezcano commented May 10, 2024

Stack from ghstack (oldest at bottom):

The previous fix was not general enough.

Fixes #125952

The previous fix was not general enough.

Fixes #125952

[ghstack-poisoned]
Copy link

pytorch-bot bot commented May 10, 2024

🔗 Helpful Links

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

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

❌ 24 New Failures

As of commit 001ca95 with merge base 2ed17e0 (image):

NEW FAILURES - The following jobs have failed:

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

lezcano added a commit that referenced this pull request May 10, 2024
The previous fix was not general enough.

Fixes #125952

ghstack-source-id: d1a956c9c514d10ffa99b4589ea8db0c5b74b46d
Pull Request resolved: #125973
@lezcano lezcano requested a review from ezyang May 10, 2024 22:30
@@ -4020,10 +4020,10 @@ def index_select(x: TensorLike, dim: int, index: TensorLike):
)
if index.ndim == 0:
index = index.unsqueeze(0)
if x.ndim == 0:
if x.numel() == 1:
# Treat scalars as elements of \R^1
# We cannot use x[idx] here as it accesses item() (??), hence this awkward construction
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we know why this happens?!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

See #105641

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add an operator that is like x[idx] but instead produces a copy rather than view?

@ezyang
Copy link
Contributor

ezyang commented May 11, 2024

This seems reasonable but I guess it doesn't work?

@lezcano
Copy link
Collaborator Author

lezcano commented May 11, 2024

The roll error is fine, but that pdist error I'll have to look into. I'll spin up an A100 box next week and make sure the fix I submit works lol

@ezyang
Copy link
Contributor

ezyang commented May 11, 2024

This does not appear to fix it:

image

@ezyang
Copy link
Contributor

ezyang commented May 11, 2024

And it's also difficult to tell how this could fix it, the trace appears to originate from C++ code

@lezcano
Copy link
Collaborator Author

lezcano commented May 13, 2024

I thought the issue was coming from the use of index_select and its decomposition dispatching to advanced indexing, which sometime synchronizes

@lezcano lezcano closed this May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants