This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] Handle function calls from `libomp` to `libomptarget` correctly
ClosedPublic

Authored by tianshilei1992 on Apr 30 2023, 2:07 PM.

Details

Summary

D132005 introduced function calls from libomp to libomptarget if offloading
is enabled. However, the external function declaration may not always work. For
example, it causes a link error on macOS. Currently it is guarded properly by
a macro, but in order to get OpenMP target offloading working on macOS, it has
to be handled correctly. This patch applies the same idea of how we support
target memory extension by using function pointer indirect call for that function.

Diff Detail

Event Timeline

tianshilei1992 created this revision.Apr 30 2023, 2:07 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 30 2023, 2:07 PM
tianshilei1992 requested review of this revision.Apr 30 2023, 2:07 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 30 2023, 2:07 PM
jdoerfert added inline comments.May 1 2023, 1:36 PM
openmp/runtime/src/kmp_tasking.cpp
28

should we check/assert this is non-null, or do it later?

tianshilei1992 marked an inline comment as done.May 1 2023, 2:16 PM
tianshilei1992 added inline comments.
openmp/runtime/src/kmp_tasking.cpp
28

I'll add an assertion since it is supposed to be there.

jdoerfert accepted this revision.May 1 2023, 2:54 PM

LG, with assertion

This revision is now accepted and ready to land.May 1 2023, 2:54 PM
tianshilei1992 marked an inline comment as done.

rebase and fix comments

tianshilei1992 reopened this revision.May 1 2023, 3:23 PM
tianshilei1992 added inline comments.
openmp/runtime/src/kmp_tasking.cpp
1811

We actually want to do the assert here.

This revision is now accepted and ready to land.May 1 2023, 3:23 PM

fix runtime error