[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 05:00:33 PST 2017


arpith-jacob added a comment.

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.

> 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());



> 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