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 avoid sideways operand propagation for elementwise ops which can't propagate to the result. #382

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

copybara-service[bot]
Copy link

#sdy avoid sideways operand propagation for elementwise ops which can't propagate to the result.

We don't want to propagate sideways through operands if the element-wise factor is used in the result and is not sharded in the same way. We want to avoid this to avoid the following situation which can happen when a sharding_constraint is added onto the operand during Shardy import:

%arg0: [{"a", ?}]
%arg1: [{?}]
%0 = add %arg0, %arg1 : [{}]

We don't want to do an all-gather on both %arg0 and %arg1 due to "a" propagating sideways. Instead with the code below, since "a" can't propagate to %0, we will only do an all-gather on %arg0.

Long term we should undo this and allow sideways propagation, but have our explicit reshard pass make sure the result is all-gathered instead of both operands.

…'t propagate to the result.

We don't want to propagate sideways through operands if the element-wise factor is used in the result and is not sharded in the same way. We want to avoid this to avoid the following situation which can happen when a `sharding_constraint` is added onto the operand during Shardy import:

```mlir
%arg0: [{"a", ?}]
%arg1: [{?}]
%0 = add %arg0, %arg1 : [{}]
```

We don't want to do an all-gather on both %arg0 and %arg1 due to "a" propagating sideways. Instead with the code below, since "a" can't propagate to `%0`, we will only do an all-gather on %arg0.

Long term we should undo this and allow sideways propagation, but have our explicit reshard pass make sure the result is all-gathered instead of both operands.

PiperOrigin-RevId: 726920093
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