[Openmp-commits] [openmp] 60a40cf - [OpenMP] Fix KeepAlive usage

Joseph Huber via Openmp-commits openmp-commits at lists.llvm.org
Wed Sep 22 11:39:02 PDT 2021


Author: Joseph Huber
Date: 2021-09-22T14:38:19-04:00
New Revision: 60a40cf37904f6496ad038be5f494e3c37a7d1bb

URL: https://github.com/llvm/llvm-project/commit/60a40cf37904f6496ad038be5f494e3c37a7d1bb
DIFF: https://github.com/llvm/llvm-project/commit/60a40cf37904f6496ad038be5f494e3c37a7d1bb.diff

LOG: [OpenMP] Fix KeepAlive usage

Summary:
Functions were called the wrong way around, this didn't keep the symbol
alive.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/openmp/libomptarget/DeviceRTL/include/Utils.h b/openmp/libomptarget/DeviceRTL/include/Utils.h
index 9ac37a66d4fc..dc4b1cd71a59 100644
--- a/openmp/libomptarget/DeviceRTL/include/Utils.h
+++ b/openmp/libomptarget/DeviceRTL/include/Utils.h
@@ -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);

diff  --git a/openmp/libomptarget/DeviceRTL/src/Mapping.cpp b/openmp/libomptarget/DeviceRTL/src/Mapping.cpp
index 8b8a39e8023e..96a612d5cf3f 100644
--- a/openmp/libomptarget/DeviceRTL/src/Mapping.cpp
+++ b/openmp/libomptarget/DeviceRTL/src/Mapping.cpp
@@ -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();
 }
 }

diff  --git a/openmp/libomptarget/DeviceRTL/src/Utils.cpp b/openmp/libomptarget/DeviceRTL/src/Utils.cpp
index 24c2d8adc5f7..1317bc69fc51 100644
--- a/openmp/libomptarget/DeviceRTL/src/Utils.cpp
+++ b/openmp/libomptarget/DeviceRTL/src/Utils.cpp
@@ -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


        


More information about the Openmp-commits mailing list