From 60a40cf37904f6496ad038be5f494e3c37a7d1bb Mon Sep 17 00:00:00 2001 From: Joseph Huber Date: Wed, 22 Sep 2021 14:37:33 -0400 Subject: [PATCH] [OpenMP] Fix KeepAlive usage Summary: Functions were called the wrong way around, this didn't keep the symbol alive. --- openmp/libomptarget/DeviceRTL/include/Utils.h | 2 -- openmp/libomptarget/DeviceRTL/src/Mapping.cpp | 1 - openmp/libomptarget/DeviceRTL/src/Utils.cpp | 1 + 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/openmp/libomptarget/DeviceRTL/include/Utils.h b/openmp/libomptarget/DeviceRTL/include/Utils.h index 9ac37a6..dc4b1cd 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 8b8a39e..96a612d 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 24c2d8a..1317bc6 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 -- 2.7.4