Identify offload regions by omp_offload.info and wrap images with wrapOpenMPBinaries - #79
Merged
Merged
Conversation
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Target regions now use the same offload contract as clang: regions are
identified by
!omp_offload.infometadata, and device images are embeddedby an LLVM wrapper step after lowering. They no longer travel inside the
DIR.OMP.TARGETdirective. CPU host-offload and CUDA behavior is unchanged.QUAL.OMP.TARGET.DEV_FUNCis replaced by anomp_offload.inforecord (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 devicenames cannot disagree.
QUAL.OMP.TARGET.ELFis replaced by a private image globallisted in
!pyomp.offload_images. After lowering, the pass wraps eachimage with
llvm::offloading::wrapOpenMPBinariesinto its owndescriptor, 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.
offloading::emitOffloadingEntry(the versioned layout in
llvm_offload_entries) instead of the legacy5-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)