[PATCH] Explicitly annotate loops we want to run thread-parallel

Johannes Doerfert doerfert at cs.uni-saarland.de
Thu Nov 6 11:21:05 PST 2014


I'm fine with the current version but you can also integrate my comments if you like.

================
Comment at: include/polly/CodeGen/IslAst.h:130
@@ +129,3 @@
+  /// @brief Will the loop be run as thread parallel?
+  static bool runAsThreadParallel(__isl_keep isl_ast_node *Node);
+
----------------
Naming convention here seems to be:
  isXXX
if a bool is return, thus maybe:
  isExecutedInParallel(...)

================
Comment at: lib/CodeGen/IslAst.cpp:46
@@ +45,3 @@
+static cl::opt<bool>
+    UseThreads("polly-parallel",
+               cl::desc("Generate thread parallel code (isl codegen only)"),
----------------
I usually prefere the variable name to be the cmd option without the "-" in camel case, but I don't feel that strong about it.

================
Comment at: lib/CodeGen/IslAst.cpp:457
@@ +456,3 @@
+bool IslAstInfo::runAsThreadParallel(__isl_keep isl_ast_node *Node) {
+  return isOutermostParallel(Node) && !isReductionParallel(Node) && UseThreads;
+}
----------------
UseThreads should be first as it is the cheapest and we will have no overhead in case no parallel code is generated.

http://reviews.llvm.org/D6142






More information about the llvm-commits mailing list