Skip to content

[BE] follow autoformating and linter #151507

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 4 commits into from

Conversation

XilunWu
Copy link
Contributor

@XilunWu XilunWu commented Apr 17, 2025

Copy link

pytorch-bot bot commented Apr 17, 2025

🔗 Helpful Links

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

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

⏳ No Failures, 86 Pending

As of commit aba47a8 with merge base 78953ee (image):
💚 Looks good so far! There are no failures yet. 💚

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

Copy link
Collaborator

@Skylion007 Skylion007 left a comment

Choose a reason for hiding this comment

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

Can we make sure this file is in the relevant include list for lintrunner?

@XilunWu
Copy link
Contributor Author

XilunWu commented Apr 17, 2025

@Skylion007 good point! Do you know where I can find information about it?

cc H-Huang awgu wanchaol fegin fduwjj wz337 wconstab d4l3k

[ghstack-poisoned]
XilunWu added a commit that referenced this pull request Apr 18, 2025
…rt to DTensor in FakeTensorMode"

Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at bottom):

*  #151497
*  #151507
* __->__ #151495

## Introduction
`flex_attention`'s FakeTensor propagation `flex_attention_fake_impl` [permutes](https://github.com/pytorch/pytorch/blob/fb6ac2f16132f7953711ce6924bc2ee4a033228c/torch/_higher_order_ops/flex_attention.py#L459) the stride of `out` (the attention score) based on `query`'s stride. To enable `flex_attention` call on DTensor, this requires us add `as_strided` support on DTensor in `FakeTensorMode`. 

## Limited Support
Due to the complexity of supporting actual `as_strided` on DTensor, I choose to only enable a limited subset:
1. `as_strided` only works correctly in `FakeTensorMode` i.e. shape and strided propagation.
2. `as_strided` is only allowed in case where `size == input.shape` because this PR specifically unblocks the use case of `flex_attention_fake_impl`. 
3. `as_strided` requires `storage_offset=None` because the other case is not defined in DTensor.

## Test
`pytest test/distributed/tensor/test_view_ops.py -s -k test_as_strided`

cc H-Huang awgu wanchaol fegin fduwjj wz337 wconstab d4l3k tianyu-l

[ghstack-poisoned]
XilunWu added a commit that referenced this pull request Apr 18, 2025
… FakeTensorMode"

Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at bottom):

*  #151497
*  #151507
* __->__ #151495

## Introduction
`flex_attention`'s FakeTensor propagation `flex_attention_fake_impl` [permutes](https://github.com/pytorch/pytorch/blob/fb6ac2f16132f7953711ce6924bc2ee4a033228c/torch/_higher_order_ops/flex_attention.py#L459) the stride of `out` (the attention score) based on `query`'s stride. To enable `flex_attention` call on DTensor, this requires us add `as_strided` support on DTensor in `FakeTensorMode`. 

## Limited Support
Due to the complexity of supporting actual `as_strided` on DTensor, I choose to only enable a limited subset:
1. `as_strided` only works correctly in `FakeTensorMode` i.e. shape and strided propagation.
2. `as_strided` is only allowed in case where `size == input.shape` because this PR specifically unblocks the use case of `flex_attention_fake_impl`. 
3. `as_strided` requires `storage_offset=None` because the other case is not defined in DTensor.

## Test
`pytest test/distributed/tensor/test_view_ops.py -s -k test_as_strided`

cc H-Huang awgu wanchaol fegin fduwjj wz337 wconstab d4l3k tianyu-l

[ghstack-poisoned]
@cyyever
Copy link
Collaborator

cyyever commented Apr 20, 2025

check .lintrunner.toml

@cyyever
Copy link
Collaborator

cyyever commented Apr 22, 2025

@pytorchmergebot merge -i

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

@pytorchmergebot
Copy link
Collaborator

Merge failed

Reason: PR #151495 has not been reviewed yet

Details for Dev Infra team Raised by workflow job

Failing merge rule: Core Maintainers

cc H-Huang awgu wanchaol fegin fduwjj wz337 wconstab d4l3k

[ghstack-poisoned]
XilunWu added a commit that referenced this pull request Apr 22, 2025
…rt to DTensor in FakeTensorMode"

Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at bottom):

*  #151497
*  #151507
* __->__ #151495

## Introduction
`flex_attention`'s FakeTensor propagation `flex_attention_fake_impl` [permutes](https://github.com/pytorch/pytorch/blob/fb6ac2f16132f7953711ce6924bc2ee4a033228c/torch/_higher_order_ops/flex_attention.py#L459) the stride of `out` (the attention score) based on `query`'s stride. To enable `flex_attention` call on DTensor, this requires us add `as_strided` support on DTensor in `FakeTensorMode`. 

## Limited Support
Due to the complexity of supporting actual `as_strided` on DTensor, I choose to only enable a limited subset:
1. `as_strided` only works correctly in `FakeTensorMode` i.e. shape and strided propagation.
2. `as_strided` is only allowed in case where `size == input.shape` because this PR specifically unblocks the use case of `flex_attention_fake_impl`. 
3. `as_strided` requires `storage_offset=None` because the other case is not defined in DTensor.

## Test
`pytest test/distributed/tensor/test_view_ops.py -s -k test_as_strided`

cc H-Huang awgu wanchaol fegin fduwjj wz337 wconstab d4l3k tianyu-l

[ghstack-poisoned]
XilunWu added a commit that referenced this pull request Apr 22, 2025
… FakeTensorMode"

Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at bottom):

*  #151497
*  #151507
* __->__ #151495

## Introduction
`flex_attention`'s FakeTensor propagation `flex_attention_fake_impl` [permutes](https://github.com/pytorch/pytorch/blob/fb6ac2f16132f7953711ce6924bc2ee4a033228c/torch/_higher_order_ops/flex_attention.py#L459) the stride of `out` (the attention score) based on `query`'s stride. To enable `flex_attention` call on DTensor, this requires us add `as_strided` support on DTensor in `FakeTensorMode`. 

## Limited Support
Due to the complexity of supporting actual `as_strided` on DTensor, I choose to only enable a limited subset:
1. `as_strided` only works correctly in `FakeTensorMode` i.e. shape and strided propagation.
2. `as_strided` is only allowed in case where `size == input.shape` because this PR specifically unblocks the use case of `flex_attention_fake_impl`. 
3. `as_strided` requires `storage_offset=None` because the other case is not defined in DTensor.

## Test
`pytest test/distributed/tensor/test_view_ops.py -s -k test_as_strided`

cc H-Huang awgu wanchaol fegin fduwjj wz337 wconstab d4l3k tianyu-l

[ghstack-poisoned]
Divigroup-RAP pushed a commit to Divigroup-RAP/PYTORCH that referenced this pull request Apr 22, 2025
ghstack-source-id: f757813
Pull Request resolved: pytorch/pytorch#151507
[ghstack-poisoned]
XilunWu added a commit that referenced this pull request Apr 24, 2025
ghstack-source-id: 2083a07
Pull Request resolved: #151507
@XilunWu
Copy link
Contributor Author

XilunWu commented Apr 24, 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

@cyyever
Copy link
Collaborator

cyyever commented Apr 24, 2025

@pytorchbot merge -f "Linters have passed"

@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 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

rec pushed a commit to rec/pytorch that referenced this pull request Apr 25, 2025
@github-actions github-actions bot deleted the gh/XilunWu/134/head branch June 12, 2025 02:22
superiwan pushed a commit to superiwan/pytorch that referenced this pull request Jul 14, 2025
ghstack-source-id: f757813
Pull Request resolved: pytorch/pytorch#151507
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/inductor ciflow/trunk Trigger trunk jobs on your pull request Merged oncall: distributed Add this issue/PR to distributed oncall triage queue topic: not user facing topic category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy