[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:58:46 PDT 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rG2c941fa2f9b9: [OpenMP][deviceRTLs] Fix wrong return value of `__kmpc_is_spmd_exec_mode` (authored by tianshilei1992).

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.380194.patch
Type: text/x-patch
Size: 838 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20211016/0c384e0f/attachment.bin>


More information about the Openmp-commits mailing list