Skip to content

[xla:gpu] Refactor ThunkEmitter and collective (group) lowering#46188

Open
ezhulenev wants to merge 1 commit into
openxla:mainfrom
ezhulenev:collectives-thunk-emitter-cleanup
Open

[xla:gpu] Refactor ThunkEmitter and collective (group) lowering#46188
ezhulenev wants to merge 1 commit into
openxla:mainfrom
ezhulenev:collectives-thunk-emitter-cleanup

Conversation

@ezhulenev

@ezhulenev ezhulenev commented Jul 24, 2026

Copy link
Copy Markdown
Member

NFC: this change doesn't haver any functional changes, and mostly tries to improve the structure and documentation on ThunkEmitter.

At run time XLA:GPU has one generic Async(Start/Done)Thunk that wraps nested synchronous compute. ThunkEmitter had async wrapping logic scattered around many places. This change makes thunk emission consistent with the runtime mental model and documents and cleans up ThunkEmitter.

  • Separates HLO dispatch from operation-specific thunk construction.
  • Centralizes AsyncExecution registration and sharing between start/done thunks.
  • Adds explicit _collectives_group lowering for grouped collectives and device send/recv operations.
  • Updates the send/recv combiner to create named, explicitly annotated async groups.
  • Supports collective groups containing multiple communicators and degenerate device-to-device copies.

Motivation

The previous emitter mixed HLO dispatch, async lifecycle management, buffer selection, and thunk construction across several specialized paths. This made the semantics of generic async operations, legacy collectives, send/recv, host transfers, and grouped collectives difficult to reason about consistently.

The refactor makes those decisions explicit and ensures that:

  • Async start and done thunks share the same registered execution state.
  • Collective source and destination buffers follow HLO dataflow semantics.
  • Device send/recv operations inside an explicit group are launched together.
  • Host transfers continue to use their dedicated completion events.
  • Synchronous and asynchronous collective lowering share the same payload emission logic.

@ezhulenev
ezhulenev requested a review from ermilovmaxim July 24, 2026 18:56
@github-actions

Copy link
Copy Markdown

PR #46188 additions: 1124, deletions: 1036, total: 2160

🔴 This PR has a very large delta of over 1000. In order to enable an effective code reivew, please break the PR down into smaller and more focused PRs.
See the Small CLs Google Eng practice for more details on how to write compact PRs.

@ezhulenev
ezhulenev force-pushed the collectives-thunk-emitter-cleanup branch from 9a99b3c to d0c4da6 Compare July 24, 2026 19:09
@github-actions

Copy link
Copy Markdown

PR #46188 additions: 1148, deletions: 1063, total: 2211

🔴 This PR has a very large delta of over 1000. In order to enable an effective code reivew, please break the PR down into smaller and more focused PRs.
See the Small CLs Google Eng practice for more details on how to write compact PRs.

@ezhulenev
ezhulenev force-pushed the collectives-thunk-emitter-cleanup branch from d0c4da6 to 6626085 Compare July 24, 2026 19:39
@github-actions

Copy link
Copy Markdown

PR #46188 additions: 1150, deletions: 1063, total: 2213

🔴 This PR has a very large delta of over 1000. In order to enable an effective code reivew, please break the PR down into smaller and more focused PRs.
See the Small CLs Google Eng practice for more details on how to write compact PRs.

@ezhulenev
ezhulenev force-pushed the collectives-thunk-emitter-cleanup branch from 6626085 to c558c02 Compare July 24, 2026 19:44
@github-actions

Copy link
Copy Markdown

PR #46188 additions: 1155, deletions: 1069, total: 2224

🔴 This PR has a very large delta of over 1000. In order to enable an effective code reivew, please break the PR down into smaller and more focused PRs.
See the Small CLs Google Eng practice for more details on how to write compact PRs.

@ezhulenev
ezhulenev force-pushed the collectives-thunk-emitter-cleanup branch from c558c02 to 59728c1 Compare July 24, 2026 21:01
@github-actions

Copy link
Copy Markdown

PR #46188 additions: 1163, deletions: 1073, total: 2236

🔴 This PR has a very large delta of over 1000. In order to enable an effective code reivew, please break the PR down into smaller and more focused PRs.
See the Small CLs Google Eng practice for more details on how to write compact PRs.

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