[llvm-branch-commits] [clang] [openmp] [Clang][OpenMP][Tile] Allow non-constant tile sizes. (PR #91345)

Michael Kruse via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed May 8 09:29:05 PDT 2024


================
@@ -15197,6 +15202,36 @@ StmtResult SemaOpenMP::ActOnOpenMPTileDirective(ArrayRef<OMPClause *> Clauses,
   // Once the original iteration values are set, append the innermost body.
   Stmt *Inner = Body;
 
+  auto MakeDimTileSize = [&SemaRef = this->SemaRef, &CopyTransformer, &Context,
+                          SizesClause, CurScope](int I) -> Expr * {
+    Expr *DimTileSizeExpr = SizesClause->getSizesRefs()[I];
+    if (isa<ConstantExpr>(DimTileSizeExpr))
+      return AssertSuccess(CopyTransformer.TransformExpr(DimTileSizeExpr));
+
+    // When the tile size is not a constant but a variable, it is possible to
+    // pass non-positive numbers. To preserve the invariant that every loop
----------------
Meinersbur wrote:

```
int a = 0;
#pragma omp tile sizes(a)
for (int i = 0; i < 42; ++i)
  body(i);
```
While I don't think it can be expected this gives any useful tiling, it should still execute `body` 42 times.

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


More information about the llvm-branch-commits mailing list