[SPMD] Support SPMDShardToFullShape#6925
Merged
alanwaketan merged 4 commits intomasterfrom Apr 17, 2024
Merged
Conversation
9c8643b to
50f4c66
Compare
yeounoh
reviewed
Apr 16, 2024
| xt = xs._mark_manual_sharding(xt) | ||
| xx = torch_xla._XLAC._spmd_shard_to_full_shape( | ||
| xt.global_tensor, | ||
| torch_xla._XLAC.OpSharding([], [], [], xs.ShardingType.REPLICATED), |
Contributor
There was a problem hiding this comment.
So it uses the passed sharding type when returns back to SPMD?
yeounoh
reviewed
Apr 16, 2024
| with self.assertRaises(RuntimeError): | ||
| x = torch_xla._XLAC._spmd_shard_to_full_shape( | ||
| x, torch_xla._XLAC.OpSharding([], [], [], xs.ShardingType.REPLICATED), | ||
| x.shape, x.dtype) |
Contributor
There was a problem hiding this comment.
so we've decided to pass the original full shape as argument, right?
Collaborator
Author
There was a problem hiding this comment.
At least I have decided haha, see the PR descriptions for the reasons behind.
yeounoh
approved these changes
Apr 16, 2024
Contributor
yeounoh
left a comment
There was a problem hiding this comment.
LGTM, left some questions -- thanks @alanwaketan ❤️
Collaborator
Author
|
Thanks @yeounoh for the quick review! |
lausannel
pushed a commit
to AlibabaPAI/xla
that referenced
this pull request
Aug 6, 2024
Summary: This pull request enables SPMDShardToFullShape. The trickiest part is how to get the full shape, and here is a couple of options: 1. Bookkeeping the shape full shape that enters SPMDFullToShardShape. This is not selected given the output could be created on the fly. 2. Constructing the full shape from the local shard and the sharding spec. This is not selected given there is no way to deal with the padding. We can't examine the data during the tracing time. 3. Let users pass the full shape in. This is selected because it's just the most sounded path. Tes Plan: PJRT_DEVICE=TPU python test/spmd/test_xla_sharding.py -v -k test_manual_sharding_e2e -k test_spmd_shard_to_full_shape
baoleai
pushed a commit
to AlibabaPAI/xla
that referenced
this pull request
Aug 6, 2024
Summary: This pull request enables SPMDShardToFullShape. The trickiest part is how to get the full shape, and here is a couple of options: 1. Bookkeeping the shape full shape that enters SPMDFullToShardShape. This is not selected given the output could be created on the fly. 2. Constructing the full shape from the local shard and the sharding spec. This is not selected given there is no way to deal with the padding. We can't examine the data during the tracing time. 3. Let users pass the full shape in. This is selected because it's just the most sounded path. Tes Plan: PJRT_DEVICE=TPU python test/spmd/test_xla_sharding.py -v -k test_manual_sharding_e2e -k test_spmd_shard_to_full_shape
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.
Summary:
This pull request enables SPMDShardToFullShape. The trickiest part is how to get the full shape, and here is a couple of options:
Tes Plan:
PJRT_DEVICE=TPU python test/spmd/test_xla_sharding.py -v -k test_manual_sharding_e2e -k test_spmd_shard_to_full_shape