[PATCH] D97393: [OpenMP IRBuilder, MLIR] Add support for OpenMP do schedule dynamic

Michael Kruse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 24 11:10:16 PST 2021


Meinersbur added a comment.

In D97393#2585126 <https://reviews.llvm.org/D97393#2585126>, @Leporacanthicus wrote:

> The main stumbling point, which may be my lack of understanding of what it's supposed to do: the CanonicalLoopInfo assumes that the the cond block has a CmpInst as the first instruction. In the dynamic, the corresponding block [in my understanding] starts with a call instruction to fetch the "next" set of data to process. This causes the assertOK to fail, hence it is commented out on line 1300 in the patch.

After applying worksharing-loop, the result is not a canonical loop nest anymore (one reason that the number of iterations is not known in advance). Hence, the `CanonicalLoopInfo` structure does not need to be preserved[*].

(*) I am working on making the chunk-loop accessible for loop transformations in OpenMP 6.0, which would require representing it as a CanonicalLoopInfo.



================
Comment at: llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp:1236-1237
+
+  if (!Chunk)
+    Chunk = One;
+
----------------
With a Chunk-size that is not one, you need at least two loops: One for all iterations of a chunk and another surrounding while-loop that ask the runtime for the next chunk.

This two-loop structure should also apply to the static schedule if the chunk is set and is greater than one. It don't see this in `createStaticWorkshareLoop`, it might be broken for these cases.


================
Comment at: llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp:1256
+  Value *TripCount = Builder.CreateAdd(TripCountMinusOne, One);
+  setCanonicalLoopTripCount(CLI, TripCount);
+
----------------
With dynamic schedule, the trip count is not known it advance.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97393



More information about the llvm-commits mailing list