Repository navigation
Don't pass shard_order beside a _StridedShard when redistributing - #597
schmidt-jake wants to merge 1 commit into
Conversation
A DTensorSpec that holds a _StridedShard encodes its shard order in its placements and rejects an explicit shard_order (torch 2.15). ApplyShardingInterpreter.redistribute_tensor passed the shard order it computed anyway, so redistributing any strided layout raised ValueError before a collective was issued. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Hi @schmidt-jake! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
Problem
ApplyShardingInterpreter.redistribute_tensorbuilds the current and targetDTensorSpecs with an explicitshard_order. When a spec's placements contain a_StridedShard, torch 2.15'sDTensorSpecrefuses an explicitshard_order, because the strided placement already encodes the order. It raisesValueError. So redistributing any strided layout failed before a collective was issued. We hit it applying a solution whose expert-stack parameters came out strided-sharded.Change
When a spec holds a
_StridedShard, construct it withoutshard_orderand let the placements carry the order. Every other spec is unchanged.Test
tests/test_apply_sharding_strided.pyredistributes a strided source spec through the interpreter on a fake process group (CPU). Without the fix it fails with thatValueError; with it, it passes. Lint passes with the repo's pinned black, isort and flake8.🤖 Generated with Claude Code