Skip to content

Commit ab9f3f5

Browse files
committed
[OpenMP] Introduce the keepAlive function into the old device RT
Reviewed By: ye-luo Differential Revision: https://reviews.llvm.org/D113110
1 parent 93bebdc commit ab9f3f5

File tree

1 file changed

+10
-0
lines changed
  • openmp/libomptarget/deviceRTLs/common/src

1 file changed

+10
-0
lines changed

openmp/libomptarget/deviceRTLs/common/src/support.cu

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,4 +226,14 @@ void __kmp_invoke_microtask(kmp_int32 global_tid, kmp_int32 bound_tid, void *fn,
226226
}
227227
}
228228

229+
namespace _OMP {
230+
/// Helper to keep code alive without introducing a performance penalty.
231+
__attribute__((used, weak, optnone)) void keepAlive() {
232+
__kmpc_get_hardware_thread_id_in_block();
233+
__kmpc_get_hardware_num_threads_in_block();
234+
__kmpc_barrier_simple_spmd(nullptr, 0);
235+
__kmpc_barrier_simple_generic(nullptr, 0);
236+
}
237+
} // namespace _OMP
238+
229239
#pragma omp end declare target

0 commit comments

Comments
 (0)