[Openmp-commits] [PATCH] D105697: [libomptarget][nfc] Drop dead code in parallel_51

Jon Chesterfield via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Fri Jul 9 06:01:13 PDT 2021


JonChesterfield created this revision.
JonChesterfield added reviewers: jdoerfert, ggeorgakoudis, Meinersbur, tianshilei1992, grokos.
JonChesterfield requested review of this revision.
Herald added a project: OpenMP.
Herald added a subscriber: openmp-commits.

parallel_51 increments a shared variable array and then decrements it
This change deletes that. It leaves the comments in place. Change introduced
in D95976 <https://reviews.llvm.org/D95976> which notes the implementation is a stopgap. Even if this is not code
which is expected to work, I'd like to drop the accesses to parallel level as
that simplifies reasoning about the other uses of it.

Opt is not presently able to detect that the increment then decrement have no
net effect so this change decreases the size of the parallel_51 function.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D105697

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


Index: openmp/libomptarget/deviceRTLs/common/src/parallel.cu
===================================================================
--- openmp/libomptarget/deviceRTLs/common/src/parallel.cu
+++ openmp/libomptarget/deviceRTLs/common/src/parallel.cu
@@ -322,13 +322,6 @@
 
   // TODO: what if that's a parallel region with a single thread? this is
   // considered not active in the existing implementation.
-  bool IsActiveParallelRegion = threadsInTeam != 1;
-  int NumWarps =
-      threadsInTeam / WARPSIZE + ((threadsInTeam % WARPSIZE) ? 1 : 0);
-  // Increment parallel level for non-SPMD warps.
-  for (int I = 0; I < NumWarps; ++I)
-    parallelLevel[I] +=
-        (1 + (IsActiveParallelRegion ? OMP_ACTIVE_PARALLEL_LEVEL : 0));
 
   // Master signals work to activate workers.
   __kmpc_barrier_simple_spmd(nullptr, 0);
@@ -341,10 +334,6 @@
   // The master waits at this barrier until all workers are done.
   __kmpc_barrier_simple_spmd(nullptr, 0);
 
-  // Decrement parallel level for non-SPMD warps.
-  for (int I = 0; I < NumWarps; ++I)
-    parallelLevel[I] -=
-        (1 + (IsActiveParallelRegion ? OMP_ACTIVE_PARALLEL_LEVEL : 0));
   // TODO: Is synchronization needed since out of parallel execution?
 
   if (nargs)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105697.357491.patch
Type: text/x-patch
Size: 1232 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210709/308373c6/attachment.bin>


More information about the Openmp-commits mailing list