This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] Modernize the kernel launching interface and APIs
ClosedPublic

Authored by jdoerfert on Jan 8 2023, 1:38 PM.

Details

Summary

We already created a versioned __tgt_kernel_arguments struct but it
was only briefly used and its content was passed in isolation anyway.
This makes it hard to add more information in the future. With this
patch we fully embrace the struct as means to pass information from the
compiler to the plugin as part of a kernel launch.

The patch also extends and renames the struct, bumping the version
number to 2. Version 1 entries are auto-upgraded. This is in preparation
for "bare" kernel launches, per kernel dynamic shared memory, CUDA/HIP
support, etc.

The __tgt_target_kernel_nowait interface was deprecated. Once we
actually implement something like that, we can add an appropriate API.

Note: Only plugins with the launch_kernel interface are now supported.

That means that an old clang won't be able to use an old runtime.
An old clang can still use the new runtime since the libomptarget
interface did not change.

Note: Context has been reduced to match the 8MB upload limit of phab.

Diff Detail

Event Timeline

jdoerfert created this revision.Jan 8 2023, 1:38 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 8 2023, 1:38 PM
jdoerfert requested review of this revision.Jan 8 2023, 1:38 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 8 2023, 1:38 PM

This looks OK for us (HPE). CCE does use the entry point that this patch will deprecate, and we'll probably keep it around in our runtime, so as long as it is not repurposed and changed in the future than it should not affect us. We will plan to use the new interface for target nowait once it is in.

jhuber6 accepted this revision.Jan 15 2023, 12:14 PM

LG, this really simplifies things. I'm assuming this passes all our tests.

This revision is now accepted and ready to land.Jan 15 2023, 12:14 PM
jdoerfert added inline comments.Jan 15 2023, 12:15 PM
openmp/libomptarget/include/omptarget.h
134

While I'm here, I will also add an uint64_t field for the "stream" (or similar) passed to cuda/hip kernels.

jdoerfert updated this revision to Diff 490669.Jan 19 2023, 2:50 PM

rebase, fix issues.

This revision was landed with ongoing or failed builds.Jan 21 2023, 11:31 AM
This revision was automatically updated to reflect the committed changes.
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJan 21 2023, 11:31 AM

hi, breaks our amdgpu buildbot, please fix ASAP , or revert and fix. thx
3 patches: https://lab.llvm.org/buildbot/#/builders/193/builds/25299

i reverted locally and verified this patch as the cause.

hi, breaks our amdgpu buildbot, please fix ASAP , or revert and fix. thx
3 patches: https://lab.llvm.org/buildbot/#/builders/193/builds/25299

i reverted locally and verified this patch as the cause.

Fixed by 3820d0eaaf4ecb557cbb260e34bf5a9eeb51e0e7.