[PATCH] D86071: [MLIR][OpenMP] Add omp.do operation

Kiran Chandramohan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 25 07:32:15 PDT 2020


kiranchandramohan added a comment.

A few general comments about the design of the workshare loop operation.

1. Should the iteration interval (start, end) and step be part of the loop operation or should we have one more version of omp do?

Openmp for/do loops with static scheduling are implemented by the two following runtime call. How will these values be provided to the OpenMP IRBuilder if these are not carried in the loop operation?
void kmpc for static init 4 ( ident_t ∗ loc, kmp int32 gtid, kmp int32 schedtype, kmp int32 ∗ plastiter, kmp int32 ∗ plower, kmp int32 ∗ pupper, kmp int32 ∗ pstride, kmp int32 incr, kmp int32 chunk )

2. Should the loop operation be Anyregion or just one block? (Note: @clementval felt it was OK with both anyregion or single block region for OpenACC loop.)

Unlike parallel, the loop operation will always have a loop associated with it. All higher-level dialects have loop operations. But since we lower to OpenMP + LLVM dialect (and llvm has no loop operation) we need to have any region and not just one block. An alternative would be to have two omp.do operations one which sits with the do loop (of one block) and one which sits without (any region).

3. Another version of omp.do suggested was a single block region with iteration interval and step size. This is similar to loops in other dialects like affine. This has the advantage of transforming to other dialects like affine or recreating the affine transformations as omp.do, as well as keeping it free of optimizations of other dialects. But this version alone will not be able to capture the various loops permitted by OpenMP and Fortran/C++ because there can be branches in Fortran code. Another issue is that we have to retain the OpenMP information somehow (to generate runtime calls) so fully transforming to other dialect loops is not possible.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D86071/new/

https://reviews.llvm.org/D86071



More information about the llvm-commits mailing list