[Openmp-commits] [PATCH] D113110: [OpenMP] Introduce the keepAlive function into the old device RT

Johannes Doerfert via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Wed Nov 3 08:27:15 PDT 2021

jdoerfert created this revision.
jdoerfert added a reviewer: ye-luo.
Herald added subscribers: guansong, bollu, yaxunl.
jdoerfert requested review of this revision.
Herald added a subscriber: sstefan1.
Herald added a project: OpenMP.

  rG LLVM Github Monorepo



Index: openmp/libomptarget/deviceRTLs/common/src/support.cu
--- openmp/libomptarget/deviceRTLs/common/src/support.cu
+++ openmp/libomptarget/deviceRTLs/common/src/support.cu
@@ -226,4 +226,14 @@
+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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113110.384454.patch
Type: text/x-patch
Size: 661 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20211103/a543e3ff/attachment.bin>

More information about the Openmp-commits mailing list