Page MenuHomePhabricator

[OpenMP][WIP][POC] Compile the device runtime as C++
Needs ReviewPublic

Authored by jdoerfert on Jan 14 2021, 9:17 AM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

The main contribution of this patch is the new CMakeLists.txt which
shows how we can compile the device runtime as C++ for various targets
and subtargets. Running ninja omptarget-device-rtl results in

libomptarget-device-rtl-nvptx64-sm35-ptx50.bc
libomptarget-device-rtl-nvptx64-sm35-ptx60.bc
libomptarget-device-rtl-nvptx64-sm35-ptx61.bc
libomptarget-device-rtl-nvptx64-sm35-ptx62.bc
libomptarget-device-rtl-nvptx64-sm35-ptx63.bc
libomptarget-device-rtl-nvptx64-sm35-ptx64.bc
libomptarget-device-rtl-nvptx64-sm35-ptx65.bc
libomptarget-device-rtl-nvptx64-sm35-ptx70.bc
libomptarget-device-rtl-nvptx64-sm35-ptx71.bc
libomptarget-device-rtl-nvptx-sm35-ptx50.bc
libomptarget-device-rtl-nvptx-sm35-ptx60.bc
libomptarget-device-rtl-nvptx-sm35-ptx61.bc
libomptarget-device-rtl-nvptx-sm35-ptx62.bc
libomptarget-device-rtl-nvptx-sm35-ptx63.bc
libomptarget-device-rtl-nvptx-sm35-ptx64.bc
libomptarget-device-rtl-nvptx-sm35-ptx65.bc
libomptarget-device-rtl-nvptx-sm35-ptx70.bc
libomptarget-device-rtl-nvptx-sm35-ptx71.bc
libomptarget-device-rtl-x86_64-unknown-linux-gnu.bc

As part of this we should remove most of the source annotations, e.g.
INLINE, and EXTERN, as long as they are not strictly needed. SHARED
will be replaced by the macro used in D93135 or D77472.

For lanemask and similar target dependent functions we should have a
begin/end declare variant file:

// I'm gussing here:
using kmpc_lanemask = uint64_t;

void some_target_specific_function_decl(...);

void __kmpc_some_target_specific_function_impl(...) {
  some_target_specific_function_decl(...);
}

Diff Detail

Event Timeline

jdoerfert created this revision.Jan 14 2021, 9:17 AM
jdoerfert requested review of this revision.Jan 14 2021, 9:17 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 14 2021, 9:17 AM
Herald added a subscriber: sstefan1. · View Herald Transcript
jdoerfert updated this revision to Diff 316679.Jan 14 2021, 9:20 AM

Remove accidentially included header

jdoerfert added inline comments.Jan 14 2021, 9:24 AM
openmp/libomptarget/deviceRTLs/common/debug.h
129

All of this seems totally broken. As far as I can tell, OMPTARGET_NVPTX_TEST and some other macros are always set and later we check if they are set. It's odd.

openmp/libomptarget/deviceRTLs/common/omptarget.h
41

If we really want, we can mark the entry points with the flatten attribute. Other than that, there is little point in adding "inline" and such everywhere through these macros. If the compiler doesn't figure it out we should change the target pipeline defaults instead and thereby help user code as well.

openmp/libomptarget/deviceRTLs/common/src/cancel.cu
15–21

We should go through and minimize include dependences before we do anything else. The structure right now is also very confusing. There is no need for "internal headers" and the likes anymore.

ye-luo added a subscriber: ye-luo.Jan 14 2021, 11:10 AM