[PATCH] [Polly][Refactor] Generalize parallel code generation

Tobias Grosser tobias at grosser.es
Thu Oct 2 10:41:44 PDT 2014


I found one last issue where the original code was not very clear and your new changes unfortunately make this even more unclear (or even incorrect).

Otherwise, LGTM.

================
Comment at: include/polly/CodeGen/LoopGenerators.h:102
@@ -60,2 +101,3 @@
 
-  OMPGenerator(PollyIRBuilder &Builder, Pass *P) : Builder(Builder), P(P) {}
+  /// @brief Create a parallel loop generator for the current function
+  ParallelLoopGenerator(PollyIRBuilder &Builder, Pass *P, LoopInfo &LI,
----------------
Point at the end is missing.

================
Comment at: include/polly/CodeGen/LoopGenerators.h:137
@@ +136,3 @@
+
+  /// @brief The dominace tree of the current function we need to update.
+  DominatorTree &DT;
----------------
dominance, you miss an 'n'

================
Comment at: include/polly/CodeGen/LoopGenerators.h:140
@@ -92,7 +139,3 @@
 
-  void createCallParallelLoopStart(Value *SubFunction, Value *SubfunctionParam,
-                                   Value *NumberOfThreads, Value *LowerBound,
-                                   Value *UpperBound, Value *Stride);
-  Value *createCallLoopNext(Value *LowerBoundPtr, Value *UpperBoundPtr);
-  void createCallParallelEnd();
-  void createCallLoopEndNowait();
+  /// @brief The type we use for induction variable related instructions.
+  Type *IVType;
----------------
This type is not used to create the IVs, but rather to declare/call the OpenMP functions we use. For an OpenMP function declared as "bool GOMP_loop_runtime_next(long, long)", we want to make sure that the integer type we use to declare it at LLVM-IR is identical in size to the type 'long' is lowered to on a certain platform. On linux and OS X the size of this type is equivalent to the pointer type.

See this discussion:

http://lists.cs.uiuc.edu/pipermail/llvmdev/2010-December/037118.html

Your rename from from LongTy to IVType makes this less obvious.

Also asking the user (lib/CodeGeneration.cpp) to pass in the LongTy currently works, as the CLooG code generation uses the same type for IVs, we do not do this in the isl code generation. In the isl code generation we currently hardcode 64 bit IVs and later we will hopefully derive the optimal time automatically (hence it may vary).

http://reviews.llvm.org/D4990






More information about the llvm-commits mailing list