[PATCH] D29910: [OpenMP] Specialize default schedule on a worksharing loop on the NVPTX device.

Alexey Bataev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 14 01:06:51 PST 2017


ABataev added a comment.

General comment: do you really need to define default schedule kind in Sema? Could you do it during codegen phase?



================
Comment at: include/clang/Basic/OpenMPKinds.h:23-25
+class Sema;
+class OMPClause;
+
----------------
No way, these classes should not be used here


================
Comment at: include/clang/Basic/OpenMPKinds.h:250-256
+/// Get the default schedule type for any loop-based OpenMP directive,
+/// specialized for a particular target.  This is used to guide codegen
+/// if a) no 'schedule' clause is specified, or b) a 'schedule' type of
+/// 'auto' is specified by the user.
+OpenMPDefaultScheduleKind
+getDefaultSchedule(Sema &SemaRef, OpenMPDirectiveKind Kind,
+                   llvm::ArrayRef<OMPClause *> Clauses);
----------------
You can't use Sema and OMPClause in Basic, it is not allowed


================
Comment at: lib/CodeGen/CGStmtOpenMP.cpp:2190
       const bool IVSigned = IVExpr->getType()->hasSignedIntegerRepresentation();
-      // OpenMP 4.5, 2.7.1 Loop Construct, Description.
-      // If the static schedule kind is specified or if the ordered clause is
-      // specified, and if no monotonic modifier is specified, the effect will
-      // be as if the monotonic modifier was specified.
-      if (RT.isStaticNonchunked(ScheduleKind.Schedule,
-                                /* Chunked */ Chunk != nullptr) &&
-          !Ordered) {
+      if (S.getDefaultSchedule() == OMPDSK_static_chunkone) {
+        // For NVPTX and other GPU targets high performance is often achieved
----------------
What's the difference between this code and next else branch?


https://reviews.llvm.org/D29910





More information about the cfe-commits mailing list