Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support shape transpose in hlo_sharding_util::ReshapeSharding. #64967

Merged
merged 1 commit into from Apr 6, 2024

Conversation

copybara-service[bot]
Copy link

Support shape transpose in hlo_sharding_util::ReshapeSharding.

Before this cl, hlo_sharding_util::ReshapeSharding can handle the cases where source and target shapes can be transformed to each other by merging and splitting dimension sizes. It returns std::nullopt if transpose is needed between source and target shapes.

This cl extracts the gcd(source_sharding_tile_size, target_shape) when source_shape % source_sharding_tile_size == 0 in the major dimensions. An example is shown below.

input_shape: [6, 4]
output_shape: [2, 2, 3, 2]
input_sharding: {devices=[6,1]<=[6]}

output_sharding is {devices=[2,1,1,1,3]<=[6] last_tile_dim_replicate}. Before this cl, the output_sharding is {replicated}.

@copybara-service copybara-service bot force-pushed the exported_pr_621333803 branch 5 times, most recently from bb50ac8 to ae011ba Compare April 6, 2024 06:06
Before this cl, `hlo_sharding_util::ReshapeSharding` can handle the cases where source and target shapes can be transformed to each other by merging and splitting dimension sizes. It returns `std::nullopt` if transpose is needed between source and target shapes.

This cl extracts the gcd(source_sharding_tile_size, target_shape) when `source_shape % source_sharding_tile_size == 0` in the major dimensions. An example is shown below.
```
input_shape: [6, 4]
output_shape: [2, 2, 3, 2]
input_sharding: {devices=[6,1]<=[6]}
```
output_sharding is `{devices=[2,1,1,1,3]<=[6] last_tile_dim_replicate}`. Before this cl, the output_sharding is `{replicated}`.
PiperOrigin-RevId: 622385031
@copybara-service copybara-service bot merged commit b0830a7 into master Apr 6, 2024
1 check passed
@copybara-service copybara-service bot deleted the exported_pr_621333803 branch April 6, 2024 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant