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

PR #22437: Added frontend attribute handling to explicit_stream_annotation_async_wrapper #23021

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

Conversation

copybara-service[bot]
Copy link

@copybara-service copybara-service bot commented Feb 24, 2025

PR #22437: Added frontend attribute handling to explicit_stream_annotation_async_wrapper

Imported from GitHub PR #22437

This is a small change that ensures the frontend attributes are correctly passed to both the async-start and async-done created pairs. This also clears the scheduling attributes that are directly on the call operation and inner ops.

The specific goal of this change is to have stable support combining the scheduling group ids with stream annotation in JAX.

with set_xla_metadata(_scheduling_group_id=1):
   result = compute_on("gpu_stream:1")(jitted_func)(...)

Currently, the issue stems from the set_xla_metadata context manager, which will apply the frontend attribute to all operations, including the ones within our jitted_func. When the same scheduling annotations is found in two HloComputations, an error is raised in LegalizeSchedulingAnnotations. This is intended to avoid hitting this check, and cleaning up the annotations on the wrapped streamed computation.
Copybara import of the project:

--
994c2ee by chaser [email protected]:

Added frontend attributed handling

--
9db58b2 by chaser [email protected]:

Added clearing of scheduling annotations

--
a83e32a by chaser [email protected]:

Added HloInstruction.erase_frontend_attribute

Merging this change closes #22437

Reverts 91ca1f1

FUTURE_COPYBARA_INTEGRATE_REVIEW=#22437 from chaserileyroberts:chase/frontend_forward_async_wrapper a83e32a

@copybara-service copybara-service bot force-pushed the test_730394376 branch 2 times, most recently from 9d45ccd to dcf6888 Compare February 24, 2025 19:40
…ation_async_wrapper

Imported from GitHub PR #22437

This is a small change that ensures the frontend attributes are correctly passed to both the `async-start` and `async-done` created pairs. This also clears the scheduling attributes that are directly on the call operation and inner ops.

The specific goal of this change is to have stable support combining the scheduling group ids with stream annotation in JAX.

```python
with set_xla_metadata(_scheduling_group_id=1):
   result = compute_on("gpu_stream:1")(jitted_func)(...)
```

Currently, the issue stems from the `set_xla_metadata` context manager, which will apply the frontend attribute to all operations, including the ones within our `jitted_func`. When the same scheduling annotations is found in two `HloComputation`s, an error is raised in `LegalizeSchedulingAnnotations`. This is intended to avoid hitting this check, and cleaning up the annotations on the wrapped streamed computation.
Copybara import of the project:

--
994c2ee by chaser <[email protected]>:

Added frontend attributed handling

--
9db58b2 by chaser <[email protected]>:

Added clearing of scheduling annotations

--
a83e32a by chaser <[email protected]>:

Added HloInstruction.erase_frontend_attribute

Merging this change closes #22437

Reverts 91ca1f1

FUTURE_COPYBARA_INTEGRATE_REVIEW=#22437 from chaserileyroberts:chase/frontend_forward_async_wrapper a83e32a
PiperOrigin-RevId: 730394376
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