[Mlir-commits] [mlir] [OpenMP Dialect] Add omp.canonical_loop operation. (PR #65380)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Sep 5 14:17:31 PDT 2023


kiranchandramohan wrote:

> In [D155765#4638411](https://reviews.llvm.org/D155765#4638411), [@shraiysh](https://reviews.llvm.org/p/shraiysh/) wrote:
> There are two possible approaches for the unrolled operation here -
> 
> %unrolled1 = omp.unroll loops(%tiled) at(1)
> %unrolled2 = omp.unroll loops(%tiled#1)
> I realized that we cannot really do the first approach, because unroll could be present without nested loops. The nesting of openmp constructs could help with this. It might require complex indexing though. [@kiranchandramohan](https://reviews.llvm.org/p/kiranchandramohan/) do we have the details on loop-fission or the loop-modifiers for apply (like intratile)? I checked the technical report document [here](https://www.openmp.org/wp-content/uploads/openmp-TR11.pdf) but it doesn't mention too much detail about these modifiers.

I don't have more information than what is there in the TR. FWIU, it is @Meinersbur who is driving this work, and will be best placed to provide clarification on what will be in the OpenMP 6 standard and what will be the future changes.

> There are two possible approaches for the unrolled operation here -
> 
> %unrolled1 = omp.unroll loops(%tiled) at(1)
> %unrolled2 = omp.unroll loops(%tiled#1)
> The good thing with the first approach, with at(1) - is that because we have both the loops as input, we transform the inner > loop and we have the new single loop as output which can directly be used in other constructs. Note that this is similar to > Jan's suggestion about nesting and maintaining indices.
> The problem with the second approach is that the input is only the inner loop and the output (%unrolled2) should represent a structured block (not a loop) which should be captured within the loop %tiled#0 somehow. (maybe an omp.merge_canonical_loop_with_body operation?).

May be the structured block that is not a loop can be represented by a loop with a trip count of 1?
```
omp.canonical_loop $iv in [0, %cst_1) { ... }
```

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


More information about the Mlir-commits mailing list