[CuTe] Add type for CuTe layout via claude#162534
Closed
fduwjj wants to merge 8 commits intogh/fduwjj/194/basefrom
Closed
[CuTe] Add type for CuTe layout via claude#162534fduwjj wants to merge 8 commits intogh/fduwjj/194/basefrom
fduwjj wants to merge 8 commits intogh/fduwjj/194/basefrom
Conversation
[ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/162534
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 0428777 with merge base 5babb4d ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This PR mostly is a cosmetic change using Claude to add types for copied PyCute code. cc H-Huang awgu wanchaol fegin wz337 wconstab d4l3k pragupta ezyang msaroufim dcci [ghstack-poisoned]
This was referenced Sep 10, 2025
ezyang
reviewed
Sep 10, 2025
ezyang
reviewed
Sep 10, 2025
ezyang
reviewed
Sep 10, 2025
ezyang
reviewed
Sep 10, 2025
ezyang
reviewed
Sep 10, 2025
ezyang
reviewed
Sep 10, 2025
Contributor
|
You should be able to feed my CR comments directly to Claude. Please review the output yourself though. |
This PR mostly is a cosmetic change using Claude to add types for copied PyCute code. cc H-Huang awgu wanchaol fegin wz337 wconstab d4l3k pragupta ezyang msaroufim dcci [ghstack-poisoned]
Skylion007
reviewed
Sep 10, 2025
Skylion007
reviewed
Sep 10, 2025
Skylion007
reviewed
Sep 10, 2025
This PR mostly is a cosmetic change using Claude to add types for copied PyCute code. cc H-Huang awgu wanchaol fegin wz337 wconstab d4l3k pragupta ezyang msaroufim dcci [ghstack-poisoned]
Skylion007
reviewed
Sep 10, 2025
This PR mostly is a cosmetic change using Claude to add types for copied PyCute code. cc H-Huang awgu wanchaol fegin wz337 wconstab d4l3k pragupta ezyang msaroufim dcci [ghstack-poisoned]
Contributor
Author
|
@pytorchbot merge |
Collaborator
Merge startedYour 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 |
pytorchmergebot
pushed a commit
that referenced
this pull request
Sep 12, 2025
… DeviceMesh (#162414) We create a wrapper class acting as a layout for device mesh so that we can add new methods more specific to DeviceMesh and keep the core logic of CuTe manipulation inside pycute module. This PR create the main body of the code and then next PR will come with actual implementation and unit test for device mesh layout. (Actual implementation can be found in #161016) Pull Request resolved: #162414 Approved by: https://github.com/ezyang ghstack dependencies: #162413, #162534
pytorchmergebot
pushed a commit
that referenced
this pull request
Sep 15, 2025
… DeviceMesh (#162414) We create a wrapper class named "_MeshLayout" acting as a layout for device mesh so that we can add new methods more specific to DeviceMesh and keep the core logic of CuTe manipulation inside pycute module. This PR create the main body of the code and then next PR will come with actual implementation and unit test for device mesh layout. (Actual implementation can be found in #161016) Pull Request resolved: #162414 Approved by: https://github.com/ezyang, https://github.com/fegin ghstack dependencies: #162413, #162534
pytorchmergebot
pushed a commit
that referenced
this pull request
Sep 16, 2025
…plement from co-lex to lex (#162690) PyTorch tensor iteration (.view, contiguous, broadcasting) and NumPy array indexing all follow lexicographic (row-major) order. In Lexicographic (lex) on (i0, i1, …, i{k-1}): the leftmost index(stride is larger) changes fastest and the rightmost index changes slowest and usually last dim is contiguous. However original pycute is all based on co-lex, after porting their code into pytorch and some cosmetic change, we now make it lex so that we can use it for use cases like device mesh internal bookkeeping and other stuff as well. Changes included in this PR: 1. We changes all API ported in, included prefix_product(stride inferring and rename it to suffix_product), idx2crd, crd2idx, coalesce, composition, complement, right_inverse and left_inverse to make sure they are working in the lex way. 2. Added more unit test cases for some API mentioned above since existing unit tests do not have full coverage. 3. One bug fix inside composition, which will lead to infinite recursive call. Pull Request resolved: #162690 Approved by: https://github.com/ezyang ghstack dependencies: #162413, #162534, #162414
markc-614
pushed a commit
to markc-614/pytorch
that referenced
this pull request
Sep 17, 2025
This PR mostly is a cosmetic change using Claude to add types for copied PyCute code. We removed all suppressions of linters and add type checker, type alias and mypy ignore(if needed) so that the pycute code will be checked by linter. Pull Request resolved: pytorch#162534 Approved by: https://github.com/ezyang, https://github.com/Skylion007 ghstack dependencies: pytorch#162413
markc-614
pushed a commit
to markc-614/pytorch
that referenced
this pull request
Sep 17, 2025
… DeviceMesh (pytorch#162414) We create a wrapper class acting as a layout for device mesh so that we can add new methods more specific to DeviceMesh and keep the core logic of CuTe manipulation inside pycute module. This PR create the main body of the code and then next PR will come with actual implementation and unit test for device mesh layout. (Actual implementation can be found in pytorch#161016) Pull Request resolved: pytorch#162414 Approved by: https://github.com/ezyang ghstack dependencies: pytorch#162413, pytorch#162534
markc-614
pushed a commit
to markc-614/pytorch
that referenced
this pull request
Sep 17, 2025
… DeviceMesh (pytorch#162414) We create a wrapper class named "_MeshLayout" acting as a layout for device mesh so that we can add new methods more specific to DeviceMesh and keep the core logic of CuTe manipulation inside pycute module. This PR create the main body of the code and then next PR will come with actual implementation and unit test for device mesh layout. (Actual implementation can be found in pytorch#161016) Pull Request resolved: pytorch#162414 Approved by: https://github.com/ezyang, https://github.com/fegin ghstack dependencies: pytorch#162413, pytorch#162534
markc-614
pushed a commit
to markc-614/pytorch
that referenced
this pull request
Sep 17, 2025
…plement from co-lex to lex (pytorch#162690) PyTorch tensor iteration (.view, contiguous, broadcasting) and NumPy array indexing all follow lexicographic (row-major) order. In Lexicographic (lex) on (i0, i1, …, i{k-1}): the leftmost index(stride is larger) changes fastest and the rightmost index changes slowest and usually last dim is contiguous. However original pycute is all based on co-lex, after porting their code into pytorch and some cosmetic change, we now make it lex so that we can use it for use cases like device mesh internal bookkeeping and other stuff as well. Changes included in this PR: 1. We changes all API ported in, included prefix_product(stride inferring and rename it to suffix_product), idx2crd, crd2idx, coalesce, composition, complement, right_inverse and left_inverse to make sure they are working in the lex way. 2. Added more unit test cases for some API mentioned above since existing unit tests do not have full coverage. 3. One bug fix inside composition, which will lead to infinite recursive call. Pull Request resolved: pytorch#162690 Approved by: https://github.com/ezyang ghstack dependencies: pytorch#162413, pytorch#162534, pytorch#162414
This was referenced Sep 17, 2025
Closed
mansiag05
pushed a commit
to mansiag05/pytorch
that referenced
this pull request
Sep 22, 2025
This PR mostly is a cosmetic change using Claude to add types for copied PyCute code. We removed all suppressions of linters and add type checker, type alias and mypy ignore(if needed) so that the pycute code will be checked by linter. Pull Request resolved: pytorch#162534 Approved by: https://github.com/ezyang, https://github.com/Skylion007 ghstack dependencies: pytorch#162413
mansiag05
pushed a commit
to mansiag05/pytorch
that referenced
this pull request
Sep 22, 2025
… DeviceMesh (pytorch#162414) We create a wrapper class acting as a layout for device mesh so that we can add new methods more specific to DeviceMesh and keep the core logic of CuTe manipulation inside pycute module. This PR create the main body of the code and then next PR will come with actual implementation and unit test for device mesh layout. (Actual implementation can be found in pytorch#161016) Pull Request resolved: pytorch#162414 Approved by: https://github.com/ezyang ghstack dependencies: pytorch#162413, pytorch#162534
mansiag05
pushed a commit
to mansiag05/pytorch
that referenced
this pull request
Sep 22, 2025
… DeviceMesh (pytorch#162414) We create a wrapper class named "_MeshLayout" acting as a layout for device mesh so that we can add new methods more specific to DeviceMesh and keep the core logic of CuTe manipulation inside pycute module. This PR create the main body of the code and then next PR will come with actual implementation and unit test for device mesh layout. (Actual implementation can be found in pytorch#161016) Pull Request resolved: pytorch#162414 Approved by: https://github.com/ezyang, https://github.com/fegin ghstack dependencies: pytorch#162413, pytorch#162534
mansiag05
pushed a commit
to mansiag05/pytorch
that referenced
this pull request
Sep 22, 2025
…plement from co-lex to lex (pytorch#162690) PyTorch tensor iteration (.view, contiguous, broadcasting) and NumPy array indexing all follow lexicographic (row-major) order. In Lexicographic (lex) on (i0, i1, …, i{k-1}): the leftmost index(stride is larger) changes fastest and the rightmost index changes slowest and usually last dim is contiguous. However original pycute is all based on co-lex, after porting their code into pytorch and some cosmetic change, we now make it lex so that we can use it for use cases like device mesh internal bookkeeping and other stuff as well. Changes included in this PR: 1. We changes all API ported in, included prefix_product(stride inferring and rename it to suffix_product), idx2crd, crd2idx, coalesce, composition, complement, right_inverse and left_inverse to make sure they are working in the lex way. 2. Added more unit test cases for some API mentioned above since existing unit tests do not have full coverage. 3. One bug fix inside composition, which will lead to infinite recursive call. Pull Request resolved: pytorch#162690 Approved by: https://github.com/ezyang ghstack dependencies: pytorch#162413, pytorch#162534, pytorch#162414
cleonard530
pushed a commit
to cleonard530/pytorch
that referenced
this pull request
Sep 22, 2025
This PR mostly is a cosmetic change using Claude to add types for copied PyCute code. We removed all suppressions of linters and add type checker, type alias and mypy ignore(if needed) so that the pycute code will be checked by linter. Pull Request resolved: pytorch#162534 Approved by: https://github.com/ezyang, https://github.com/Skylion007 ghstack dependencies: pytorch#162413
cleonard530
pushed a commit
to cleonard530/pytorch
that referenced
this pull request
Sep 22, 2025
… DeviceMesh (pytorch#162414) We create a wrapper class acting as a layout for device mesh so that we can add new methods more specific to DeviceMesh and keep the core logic of CuTe manipulation inside pycute module. This PR create the main body of the code and then next PR will come with actual implementation and unit test for device mesh layout. (Actual implementation can be found in pytorch#161016) Pull Request resolved: pytorch#162414 Approved by: https://github.com/ezyang ghstack dependencies: pytorch#162413, pytorch#162534
cleonard530
pushed a commit
to cleonard530/pytorch
that referenced
this pull request
Sep 22, 2025
… DeviceMesh (pytorch#162414) We create a wrapper class named "_MeshLayout" acting as a layout for device mesh so that we can add new methods more specific to DeviceMesh and keep the core logic of CuTe manipulation inside pycute module. This PR create the main body of the code and then next PR will come with actual implementation and unit test for device mesh layout. (Actual implementation can be found in pytorch#161016) Pull Request resolved: pytorch#162414 Approved by: https://github.com/ezyang, https://github.com/fegin ghstack dependencies: pytorch#162413, pytorch#162534
cleonard530
pushed a commit
to cleonard530/pytorch
that referenced
this pull request
Sep 22, 2025
…plement from co-lex to lex (pytorch#162690) PyTorch tensor iteration (.view, contiguous, broadcasting) and NumPy array indexing all follow lexicographic (row-major) order. In Lexicographic (lex) on (i0, i1, …, i{k-1}): the leftmost index(stride is larger) changes fastest and the rightmost index changes slowest and usually last dim is contiguous. However original pycute is all based on co-lex, after porting their code into pytorch and some cosmetic change, we now make it lex so that we can use it for use cases like device mesh internal bookkeeping and other stuff as well. Changes included in this PR: 1. We changes all API ported in, included prefix_product(stride inferring and rename it to suffix_product), idx2crd, crd2idx, coalesce, composition, complement, right_inverse and left_inverse to make sure they are working in the lex way. 2. Added more unit test cases for some API mentioned above since existing unit tests do not have full coverage. 3. One bug fix inside composition, which will lead to infinite recursive call. Pull Request resolved: pytorch#162690 Approved by: https://github.com/ezyang ghstack dependencies: pytorch#162413, pytorch#162534, pytorch#162414
dsashidh
pushed a commit
to dsashidh/pytorch
that referenced
this pull request
Sep 26, 2025
This PR mostly is a cosmetic change using Claude to add types for copied PyCute code. We removed all suppressions of linters and add type checker, type alias and mypy ignore(if needed) so that the pycute code will be checked by linter. Pull Request resolved: pytorch#162534 Approved by: https://github.com/ezyang, https://github.com/Skylion007 ghstack dependencies: pytorch#162413
dsashidh
pushed a commit
to dsashidh/pytorch
that referenced
this pull request
Sep 26, 2025
… DeviceMesh (pytorch#162414) We create a wrapper class acting as a layout for device mesh so that we can add new methods more specific to DeviceMesh and keep the core logic of CuTe manipulation inside pycute module. This PR create the main body of the code and then next PR will come with actual implementation and unit test for device mesh layout. (Actual implementation can be found in pytorch#161016) Pull Request resolved: pytorch#162414 Approved by: https://github.com/ezyang ghstack dependencies: pytorch#162413, pytorch#162534
dsashidh
pushed a commit
to dsashidh/pytorch
that referenced
this pull request
Sep 26, 2025
… DeviceMesh (pytorch#162414) We create a wrapper class named "_MeshLayout" acting as a layout for device mesh so that we can add new methods more specific to DeviceMesh and keep the core logic of CuTe manipulation inside pycute module. This PR create the main body of the code and then next PR will come with actual implementation and unit test for device mesh layout. (Actual implementation can be found in pytorch#161016) Pull Request resolved: pytorch#162414 Approved by: https://github.com/ezyang, https://github.com/fegin ghstack dependencies: pytorch#162413, pytorch#162534
dsashidh
pushed a commit
to dsashidh/pytorch
that referenced
this pull request
Sep 26, 2025
…plement from co-lex to lex (pytorch#162690) PyTorch tensor iteration (.view, contiguous, broadcasting) and NumPy array indexing all follow lexicographic (row-major) order. In Lexicographic (lex) on (i0, i1, …, i{k-1}): the leftmost index(stride is larger) changes fastest and the rightmost index changes slowest and usually last dim is contiguous. However original pycute is all based on co-lex, after porting their code into pytorch and some cosmetic change, we now make it lex so that we can use it for use cases like device mesh internal bookkeeping and other stuff as well. Changes included in this PR: 1. We changes all API ported in, included prefix_product(stride inferring and rename it to suffix_product), idx2crd, crd2idx, coalesce, composition, complement, right_inverse and left_inverse to make sure they are working in the lex way. 2. Added more unit test cases for some API mentioned above since existing unit tests do not have full coverage. 3. One bug fix inside composition, which will lead to infinite recursive call. Pull Request resolved: pytorch#162690 Approved by: https://github.com/ezyang ghstack dependencies: pytorch#162413, pytorch#162534, pytorch#162414
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack from ghstack (oldest at bottom):
This PR mostly is a cosmetic change using Claude to add types for copied PyCute code.
We removed all suppressions of linters and add type checker, type alias and mypy ignore(if needed) so that the pycute code will be checked by linter.
cc @H-Huang @awgu @wanchaol @fegin @wz337 @wconstab @d4l3k @pragupta @ezyang @msaroufim @dcci