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

Sergio Afonso via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 27 05:57:50 PDT 2025


================
@@ -317,6 +317,38 @@ class OpenMP_DeviceClauseSkip<
 
 def OpenMP_DeviceClause : OpenMP_DeviceClauseSkip<>;
 
+//===----------------------------------------------------------------------===//
+// V5.2: [XX.X] `collapse` clause
+//===----------------------------------------------------------------------===//
+
+class OpenMP_CollapseClauseSkip<
----------------
skatrak wrote:

I think I don't completely follow the representation changes. By the addition of this clause, the number of collapsed loops is no longer going to necessarily match the number of `omp.loop_nest` entry block arguments. The MLIR verifier is only checking that the number of IVs is greater than or equal to the collapse value and the number of tile arguments, independently. Which means these seem to all be valid:
```mlir
omp.loop_nest (%iv1, %iv2, %iv3): i32 = ... collapse(2)
omp.loop_nest (%iv1, %iv2, %iv3): i32 = ... tiles(2, 2)
omp.loop_nest (%iv1, %iv2, %iv3): i32 = ... collapse(2) tiles(2, 2)
omp.loop_nest (%iv1, %iv2, %iv3): i32 = ... collapse(3) tiles(2, 2)
omp.loop_nest (%iv1, %iv2, %iv3): i32 = ... collapse(2) tiles(2, 2, 2)
```
I have a couple of questions, to hopefully have a better idea of this proposal:
- Could some set of OpenMP constructs result in the above representations?
- How is the number of IVs affected by `tile` transformations? If we have a single non-collapsed loop with a `tile` clause, does that result in two IVs or just one?

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


More information about the llvm-commits mailing list