[OpenMP] Fix KeepAlive usage
authorJoseph Huber <jhuber6@vols.utk.edu>
Wed, 22 Sep 2021 18:37:33 +0000 (14:37 -0400)
committerJoseph Huber <jhuber6@vols.utk.edu>
Wed, 22 Sep 2021 18:38:19 +0000 (14:38 -0400)
Summary:
Functions were called the wrong way around, this didn't keep the symbol
alive.

openmp/libomptarget/DeviceRTL/include/Utils.h
openmp/libomptarget/DeviceRTL/src/Mapping.cpp
openmp/libomptarget/DeviceRTL/src/Utils.cpp

index 9ac37a6..dc4b1cd 100644 (file)
@@ -17,8 +17,6 @@
 namespace _OMP {
 namespace utils {
 
-void keepAlive();
-
 /// Return the value \p Var from thread Id \p SrcLane in the warp if the thread
 /// is identified by \p Mask.
 int32_t shuffle(uint64_t Mask, int32_t Var, int32_t SrcLane);
index 8b8a39e..96a612d 100644 (file)
@@ -228,7 +228,6 @@ bool mapping::isGenericMode() { return !isSPMDMode(); }
 
 extern "C" {
 __attribute__((noinline)) uint32_t __kmpc_get_hardware_thread_id_in_block() {
-  _OMP::utils::keepAlive();
   return mapping::getThreadIdInBlock();
 }
 }
index 24c2d8a..1317bc6 100644 (file)
@@ -21,6 +21,7 @@ using namespace _OMP;
 namespace _OMP {
 /// Helper to keep code alive without introducing a performance penalty.
 __attribute__((used, weak, optnone)) void keepAlive() {
+  __kmpc_get_hardware_thread_id_in_block();
   __kmpc_barrier_simple_spmd(nullptr, 0);
 }
 } // namespace _OMP