8000 [scan] scan dim handling in user-facing scan() by bohnstingl · Pull Request #145179 · pytorch/pytorch · GitHub
[go: up one dir, main page]

Skip to content

[scan] scan dim handling in user-facing scan() #145179

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

Closed
wants to merge 8 commits into from

Conversation

bohnstingl
Copy link
Collaborator
@bohnstingl bohnstingl commented Jan 19, 2025

This PR introduces the capability that the scan dim is handled in the user facing scan() call. Internally, the scan dim is always shifted to dim 0 and then the scan is performed over that dim.

This is a follow-up PR from bohnstingl#3

cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @chenyang78 @kadeng @chauhang @amjames @ydwu4

@bohnstingl bohnstingl requested a review from zou3519 as a code owner January 19, 2025 19:23
Copy link
pytorch-bot bot commented Jan 19, 2025

🔗 Helpful Links

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

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

✅ No Failures

As of commit 93c417e with merge base d53f206 (image):
💚 Looks good so far! There are no failures yet. 💚

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

Comment on lines 40 to 41
assert to_dim >= 0 and to_dim < t.ndim
assert from_dim >= 0 and from_dim < t.ndim
Copy link
Collaborator
@Skylion007 Skylion007 Jan 19, 2025

Choose a reason for hiding this comment

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

Suggested change
assert to_dim >= 0 and to_dim < t.ndim
assert from_dim >= 0 and from_dim < t.ndim
assert 0 <= to_dim < t.ndim
assert 0 <= from_dim < t.ndim

Or seperate it into two seperate assertion statements to make it easier to figure out which constraint is violated

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thank you for your suggestion. I have refactored the code as you suggested.

@bohnstingl
Copy link
Collaborator Author

@pytorchbot label "topic: not user facing"

@pytorch-bot pytorch-bot bot added the topic: not user facing topic category label Jan 19, 2025
@mikaylagawarecki mikaylagawarecki added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Jan 22, 2025
@zou3519 zou3519 requested review from ydwu4 and removed request for zou3519 January 23, 2025 14:39
# https://github.com/pytorch/pytorch/pull/139864 is merged
# say we have a tensor of shape [3, 4, 5, 6]
# shift_source_dim_to_target_dim(t, 0, 3) -> [4, 5, 6, 3]
def shift_source_dim_to_target_dim(t, from_dim: int, to_dim: int):
Copy link
Contributor

Choose a reason for hiding this comment

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

We probably won't need the wrapper. Can we use torch.movedim directly (for both PRs)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thank you for the catch, I fixed that in that PR as well as in the one for the associative_scan

Copy link
Contributor
@ydwu4 ydwu4 left a comment

Choose a reason for hiding this comment

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

Looks good! Left a minor comment

@bohnstingl
Copy link
Collaborator Author

@ydwu4, thank you for your review. Could you please trigger the CI tests for this PR and also maybe look at the associative_scan PR?

@bohnstingl
Copy link
Collaborator Author

@ydwu4 I did a minor update, maybe could you trigger the CI tests?

@bohnstingl bohnstingl requested a review from ydwu4 January 30, 2025 08:01
@ydwu4
Copy link
Contributor
ydwu4 commented Jan 30, 2025

@pytorchbot merge

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Jan 30, 2025
@pytorchmergebot
Copy link
Collaborator

Merge started

Your 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

Advanced Debugging
Check the merge workflow status
here

@pytorch-bot pytorch-bot bot temporarily deployed to upload-benchmark-results January 30, 2025 18:32 Inactive
@pytorch-bot pytorch-bot bot temporarily deployed to upload-benchmark-results January 30, 2025 18:32 Inactive
@pytorch-bot pytorch-bot bot temporarily deployed to upload-benchmark-results January 30, 2025 18:32 Inactive
@pytorchmergebot
Copy link
Collaborator

The merge job was canceled or timed out. This most often happen if two merge requests were issued for the same PR, or if merge job was waiting for more than 6 hours for tests to finish. In later case, please do not hesitate to reissue the merge command
For more information see pytorch-bot wiki.

@pytorchmergebot
Copy link
Collaborator

Merge started

Your 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

Advanced Debugging
Check the merge workflow status
here

@pytorchmergebot
Copy link
Collaborator

Merge failed

Reason: Comment with id 2625390323 not found

Details for Dev Infra team Raised by workflow job

@ydwu4
Copy link
Contributor
ydwu4 commented Jan 30, 2025

@pytorchbot merge

@pytorchmergebot
Copy link
Collaborator

Merge started

Your 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

Advanced Debugging
Check the merge workflow status
here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/trunk Trigger trunk jobs on your pull request Merged module: dynamo open source topic: not user facing topic category triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
0