[Openmp-commits] [PATCH] D111905: [OpenMP][deviceRTLs] Fix wrong return value of `__kmpc_is_spmd_exec_mode`

Shilei Tian via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Sat Oct 16 09:50:08 PDT 2021


tianshilei1992 updated this revision to Diff 380192.
tianshilei1992 added a comment.

update comment


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111905/new/

https://reviews.llvm.org/D111905

Files:
  openmp/libomptarget/deviceRTLs/common/src/omptarget.cu


Index: openmp/libomptarget/deviceRTLs/common/src/omptarget.cu
===================================================================
--- openmp/libomptarget/deviceRTLs/common/src/omptarget.cu
+++ openmp/libomptarget/deviceRTLs/common/src/omptarget.cu
@@ -160,8 +160,12 @@
 }
 
 // Return true if the current target region is executed in SPMD mode.
+// NOTE: This function has to return 1 for SPMD mode, and 0 for generic mode.
+// That's because `__kmpc_parallel_51` checks if it's already in parallel region
+// by comparision between the parallel level and the return value of this
+// function.
 EXTERN int8_t __kmpc_is_spmd_exec_mode() {
-  return execution_param & OMP_TGT_EXEC_MODE_SPMD;
+  return (execution_param & OMP_TGT_EXEC_MODE_SPMD) == OMP_TGT_EXEC_MODE_SPMD;
 }
 
 EXTERN int8_t __kmpc_is_generic_main_thread(kmp_int32 Tid) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111905.380192.patch
Type: text/x-patch
Size: 838 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20211016/693024cf/attachment-0001.bin>


More information about the Openmp-commits mailing list