From: Johannes Doerfert Date: Wed, 3 Nov 2021 15:26:34 +0000 (-0500) Subject: [OpenMP] Introduce the keepAlive function into the old device RT X-Git-Tag: upstream/15.0.7~26692 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ab9f3f5d25dc14a9dcffa48389cd1a321d598578;p=platform%2Fupstream%2Fllvm.git [OpenMP] Introduce the keepAlive function into the old device RT Reviewed By: ye-luo Differential Revision: https://reviews.llvm.org/D113110 --- diff --git a/openmp/libomptarget/deviceRTLs/common/src/support.cu b/openmp/libomptarget/deviceRTLs/common/src/support.cu index 6dd5913..b3bf550 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