This is an archive of the discontinued LLVM Phabricator instance.

[LinkerWrapper] Embed OffloadBinaries for OpenMP offloading images
ClosedPublic

Authored by jhuber6 on Jun 8 2022, 6:51 AM.

Details

Summary

The OpenMP offloading runtine currently uses an array of linked
offloading images. One downside to this is that we cannot know the
architecture or triple associated with the given image. In this patch,
instead of embedding the image itself, we embed an offloading binary
instead. This binary is simply a binary format that wraps around the
original linked image to provide some additional metadata. This will
allow us to support offloading to multiple architecture, or performing
future JIT compilation inside of the runtime, more clearly.
Additionally, these can be placed at a special section such that the
supported architectures can be identified using objdump with the support
from D126904. This needs to be stored in a new section name
.llvm.offloading.images because the .llvm.offloading section
implicitly uses the SHF_EXCLUDE flag and will always be stripped.

This patch does not contain the necessary code to parse these in
libomptarget.

Depends on D127246

Diff Detail

Event Timeline

jhuber6 created this revision.Jun 8 2022, 6:51 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 8 2022, 6:51 AM
jhuber6 requested review of this revision.Jun 8 2022, 6:51 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 8 2022, 6:51 AM
jhuber6 updated this revision to Diff 443810.Jul 11 2022, 6:24 PM

Removing .image from section name. This was originally done to avoid it getting the SHF_EXCLUDE flag when it should not be removed by the linker. That behaviour was moved to the !exclude metadata in a previous patch.

saiislam accepted this revision.Jul 12 2022, 6:09 AM

Thanks, LGTM!

This revision is now accepted and ready to land.Jul 12 2022, 6:09 AM
This revision was landed with ongoing or failed builds.Jul 21 2022, 10:20 AM
This revision was automatically updated to reflect the committed changes.