[SPMD] Introduce high level manual sharding APIs#6931
Merged
alanwaketan merged 5 commits intomasterfrom Apr 17, 2024
Merged
Conversation
yeounoh
reviewed
Apr 17, 2024
| *, | ||
| mesh: Mesh = None) -> XLAShardedTensor: | ||
| """ | ||
| This API enables manual sharding for the given tensor. Manual sharding disables auto sharding proporgation and auto |
Contributor
There was a problem hiding this comment.
"auto" --> "SPMD", think it's important to not confuse.
yeounoh
approved these changes
Apr 17, 2024
Contributor
yeounoh
left a comment
There was a problem hiding this comment.
LGTM, left a comment for comment :)
jonb377
approved these changes
Apr 17, 2024
| """ | ||
| mesh = get_global_mesh() if mesh is None else mesh | ||
| t = mark_sharding(unwrap_sharded_tensor(t), mesh, partition_spec) | ||
| t = torch_xla._XLAC._spmd_full_to_shard_shape(unwrap_sharded_tensor(t)) |
Collaborator
There was a problem hiding this comment.
Can t here be DeviceData?
Collaborator
Author
There was a problem hiding this comment.
You mean the input? Yes!
jonb377
reviewed
Apr 17, 2024
| """ | ||
| This API enables manual sharding for the given tensor. Manual sharding disables auto sharding proporgation and auto | ||
| partition for the given tensor and all subsequential tensors that produced by an op that uses the given tensor as | ||
| input, and therefore allows the user to manually call collectives for the tensor and subsequential tensors. It |
Collaborator
There was a problem hiding this comment.
Also just curious - how will we enable collectives in a manual region?
Collaborator
Author
There was a problem hiding this comment.
XLA cc ops by default should work. Just use it as normal. However, we need to teach our cc ops wrapper to be aware of SPMD mode. So, it will be phase 2 of the mnual sharding.
lausannel
pushed a commit
to AlibabaPAI/xla
that referenced
this pull request
Aug 6, 2024
Summary: This pull request introduces: 1. enable_manual_sharding: which starts the manual sharding region. 2. disable_manual_sharding: which disable the manual sharding region. Test Plan: PJRT_DEVICE=TPU python test/spmd/test_xla_sharding.py -v -k test_manual_sharding_api_e2e
baoleai
pushed a commit
to AlibabaPAI/xla
that referenced
this pull request
Aug 6, 2024
Summary: This pull request introduces: 1. enable_manual_sharding: which starts the manual sharding region. 2. disable_manual_sharding: which disable the manual sharding region. Test Plan: PJRT_DEVICE=TPU python test/spmd/test_xla_sharding.py -v -k test_manual_sharding_api_e2e
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 introduces:
Test Plan:
PJRT_DEVICE=TPU python test/spmd/test_xla_sharding.py -v -k test_manual_sharding_api_e2e