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

Arpith Jacob via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 14 13:22:58 PST 2017


arpith-jacob updated this revision to Diff 88423.
arpith-jacob added a comment.

Hi Alexey,

Thank you for reviewing this patch.

> I don't like the idea of adding some kind of default scheduling, that is not defined in standard in Sema

Actually, "default scheduling" is defined in the OpenMP spec.  It is called "def-sched-var" and controls the scheduling of loops.  It's value is implementation (compiler) defined.  So why not allow the target device to choose this value in the compiler?

  http://www.openmp.org/wp-content/uploads/openmp-4.5.pdf
  
  Section 2.3.1: ICV Descriptions, pg 46:
  def-sched-var - controls the implementation defined default scheduling of loop regions. There is one copy of this ICV per device.
  
  Section 2.3.2: ICV Initialization, pg 47:
  Table 2.1:
  def-sched-var   No environment variable      Initial value is implementation defined
  
  Section 2.7.1.1: Determining the Schedule of a Worksharing Loop
  When execution encounters a loop directive, the schedule clause (if any) on the directive, and the run-sched-var and def-sched-var ICVs are used to determine how loop iterations are assigned to threads. See Section 2.3 on page 36 for details of how the values of the ICVs are determined. If the loop directive does not have a schedule clause then the current value of the def-sched-var ICV determines the schedule.

I've reworked the patch to handle the default scheduling in Sema and removed the function from OpenMPKind.cpp.  Please let me know if this looks good.

I can rewrite the patch as you suggested, involving NVPTX specific RT, but I think the code will look quite ugly.


https://reviews.llvm.org/D29910

Files:
  include/clang/AST/StmtOpenMP.h
  include/clang/Basic/OpenMPKinds.h
  lib/AST/StmtOpenMP.cpp
  lib/CodeGen/CGStmtOpenMP.cpp
  lib/Sema/SemaOpenMP.cpp
  test/OpenMP/nvptx_coalesced_scheduling_codegen.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29910.88423.patch
Type: text/x-patch
Size: 42256 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170214/48cdda8c/attachment-0001.bin>


More information about the cfe-commits mailing list