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

[XLA:SPMD] Optimize the partitioning for element-wise operations when all operands share the same sharding. #22910

Merged
merged 1 commit into from
Feb 22, 2025

Conversation

copybara-service[bot]
Copy link

[XLA:SPMD] Optimize the partitioning for element-wise operations when all operands share the same sharding.

Let us take C with S3 = add(A with S1, B with S2) as an example, where A, B, C are tensors, S1, S2, S3 are their shardings.

Before this change, we always have

A with S3 = reshard(A with S1, new_sharding=S3)
B with S3 = reshard(B with S2, new_sharding=S3)
C with S3 = add(A with S3, B with S3)

With this cl, if S1 and S2 are the same, we will have

C with S1 = add(A with S1, B with S1)
C with S3 = reshard(C with S1)

The new partitioning method can reduce the number of reshards.

… all operands share the same sharding.

Let us take `C with S3 = add(A with S1, B with S2)` as an example, where A, B, C are tensors, S1, S2, S3 are their shardings.

Before this change, we always have
```
A with S3 = reshard(A with S1, new_sharding=S3)
B with S3 = reshard(B with S2, new_sharding=S3)
C with S3 = add(A with S3, B with S3)
```

With this cl, if S1 and S2 are the same, we will have
```
C with S1 = add(A with S1, B with S1)
C with S3 = reshard(C with S1)
```
The new partitioning method can reduce the number of reshards.

PiperOrigin-RevId: 729930762
@copybara-service copybara-service bot merged commit ad0814d into main Feb 22, 2025
@copybara-service copybara-service bot deleted the test_727116785 branch February 22, 2025 20:39
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