[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
Wed Feb 15 00:36:02 PST 2017


ABataev added a comment.

In https://reviews.llvm.org/D29910#676777, @arpith-jacob wrote:

> 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.


Arpith, yes, there is such variable. But also standard says, that it is device specific. My opinion, all device-specific things must be defined by runtime library or at least runtime-support class, not by Sema. Sema must be as much platform independent as possible


https://reviews.llvm.org/D29910





More information about the cfe-commits mailing list