[Openmp-commits] [openmp] ab9f3f5 - [OpenMP] Introduce the keepAlive function into the old device RT
Johannes Doerfert via Openmp-commits
openmp-commits at lists.llvm.org
Thu Nov 4 15:55:19 PDT 2021
Author: Johannes Doerfert
Date: 2021-11-04T17:54:56-05:00
New Revision: ab9f3f5d25dc14a9dcffa48389cd1a321d598578
URL: https://github.com/llvm/llvm-project/commit/ab9f3f5d25dc14a9dcffa48389cd1a321d598578
DIFF: https://github.com/llvm/llvm-project/commit/ab9f3f5d25dc14a9dcffa48389cd1a321d598578.diff
LOG: [OpenMP] Introduce the keepAlive function into the old device RT
Reviewed By: ye-luo
Differential Revision: https://reviews.llvm.org/D113110
Added:
Modified:
openmp/libomptarget/deviceRTLs/common/src/support.cu
Removed:
################################################################################
diff --git a/openmp/libomptarget/deviceRTLs/common/src/support.cu b/openmp/libomptarget/deviceRTLs/common/src/support.cu
index 6dd591325c0b..b3bf550364bd 100644
--- a/openmp/libomptarget/deviceRTLs/common/src/support.cu
+++ b/openmp/libomptarget/deviceRTLs/common/src/support.cu
@@ -226,4 +226,14 @@ void __kmp_invoke_microtask(kmp_int32 global_tid, kmp_int32 bound_tid, void *fn,
}
}
+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_get_hardware_num_threads_in_block();
+ __kmpc_barrier_simple_spmd(nullptr, 0);
+ __kmpc_barrier_simple_generic(nullptr, 0);
+}
+} // namespace _OMP
+
#pragma omp end declare target
More information about the Openmp-commits
mailing list