This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] Introduce '-f[no-]openmp-target-jit' flag to control JIT for offloading
ClosedPublic

Authored by jhuber6 on Jan 6 2023, 1:32 PM.

Details

Summary

JIT support for OpenMP offloading was introduced in D139287. This patch
adds a simple flag that enables this mode. It simply requires enabling
-foffload-lto mode and --embed-bitcode in the linker wrapper. This
option implies LTO if it is not enabled.

Diff Detail

Event Timeline

jhuber6 created this revision.Jan 6 2023, 1:32 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 6 2023, 1:32 PM
jhuber6 requested review of this revision.Jan 6 2023, 1:32 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 6 2023, 1:32 PM
jdoerfert added inline comments.Jan 6 2023, 1:37 PM
clang/lib/Driver/Driver.cpp
730

Should we overwrite unconditionally or warn/error if the combination is nonsensical?

jhuber6 added inline comments.Jan 6 2023, 1:39 PM
clang/lib/Driver/Driver.cpp
730

Yeah, we might need something like that. Like if the user specifies thin then the monolithic linking won't work. Probably will need a check for that.

jhuber6 updated this revision to Diff 486991.Jan 6 2023, 2:37 PM

Adding an error print and some tests for it. We error if the user specified any -foffload-lto optoins that don't result in full LT.O

This revision is now accepted and ready to land.Jan 6 2023, 2:44 PM
jdoerfert retitled this revision from [OpenMP] Introduce '-f[no]-openmp-target-jit' flag to control JIT for offloading to [OpenMP] Introduce '-f[no-]openmp-target-jit' flag to control JIT for offloading.Jan 6 2023, 4:36 PM

The newly added test fails when tools/clang/include/clang/Config/config.h is configured with #define CLANG_DEFAULT_OPENMP_RUNTIME "libgomp". Please fix. Thanks!

The newly added test fails when tools/clang/include/clang/Config/config.h is configured with #define CLANG_DEFAULT_OPENMP_RUNTIME "libgomp". Please fix. Thanks!

Should be fixed now, let me know if there's anything else failing.