Skip to content

[DTensor] initial support for decomps + sharding prop - #171652

Closed
pianpwk wants to merge 25 commits into
mainfrom
pianpwk/dt_decomps_init
Closed

pianpwk wants to merge 25 commits into
mainfrom
pianpwk/dt_decomps_init

Conversation

@pianpwk

@pianpwk pianpwk commented Jan 3, 2026 •

Copy link
Copy Markdown
Contributor

Following @tianyu-l's #130887

Adds support for ops with no sharding prop strategy, but a registered decomposition.

Now if sharding prop sees a decomposable op, it:

  1. Runs the decomposed op under a custom TorchDispatchMode, which propagates the placements as side information (initially used a make_fx implementation, but this required a threading lock as it relies on global state)
  2. Enumerates potential input placement combinations based on the actual input placements, on a single-dim mesh, then for each of them, propagates through torch_dispatch via sharding prop, while banning any intermediate redistributions.
  3. Returns the expanded full-mesh strategy from the filtered strategies.

Some caveats:

  • Since the dispatch mode runs sharding prop, the shard prop cache should kick in, both in the normal case (running the same op twice), and also when we recursively decompose (if op1 -> op2 -> some decomp, running op1 caches for op2).
  • One common failure case is decompositions calling factory methods (e.g. torch.ones, torch.arange). The main problem seems to be assigning placements to these tensors, and it's not so obvious what their placements should be, especially when they might take in sharded sizes, and we can't completely detect when this is the case. For now, intermediate shard prop will fail (no sharding strategy; they don't take DTensor inputs), but a potential future improvement is to permit the full-Replicate case for these graphs.
  • Sharding prop is currently via a propagate_op_sharding call, on explicit placement types. Once single-dim strategy coverage is broader, this should be doable on _ShardPlaceholders instead, making the enumeration & propagation process cheaper, though maybe more manual.
  • (Maybe hackily) uses a fake 1-rank 1d mesh to do single-dim propagation

Removes the following xfails (+some more aten ops with decomp coverage, but still failing tests):

__rsub__
addmv
addr
alias_copy
all
any
count_nonzero
dist
expand_copy
fill
floor_divide
index_select
linalg.vecdot
masked_fill
mv
nn.functional.celu
nn.functional.channel_shuffle
nn.functional.elu
nn.functional.hardsigmoid
nn.functional.hardswish
nn.functional.hardtanh
nn.functional.leaky_relu
nn.functional.logsigmoid
nn.functional.margin_ranking_loss
nn.functional.mish
nn.functional.multilabel_soft_margin_loss
nn.functional.pairwise_distance
nn.functional.pixel_shuffle
nn.functional.pixel_unshuffle
nn.functional.prelu
nn.functional.relu6
nn.functional.selu
nn.functional.softplus
nn.functional.softshrink
nn.functional.triplet_margin_loss
nn.functional.triplet_margin_with_distance_loss
permute_copy
rsub
t_copy
trace
vdot
view_copy

@pytorch-bot

pytorch-bot Bot commented Jan 3, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

✅ You can merge normally! (4 Unrelated Failures)

As of commit 5da2897 with merge base 2776680 (image):

FLAKY - The following jobs failed but were likely due to flakiness present on trunk:

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

# immediately return; some op doesn't have a sharding strategy.
return None
except (ImplicitRedistributionError, RuntimeError):
# I feel like we shouldn't have to catch RuntimeErrors?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

View ops will raise if they can't be performed locally - for example if you take a sharded tensor and reshape it, its possible the resulting global tensor shape does not match with the local data and the placement types we have defined. We could make this a more specific type of error. cc @weifengpy

self.assertEqual(out.placements, (Partial("min"),))

# # index_add
# # index_put decomp errors; https://github.com/pytorch/pytorch/issues/170934

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

any reason this is commented?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

the underlying strategy is incorrect... I might just delete this test

out = aten.polar.default(x, y)
self.assertEqual(out.placements, (Replicate(),))

# # pixel_shuffle

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

same

@pianpwk pianpwk Jan 14, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

the replicate behavior was unexpected (may also remove this)

@wconstab

Copy link
Copy Markdown
Contributor

this PR probably should have removed a handful of xfails from test_dtensor_ops.py - did you just not look into that yet?

@pianpwk
pianpwk requested a review from mruberry as a code owner January 14, 2026 22:22
@pianpwk

pianpwk commented Jan 14, 2026

Copy link
Copy Markdown
Contributor Author

this PR probably should have removed a handful of xfails from test_dtensor_ops.py - did you just not look into that yet?

just updated, turns out make_fx has this global state which isn't thread-safe, and I had to add a lock on decomposition graph tracing to make it work:

CURRENT_PATCHER: Optional[_Patcher] = None

Now a lot of xfails are gone, but I'm not sure if there's a better decomp shard prop alternative. I probably should add caching on graph tracing before this can be landed, so we only trace once.

import torch.distributed as dist

world_size = dist.get_world_size() if dist.is_initialized() else 2
self.mesh = DeviceMesh(mesh_device, torch.arange(world_size))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@wconstab this part is still suspect to me, I had to do this to avoid the assertion in

assert device_mesh._is_current_rank_part_of_mesh()

do you have a concept of what the device mesh should be, if we're propagating through the decomp graph with single-dim strategies?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

wondering if you hit the same issue as i ran into here: #172478
still ruminating on what the best solution is

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

to answer your question more literally though,

do you have a concept of what the device mesh should be, if we're propagating through the decomp graph with single-dim strategies?

I don't think we should need to know about the device mesh when we are evaluating the single-dim portion of the single-dim rule. However when we get into expansion, we do look at the mesh, and it should be the real mesh, not some single-dim fake mesh.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yep, exactly that error.

Expansion is definitely on the real mesh, I'm mainly worried that this fake mesh ends up filtering out valid strategies (because say, maybe the mesh dim size is too large)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not clear about what fake mesh exists and why its size is off. In the PR I linked there was a unit test doing something with a submesh where not all ranks participate, which in itself is a bit unusual. For normal cases for decomp tracing shouldn't we just be using the runtime mesh sizes?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah sorry, patching #172478 actually helps a lot.

I guess because DecompShardingInterpreter is actually calling sharding prop, there needs to be a mesh attached, and at the same time, we're trying to enumerate on single-dim. There's a couple options that seem to work for me:

  1. reuse the real n-d mesh, but only search over placements on one of the mesh dims, setting the others as Replicate.
  2. create a fake 1d mesh with real world size
  3. create a fake 1d mesh with size 2 (or maybe even 1?), and patch redistribute cost to avoid failing on non-participating ranks

I was worried 1) & 2) could incorrectly filter out strategies that would be valid on the real n-d mesh (for 1 we inadvertently choose a mesh dim bad for even sharding (e.g. 5); for 2 maybe the world size is larger than tensor size, and we don't shard). Option 3) seemed like a way to avoid false negatives here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok, I think we've settled on ~3: create a fake 1d mesh with size 1, but avoid using the real PG, and have all processes act like rank 0: fake_mesh = DeviceMesh(mesh.device_type, [0], _init_backend=False, _rank=0)

Previously the 0-cost for non-participating ranks was working, but returning cost = 0 for all strategies on ranks >= 1. I'm not entirely sure why this was "working" - maybe the redistribute planner was only being invoked when we definitely needed redistribution, and while some of those discovered strategies were included with incorrect 0-cost, they weren't chosen anyways because we banned implicit redistributes.

@pianpwk
pianpwk requested a review from bdhirsh January 14, 2026 22:36
@pianpwk
pianpwk requested a review from zpcore January 20, 2026 20:50
pianpwk added a commit that referenced this pull request Feb 13, 2026
Previously CIA ops would decompose & go through DTensor dispatch individually, now they enter the decomp flow in #171652. This caused implicit redistributes in some CIA ops with decomps (e.g. aten::linear in inference), so partially reverting this to preserve old behavior. Now we skip decomp flow if CIA decomp is present.

[ghstack-poisoned]
pianpwk added a commit that referenced this pull request Feb 13, 2026
Previously CIA ops would decompose & go through DTensor dispatch individually, now they enter the decomp flow in #171652. This caused implicit redistributes in some CIA ops with decomps (e.g. aten::linear in inference), so partially reverting this to preserve old behavior. Now we skip decomp flow if CIA decomp is present.

[ghstack-poisoned]
pytorchmergebot pushed a commit that referenced this pull request Feb 14, 2026
Previously CIA ops would decompose & go through DTensor dispatch individually, now they enter the decomp flow in #171652. This caused implicit redistributes in some CIA ops with decomps (e.g. aten::linear in inference), so partially reverting this to preserve old behavior. Now we skip decomp flow if CIA decomp is present.
Pull Request resolved: #174918
Approved by: https://github.com/wconstab
radeksm pushed a commit to radeksm/pytorch that referenced this pull request Feb 20, 2026
Following @tianyu-l's pytorch#130887

Adds support for ops with no sharding prop strategy, but a registered decomposition.

Now if sharding prop sees a decomposable op, it:
1. Runs the decomposed op under a custom TorchDispatchMode, which propagates the placements as side information (initially used a make_fx implementation, but this required a threading lock as it relies on [global state](https://github.com/pytorch/pytorch/blob/2a26c9a32661ee2b4b049e3bd1b889fc3af30880/torch/fx/_symbolic_trace.py#L1167))
2. Enumerates potential input placement combinations based on the actual input placements, on a single-dim mesh, then for each of them, propagates through torch_dispatch via sharding prop, while banning any intermediate redistributions.
3. Returns the expanded full-mesh strategy from the filtered strategies.

Some caveats:
- Since the dispatch mode runs sharding prop, the shard prop cache should kick in, both in the normal case (running the same op twice), and also when we recursively decompose (if op1 -> op2 -> some decomp, running op1 caches for op2).
- One common failure case is decompositions calling factory methods (e.g. [torch.ones, torch.arange](https://github.com/pytorch/pytorch/blob/41f42a0fc3ea1fbfdf05b4c030d7df815bdfe19d/torch/_decomp/decompositions.py#L818-L821)). The main problem seems to be assigning placements to these tensors, and it's not so obvious what their placements should be, especially when they might take in sharded sizes, and we can't completely detect when this is the case. For now, intermediate shard prop will fail (no sharding strategy; they don't take DTensor inputs), but a potential future improvement is to permit the full-Replicate case for these graphs.
- Sharding prop is currently via a `propagate_op_sharding` call, on explicit placement types. Once [single-dim strategy](pytorch#167677) coverage is broader, this should be doable on _ShardPlaceholders instead, making the enumeration & propagation process cheaper, though maybe more manual.
- (Maybe hackily) uses a fake 1-rank 1d mesh to do single-dim propagation

Removes the following xfails (+some more aten ops with decomp coverage, but still failing tests):
```
__rsub__
addmv
addr
alias_copy
all
any
count_nonzero
dist
expand_copy
fill
floor_divide
index_select
linalg.vecdot
masked_fill
mv
nn.functional.celu
nn.functional.channel_shuffle
nn.functional.elu
nn.functional.hardsigmoid
nn.functional.hardswish
nn.functional.hardtanh
nn.functional.leaky_relu
nn.functional.logsigmoid
nn.functional.margin_ranking_loss
nn.functional.mish
nn.functional.multilabel_soft_margin_loss
nn.functional.pairwise_distance
nn.functional.pixel_shuffle
nn.functional.pixel_unshuffle
nn.functional.prelu
nn.functional.relu6
nn.functional.selu
nn.functional.softplus
nn.functional.softshrink
nn.functional.triplet_margin_loss
nn.functional.triplet_margin_with_distance_loss
permute_copy
rsub
t_copy
trace
vdot
view_copy
```
Pull Request resolved: pytorch#171652
Approved by: https://github.com/wconstab
libohao1201 pushed a commit to libohao1201/pytorch that referenced this pull request Mar 2, 2026
Following @tianyu-l's pytorch#130887

Adds support for ops with no sharding prop strategy, but a registered decomposition.

Now if sharding prop sees a decomposable op, it:
1. Runs the decomposed op under a custom TorchDispatchMode, which propagates the placements as side information (initially used a make_fx implementation, but this required a threading lock as it relies on [global state](https://github.com/pytorch/pytorch/blob/2a26c9a32661ee2b4b049e3bd1b889fc3af30880/torch/fx/_symbolic_trace.py#L1167))
2. Enumerates potential input placement combinations based on the actual input placements, on a single-dim mesh, then for each of them, propagates through torch_dispatch via sharding prop, while banning any intermediate redistributions.
3. Returns the expanded full-mesh strategy from the filtered strategies.

Some caveats:
- Since the dispatch mode runs sharding prop, the shard prop cache should kick in, both in the normal case (running the same op twice), and also when we recursively decompose (if op1 -> op2 -> some decomp, running op1 caches for op2).
- One common failure case is decompositions calling factory methods (e.g. [torch.ones, torch.arange](https://github.com/pytorch/pytorch/blob/41f42a0fc3ea1fbfdf05b4c030d7df815bdfe19d/torch/_decomp/decompositions.py#L818-L821)). The main problem seems to be assigning placements to these tensors, and it's not so obvious what their placements should be, especially when they might take in sharded sizes, and we can't completely detect when this is the case. For now, intermediate shard prop will fail (no sharding strategy; they don't take DTensor inputs), but a potential future improvement is to permit the full-Replicate case for these graphs.
- Sharding prop is currently via a `propagate_op_sharding` call, on explicit placement types. Once [single-dim strategy](pytorch#167677) coverage is broader, this should be doable on _ShardPlaceholders instead, making the enumeration & propagation process cheaper, though maybe more manual.
- (Maybe hackily) uses a fake 1-rank 1d mesh to do single-dim propagation

Removes the following xfails (+some more aten ops with decomp coverage, but still failing tests):
```
__rsub__
addmv
addr
alias_copy
all
any
count_nonzero
dist
expand_copy
fill
floor_divide
index_select
linalg.vecdot
masked_fill
mv
nn.functional.celu
nn.functional.channel_shuffle
nn.functional.elu
nn.functional.hardsigmoid
nn.functional.hardswish
nn.functional.hardtanh
nn.functional.leaky_relu
nn.functional.logsigmoid
nn.functional.margin_ranking_loss
nn.functional.mish
nn.functional.multilabel_soft_margin_loss
nn.functional.pairwise_distance
nn.functional.pixel_shuffle
nn.functional.pixel_unshuffle
nn.functional.prelu
nn.functional.relu6
nn.functional.selu
nn.functional.softplus
nn.functional.softshrink
nn.functional.triplet_margin_loss
nn.functional.triplet_margin_with_distance_loss
permute_copy
rsub
t_copy
trace
vdot
view_copy
```
Pull Request resolved: pytorch#171652
Approved by: https://github.com/wconstab
@github-actions
github-actions Bot deleted the pianpwk/dt_decomps_init branch March 7, 2026 02:21
anshul-si added a commit that referenced this pull request Mar 26, 2026
…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]
anshul-si added a commit that referenced this pull request Mar 27, 2026
… index_reduce strategies"

**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]
anshul-si added a commit that referenced this pull request Mar 27, 2026
…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]
anshul-si added a commit that referenced this pull request Mar 31, 2026
… index_reduce strategies"

**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]
anshul-si added a commit that referenced this pull request Mar 31, 2026
…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]
anshul-si added a commit that referenced this pull request Mar 31, 2026
… index_reduce strategies"

**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]
anshul-si added a commit that referenced this pull request Mar 31, 2026
…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]
anshul-si added a commit that referenced this pull request Mar 31, 2026
… index_reduce strategies"

**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]
anshul-si added a commit that referenced this pull request Mar 31, 2026
…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]
anshul-si added a commit that referenced this pull request Apr 2, 2026
… index_reduce strategies"

**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]
anshul-si added a commit that referenced this pull request Apr 2, 2026
…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]
anshul-si added a commit that referenced this pull request Apr 6, 2026
… index_reduce strategies"

**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]
anshul-si added a commit that referenced this pull request Apr 6, 2026
…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]
pytorchmergebot pushed a commit that referenced this pull request Apr 7, 2026
…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 #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: #178456
Approved by: https://github.com/wconstab
ghstack dependencies: #178350
nklshy-aws pushed a commit to nklshy-aws/pytorch that referenced this pull request Apr 7, 2026
…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
gplutop7 pushed a commit to gplutop7/pytorch that referenced this pull request Jul 15, 2026
…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
aws-kingrj pushed a commit to amazon-contributing/upstream-to-pytorch that referenced this pull request Jul 29, 2026
…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
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 release notes: distributed (dtensor) release notes category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants