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

[wgmma] Insert commit_group and wait_group after mma_async #3573

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

Conversation

jacobhinkle
Copy link
Collaborator

Fixes #3561.

@jacobhinkle
Copy link
Collaborator Author

!test

@rdspring1
Copy link
Collaborator

@jacobhinkle I ran into #3561 when working with register sharing and warp specialization. I wonder if I can use this.

Copy link
Collaborator

@rdspring1 rdspring1 left a comment

Choose a reason for hiding this comment

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

There can be multiple wgmma operations per circular buffer stage. e.g., when the k dimension is a multiple of mma macro.

It should be safe to wait for all operations per stage.

I made the following change in WarAsyncWaitInserter.
https://github.com/NVIDIA/Fuser/pull/3616/files#diff-49bea61a8cde014ec0396c89d0654813136e0bd3ffe8b3a5974ee9ccf3a5fbb8R1010-R1024

It didn't any performance difference. 🤷🏼

auto* commit = IrBuilder::create<kir::AsyncCommit>(AsyncOpType::WgMma);
auto* wait = IrBuilder::create<kir::AsyncWait>(
AsyncOpType::WgMma,
/*keep_stages=*/cb_opts.stage - cb_opts.prefetch - 1);
Copy link
Collaborator

Choose a reason for hiding this comment

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

If cb_opts.stage - cb_opts.prefetch == 0, then the keep_stages will be -1, which is invalid.

Suggested change
/*keep_stages=*/cb_opts.stage - cb_opts.prefetch - 1);
std::min(0LL, /*keep_stages=*/cb_opts.stage - cb_opts.prefetch - 1));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing sync in matmul kernel
2 participants