Skip to content

[RFC] Add source_target_pairs attribute to send and recv ops in stableHLO #2784

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

rosiezou
Copy link
Member

No description provided.

@rosiezou rosiezou requested a review from GleasonK April 23, 2025 05:12
@sdasgup3 sdasgup3 self-requested a review April 23, 2025 17:43
@mjsML
Copy link
Member

mjsML commented Apr 23, 2025

%results0, %results1 = "stablehlo.recv"(%token) {
source_target_pairs = dense<[[0, 1], [1, 2]]> : tensor<2x2xi64>,
channel_handle = #stablehlo.channel_handle<handle = 1, type = 3>,
is_host_transfer = true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we keep it false to make it clear that the source_target_pairs will have some effect in this particular example.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion applied

#### Semantics

Sends `inputs` to a channel `channel_id`. Inputs are then sent to other devices
in the order specified by `source_target_pairs`. The operation produces a
Copy link
Member

@sdasgup3 sdasgup3 Apr 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to recv can we defer the mention of in the order specified by source_target_pairs to the second paragraph (as it is now), unless we somehow capture the event of is_host_transfer being true in the same paragraph.

My goal here to keep the wording consistent with recv.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion applied

@rosiezou
Copy link
Member Author

@GleasonK is this RFC good to go now?

proposed in conjunction with exposing send/recv operations through the JAX
`shard_map` API.

## Proposed Specification
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a section for "A Note on Backward Compatibility", denoting that we're technically making the semantics more strict for send given that any instances of send is_host_transfer=false that are serialized will no longer be deserializable, but this is likely OK since this would have been undefined behavior as it is.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @frgossen to confirm this as well

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.

4 participants