Skip to content

Add tgt_target_kernel_async and helper - #212862

Draft
ZuseZ4 wants to merge 1 commit into
llvm:mainfrom
ZuseZ4:async-offload-kernel-launch
Draft

Add tgt_target_kernel_async and helper#212862
ZuseZ4 wants to merge 1 commit into
llvm:mainfrom
ZuseZ4:async-offload-kernel-launch

Conversation

@ZuseZ4

@ZuseZ4 ZuseZ4 commented Jul 29, 2026

Copy link
Copy Markdown

On the Rust side, we want to have more control over how we launch our kernel.
The implicit sync at the normal __tgt_target_kernel launch caused a 6x perf overhead on a set of (shorter) kernels which we were benchmarking. Rust usage: rust-lang/rust#156620
Wip till I get to add tests/fix codestyle/etc.

cc @jdoerfert @kevinsala

Disclaimer: I used an LLM for the interface.cpp changes

@github-actions

Copy link
Copy Markdown

Hello @ZuseZ4 👋

Thank you for submitting a Pull Request (PR) to the LLVM Project. Since this is your first PR, here are a few useful links covering our main contribution policies and review practices.

  • All contributions to LLVM must follow our LLVM AI Tool Use Policy. In particular, if you used AI while working on this PR, remember to add a note to the PR description.
  • The LLVM Code-Review Policy and Practices document contains practical information about the PR process, including how patches are reviewed and accepted, and who can review a PR.
  • Our LLVM Developer Policy describes our expectations for code quality, commit summaries and contains notes on our CI system.

Please reply to this message to confirm that you have read these policies, especially the LLVM AI Tool Use Policy, and that any AI tool usage has been noted in the PR description.


Frequently asked questions

How do I add reviewers?

This PR will be automatically labeled, and the relevant teams will be notified. For some parts of the project, reviewers may also be added automatically.

You can also add reviewers manually using the Reviewers section on this page. If you cannot use that section, it is probably because you do not have write permissions for the repository. In that case, you can request a review by tagging reviewers in a comment using @ followed by their GitHub username.

What if there are no comments?

If you have not received any comments on your PR after a week, you can request a review by pinging the PR with a comment such as “Ping”. The common courtesy ping rate is once a week. Please remember that you are asking for volunteer time from other developers.

Are any special GitHub settings required to contribute to LLVM?

We only require contributors to have a public email address associated with their GitHub commits, see this section of LLVM Developer Policy for details.


If you have questions, feel free to leave a comment on this PR, or ask on LLVM Discord or LLVM Discourse.

Thank you,
The LLVM Community

@jdoerfert jdoerfert left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I thought we had helpers to create and sync async info objects already, did I imagine that?

}

struct __tgt_async_info_handle {
int64_t DeviceId;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

An AsyncInfoTy has the device ID and you probably don't need another type to wrap it at all.

return;

Handle->AsyncInfo.synchronize();
delete Handle;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Handle = nullptr?


handleTargetOutcome(Rc == OFFLOAD_SUCCESS, Loc);
return Rc;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This function looks copied, can we reuse the original instead?

@kevinsala
kevinsala self-requested a review August 25, 2026 23:52
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.

2 participants