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:GPU] Swap dot operands in certain cases. #19922

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

Conversation

copybara-service[bot]
Copy link

[XLA:GPU] Swap dot operands in certain cases.

On H100, the wgmma instruction supports lhs operand in registers but not rhs operand. That means that there is any prologue for one of the sides (e.g. conversion), it's better to put it into the lhs -- as elements will be in registers after computing the prologue.

Additionally, minimal lhs non-contracting dimension size (M dimension) is 64, while for rhs smaller sizes are supported.

Because of that, after the Triton fusion is known, swap lhs and rhs ops in the following cases:

  • If rhs has prologue, and lhs doesn't, and N-size (rhs non-contracting dim) is ≥64, swap.
  • If M<64 and N≥64, swap.

On H100, the `wgmma` instruction supports lhs operand in registers but not rhs operand. That means that there is any prologue for one of the sides (e.g. conversion), it's better to put it into the lhs -- as elements will be in registers after computing the prologue.

Additionally, minimal lhs non-contracting dimension size (M dimension) is 64, while for rhs smaller sizes are supported.

Because of that, after the Triton fusion is known, swap lhs and rhs ops in the following cases:

- If rhs has prologue, and lhs doesn't, and N-size (rhs non-contracting dim) is ≥64, swap.
- If M<64 and N≥64, swap.

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