[OpenMP] Create and use `__kmpc_is_generic_main_thread`
authorJohannes Doerfert <johannes@jdoerfert.de>
Thu, 1 Jul 2021 05:21:26 +0000 (00:21 -0500)
committerJohannes Doerfert <johannes@jdoerfert.de>
Mon, 12 Jul 2021 00:18:03 +0000 (19:18 -0500)
commita7b7b5dfe5a931a76cbe8410e5a9f55beea73c8e
tree90f1e47f6c13a04c11e5ab34ae26c9fcefe1334e
parent1ab1f04a2be34bea2fb34df0f5ff0bd75bdc7aa0
[OpenMP] Create and use `__kmpc_is_generic_main_thread`

In order to fold calls based on high-level knowledge and control flow
tracking it helps to expose the information as a runtime call. The
logic: `!SPMD && getTID() == getMasterTID()` was used in various places
and is now encapsulated in `__kmpc_is_generic_main_thread`. As part of
this rewrite we replaced eager computation of arguments with on-demand
computation, especially helpful if the calls can be folded and arguments
don't need to be computed consequently.

Differential Revision: https://reviews.llvm.org/D105768
12 files changed:
openmp/libomptarget/deviceRTLs/common/omptargeti.h
openmp/libomptarget/deviceRTLs/common/src/data_sharing.cu
openmp/libomptarget/deviceRTLs/common/src/libcall.cu
openmp/libomptarget/deviceRTLs/common/src/loop.cu
openmp/libomptarget/deviceRTLs/common/src/omptarget.cu
openmp/libomptarget/deviceRTLs/common/src/parallel.cu
openmp/libomptarget/deviceRTLs/common/src/reduction.cu
openmp/libomptarget/deviceRTLs/common/src/support.cu
openmp/libomptarget/deviceRTLs/common/src/sync.cu
openmp/libomptarget/deviceRTLs/common/src/task.cu
openmp/libomptarget/deviceRTLs/common/support.h
openmp/libomptarget/deviceRTLs/interface.h