[PATCH] D53448: [OpenMP][NVPTX] Use single loops when generating code for distribute parallel for

Alexey Bataev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 25 06:56:56 PDT 2018


ABataev added inline comments.


================
Comment at: lib/CodeGen/CGOpenMPRuntime.h:904
+  ///
+  virtual bool isStaticChunked(OpenMPDistScheduleClauseKind ScheduleKind,
+                               bool Chunked) const;
----------------
gtbercea wrote:
> ABataev wrote:
> > I'd rename this into `isDistStaticChunked`
> I've used the same naming convention as the isStaticNonchunked function for consistency.
What about this?


================
Comment at: lib/CodeGen/CGStmtOpenMP.cpp:2360
         OMPCancelStack.emitExit(*this, S.getDirectiveKind(), CodeGen);
+      } else if (RT.isStaticChunked(ScheduleKind.Schedule,
+                                    /* Chunked */ Chunk != nullptr) &&
----------------
ABataev wrote:
> This whole code is very similar to the unchunked case. Could you merge it?
What about this?


================
Comment at: lib/CodeGen/CGStmtOpenMP.cpp:3421
         RT.emitForStaticFinish(*this, S.getBeginLoc(), S.getDirectiveKind());
+      } else if (RT.isStaticChunked(ScheduleKind,
+                                    /* Chunked */ Chunk != nullptr) &&
----------------
ABataev wrote:
> Again, very similar to the unchunked code. Merge it.
?


================
Comment at: lib/Sema/SemaOpenMP.cpp:5207
+    CombDistCond =
+        SemaRef.BuildBinOp(CurScope, CondLoc, BO_LE, IV.get(), LastIteration.get());
+  }
----------------
ABataev wrote:
> Seems to me, you need to use `NumIterations` instead of `LastIteration`
Add the tests for the collapsed loops.


Repository:
  rC Clang

https://reviews.llvm.org/D53448





More information about the cfe-commits mailing list