Repository navigation
Conversation
[ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/178456
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 01830a3 with merge base 9bd2eff ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@claude review this PR |
|
Claude finished @anshul-si's task in 4m 29s —— View job Review of PR #178456: [dtensor][index_ops] adding index_fill and index_reduce strategies
SummaryThis PR adds The overall approach is sound: shard on all dims except the indexed dim, keep the index tensor replicated, and allow Partial placements where the reduce semantics are compatible. Issues1. Missing inplace
2. Shadowed At [[Partial(reduce_op), Partial(reduce_op), Replicate()] for reduce_op in ("avg", "max", "min")]3.
4. xfails in
xfail("index_fill"), # line 397
xfail("index_reduce", "prod"), # line 398
xfail("index_reduce", "mean"), # line 399
xfail("index_reduce", "amax"), # line 400
xfail("index_reduce", "amin"), # line 401If these strategies are now correct, the corresponding xfails should be removed (or converted to 5. Test coverage could be broader The tests only exercise one sharding pattern:
Correctness AnalysisThe strategy logic is correct:
FormattingThe reformatting of Overall this is a solid addition. The main actionable item is adding the missing inplace |
…rategies" [ghstack-poisoned]
…rategies" **Summary:** Added strategy for index_reduce which has no decompositions. index_fill does have a decomposition that fails because part of its decomposition includes scalar_tensor, a factory function. See #171652 for a deeper explanation on why these fail. **Test Cases** 1. pytest test/distributed/tensor/test_tensor_ops.py -k test_index_fill 2. pytest test/distributed/tensor/test_tensor_ops.py -k test_index_reduce [ghstack-poisoned]
| return strategies | ||
|
|
||
|
|
||
| def _index_dim_strategy( |
There was a problem hiding this comment.
do we not already have a helper that does this?
There was a problem hiding this comment.
We don't have helpers created, each other index op has its own defined strategy, with no shared infra. All of the existing ops have differences that would be annoying to edit them to accommodate the new ops. In the future, it maybe be possible to edit this helper function so that the existing ops use it, but there are fundamental differences, especially with index_put and index, that it should probably remain separate
| ], | ||
| [ | ||
| [Partial(op), Partial(op), Replicate(), Partial(op)] | ||
| for op in ("sum", "avg", "max", "min") |
There was a problem hiding this comment.
how did you determine which partials to include? could you add that logic in comments?
if this is 'all of them' you can use the constant in Partial class
| return _index_dim_strategy( | ||
| args_schema, | ||
| lambda d: [ | ||
| _ShardingPlaceholder(d), |
There was a problem hiding this comment.
inline comments naming these (e.g. self, idx, values, ...) would be nice
…rategies" **Summary:** Added strategy for index_reduce which has no decompositions. index_fill does have a decomposition that fails because part of its decomposition includes scalar_tensor, a factory function. See #171652 for a deeper explanation on why these fail. **Test Cases** 1. pytest test/distributed/tensor/test_tensor_ops.py -k test_index_fill 2. pytest test/distributed/tensor/test_tensor_ops.py -k test_index_reduce [ghstack-poisoned]
…rategies" **Summary:** Added strategy for index_reduce which has no decompositions. index_fill does have a decomposition that fails because part of its decomposition includes scalar_tensor, a factory function. See #171652 for a deeper explanation on why these fail. **Test Cases** 1. pytest test/distributed/tensor/test_tensor_ops.py -k test_index_fill 2. pytest test/distributed/tensor/test_tensor_ops.py -k test_index_reduce [ghstack-poisoned]
…rategies" **Summary:** Added strategy for index_reduce which has no decompositions. index_fill does have a decomposition that fails because part of its decomposition includes scalar_tensor, a factory function. See #171652 for a deeper explanation on why these fail. **Test Cases** 1. pytest test/distributed/tensor/test_tensor_ops.py -k test_index_fill 2. pytest test/distributed/tensor/test_tensor_ops.py -k test_index_reduce [ghstack-poisoned]
…rategies" **Summary:** Added strategy for index_reduce which has no decompositions. index_fill does have a decomposition that fails because part of its decomposition includes scalar_tensor, a factory function. See #171652 for a deeper explanation on why these fail. **Test Cases** 1. pytest test/distributed/tensor/test_tensor_ops.py -k test_index_fill 2. pytest test/distributed/tensor/test_tensor_ops.py -k test_index_reduce [ghstack-poisoned]
…rategies" **Summary:** Added strategy for index_reduce which has no decompositions. index_fill does have a decomposition that fails because part of its decomposition includes scalar_tensor, a factory function. See #171652 for a deeper explanation on why these fail. **Test Cases** 1. pytest test/distributed/tensor/test_tensor_ops.py -k test_index_fill 2. pytest test/distributed/tensor/test_tensor_ops.py -k test_index_reduce [ghstack-poisoned]
…rategies" **Summary:** Added strategy for index_reduce which has no decompositions. index_fill does have a decomposition that fails because part of its decomposition includes scalar_tensor, a factory function. See #171652 for a deeper explanation on why these fail. **Test Cases** 1. pytest test/distributed/tensor/test_tensor_ops.py -k test_index_fill 2. pytest test/distributed/tensor/test_tensor_ops.py -k test_index_reduce [ghstack-poisoned]
|
@pytorchbot merge |
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 |
…ytorch#178456) **Summary:** Added strategy for index_reduce which has no decompositions. index_fill does have a decomposition that fails because part of its decomposition includes scalar_tensor, a factory function. See pytorch#171652 for a deeper explanation on why these fail. **Test Cases** 1. pytest test/distributed/tensor/test_tensor_ops.py -k test_index_fill 2. pytest test/distributed/tensor/test_tensor_ops.py -k test_index_reduce Pull Request resolved: pytorch#178456 Approved by: https://github.com/wconstab ghstack dependencies: pytorch#178350
…ytorch#178456) **Summary:** Added strategy for index_reduce which has no decompositions. index_fill does have a decomposition that fails because part of its decomposition includes scalar_tensor, a factory function. See pytorch#171652 for a deeper explanation on why these fail. **Test Cases** 1. pytest test/distributed/tensor/test_tensor_ops.py -k test_index_fill 2. pytest test/distributed/tensor/test_tensor_ops.py -k test_index_reduce Pull Request resolved: pytorch#178456 Approved by: https://github.com/wconstab ghstack dependencies: pytorch#178350
…ytorch#178456) **Summary:** Added strategy for index_reduce which has no decompositions. index_fill does have a decomposition that fails because part of its decomposition includes scalar_tensor, a factory function. See pytorch#171652 for a deeper explanation on why these fail. **Test Cases** 1. pytest test/distributed/tensor/test_tensor_ops.py -k test_index_fill 2. pytest test/distributed/tensor/test_tensor_ops.py -k test_index_reduce Pull Request resolved: pytorch#178456 Approved by: https://github.com/wconstab ghstack dependencies: pytorch#178350
Summary: Added strategy for index_reduce which has no decompositions. index_fill does have a decomposition that fails because part of its decomposition includes scalar_tensor, a factory function. See #171652 for a deeper explanation on why these fail.
Test Cases
Stack from ghstack (oldest at bottom):