[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 05:16:44 PST 2017


ABataev added a comment.

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

> Hi Alexey,
>
> Thank you for your review.  The main difference in the specialized codegen (if vs. else part in CGStmtOpenMP.cpp).
>
> If-part: emitForStaticInit uses the Chunk parameter (else has it set to null).
>  If-part: does not use EmitIgnoredExpr()
>
> I can combine if- and else- part with appropriate guards over the above two statements if you like.


Ok, please try to do it.

> 
> 
>> General comment: do you really need to define default schedule kind in Sema? Could you do it during codegen phase?
> 
> Yes, we need to define default schedule in Sema because it has to set getCond() and getInc() in CheckOpenMPLoop(), which is in Sema.  For example, the Inc expression is calculated as follows based on the default schedule:
> 
>   // Loop increment (IV = IV + 1) or (IV = IV + ST) if (static,1) scheduling.
>   ExprResult Inc =
>     DefaultScheduleKind == OMPDSK_static_chunkone
>         ? SemaRef.BuildBinOp(CurScope, IncLoc, BO_Add, IV.get(), ST.get())
>         : SemaRef.BuildBinOp(CurScope, IncLoc, BO_Add, IV.get(),
>                              SemaRef.ActOnIntegerConstant(IncLoc, 1).get());

The maybe it is better to define a variable with loop increment and define this variable during codegen with 1 or stride (for GPU)? I don't like the idea of adding some kind of default scheduling, that is not defined in standard in Sema, preferer to define it during codegen and somewhere in NVPTX specific runtime support class.

>> You can't use Sema and OMPClause in Basic, it is not allowed
> 
> Ok, I can move getDefaultSchedule() from OpenMPKinds.cpp and make it a static function in SemaOpenMP.cpp.  Then, CheckOpenMPLoop() can directly call this static function.  Does this sound okay?
> 
> Thanks.




https://reviews.llvm.org/D29910





More information about the cfe-commits mailing list