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

#sdy Introduce sdy.collective_permute #343

Merged
merged 1 commit into from
Jan 28, 2025
Merged

Conversation

copybara-service[bot]
Copy link

@copybara-service copybara-service bot commented Jan 27, 2025

#sdy Introduce sdy.collective_permute

An axis based collective permute can replace axes across dimensions with the same or other axes, and in a different order, as long as the sharded size in each dimension stays the same. This translates into a single HLO collective permute.

For example:

sdy.mesh @mesh = <["a"=2, "b"=2, "c"=4, "d"=2, "e"=2, "f"=2]>
%1 = stablehlo.tanh(%0) {sdy.sharding = #sdy.sharding_per_value<[<@mesh, [{"a", "c"}, {"f"}, {"d", "e"}]>]>} : tensor<8x8x8xf32>
%2 = sdy.collective_permute %1 out_sharding=<@mesh, [{"c":(1)2, "b", "f"}, {"a"}, {"e", "d"}]> : tensor<8x8x8xf32>

@copybara-service copybara-service bot force-pushed the test_719853614 branch 2 times, most recently from 132b011 to 4dbdfe3 Compare January 28, 2025 09:55
An axis based collective permute can replace axes across dimensions with the same or other axes, and in a different order, as long as the sharded size in each dimension stays the same. This translates into a single HLO collective permute.

For example:
```
sdy.mesh @mesh = <["a"=2, "b"=2, "c"=4, "d"=2, "e"=2, "f"=2]>
%1 = stablehlo.tanh(%0) {sdy.sharding = #sdy.sharding_per_value<[<@mesh, [{"a", "c"}, {"f"}, {"d", "e"}]>]>} : tensor<8x8x8xf32>
%2 = sdy.collective_permute %1 out_sharding=<@mesh, [{"c":(1)2, "b", "f"}, {"a"}, {"e", "d"}]> : tensor<8x8x8xf32>
```

PiperOrigin-RevId: 720572879
@copybara-service copybara-service bot merged commit 648b109 into main Jan 28, 2025
@copybara-service copybara-service bot deleted the test_719853614 branch January 28, 2025 15:52
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.

1 participant