Skip to content

Identify offload regions by omp_offload.info and wrap images with wrapOpenMPBinaries - #79

Merged
ggeorgakoudis merged 3 commits into
mainfrom
offload-entry-info
Sep 29, 2026
Merged

ggeorgakoudis merged 3 commits into
mainfrom
offload-entry-info

Conversation

@ggeorgakoudis

Copy link
Copy Markdown
Contributor

Summary

Target regions now use the same offload contract as clang: regions are
identified by !omp_offload.info metadata, and device images are embedded
by an LLVM wrapper step after lowering. They no longer travel inside the
DIR.OMP.TARGET directive. CPU host-offload and CUDA behavior is unchanged.

  • Identity: QUAL.OMP.TARGET.DEV_FUNC is replaced by an
    omp_offload.info record (device id, file id, parent name, line, count,
    order), emitted into both the host and device modules and linked from the
    directive by QUAL.OMP.OFFLOAD.ENTRY.IDX. The pass derives the kernel,
    region-id and entry names with OpenMPIRBuilder, so host and device
    names cannot disagree.
  • Transport: QUAL.OMP.TARGET.ELF is replaced by a private image global
    listed in !pyomp.offload_images. After lowering, the pass wraps each
    image with llvm::offloading::wrapOpenMPBinaries into its own
    descriptor, replacing the hand-written descriptor and registration code.
    Under JIT no linker defines the entry-array bounds, so the end bound is a
    placeholder replaced with the array end.
  • Entry layout: offload entries use offloading::emitOffloadingEntry
    (the versioned layout in llvm_offload_entries) instead of the legacy
    5-field struct.

New tests cover two target regions in one function and one target function
compiled for two signatures.

Assisted-by: Claude Code (Claude Opus 5.5)

Replace QUAL.OMP.TARGET.DEV_FUNC with clang's region identity: an
omp_offload.info record, linked from DIR.OMP.TARGET by
QUAL.OMP.OFFLOAD.ENTRY.IDX. The pass derives the kernel and entry
names from the record in both modules, so host and device names
cannot diverge.

Assisted-by: Claude Code (Claude Opus 5.5)
Drop QUAL.OMP.TARGET.ELF and the hand-written descriptor and
registration code. Images travel as host-module globals listed in
!pyomp.offload_images and get one descriptor each after lowering.
No linker defines the entry bounds under JIT, so the end bound is a
placeholder replaced with the array end.

Add tests for two target regions in one function and for one
function compiled for two signatures.

Assisted-by: Claude Code (Claude Opus 5.5)
Use offloading::emitOffloadingEntry instead of the hand-built 5-field
entry. The runtime still upgrades the legacy layout, so this only
matches what clang emits.

Assisted-by: Claude Code (Claude Opus 5.5)

@DrTodd13 DrTodd13 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

thanks!

@ggeorgakoudis
ggeorgakoudis merged commit 82e0bc5 into main Sep 29, 2026
62 checks passed
@ggeorgakoudis
ggeorgakoudis deleted the offload-entry-info branch September 29, 2026 23:56
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