[flang] [llvm] [mlir] [flang][OpenMP] Enable tiling (PR #143715)

Jan Leyonberg via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 23 11:36:41 PDT 2025


================
@@ -482,6 +484,28 @@ bool ConstructDecompositionT<C, H>::applyClause(
 
   return false;
 }
+// FIXME(JAN): Do the correct thing, but for now we'll do the same as collapse
+template <typename C, typename H>
+bool ConstructDecompositionT<C, H>::applyClause(
+    const tomp::clause::SizesT<TypeTy, IdTy, ExprTy> &clause,
+    const ClauseTy *node) {
+  // Apply "sizes" to the innermost directive. If it's not one that
+  // allows it flag an error.
+  if (!leafs.empty()) {
+    auto &last = leafs.back();
+
+    if (llvm::omp::isAllowedClauseForDirective(last.id, node->id, version)) {
+      last.clauses.push_back(node);
+      return true;
+    } else {
+      //      llvm::errs() << "** OVERRIDING isAllowedClauseForDirective **\n";
----------------
jsjodin wrote:

I looked into adding a new clause and allow it wherever collapse is allowed, but it doesn't work well because it affects clang. Practically the effect of always allowing the sizes clause almost the same as only allowing it in the same places as collapse, since collapse is allowed in almost all loop directives, but it is still not good. I will look for a different solution if possible, maybe keeping things separate until lowering to the omp.loop_nest op is doable.

https://github.com/llvm/llvm-project/pull/143715


More information about the llvm-commits mailing list