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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Sep 6 07:47:58 PDT 2023


kiranchandramohan wrote:

> So, are we planning to modify a loop in-place when `omp.unroll` is called on that loop, or is this a new canonical loop object that would be used to create a loop nest? That is, while running the operation `omp.unroll` do we also do the following change:
> 
> ```
> [[in memory representation of canonical loop object]]
> %tiled#0 = omp.canonical_loop [0, %tc) step = 4
> |-[child] %tiled#1 = omp.canonical_loop [%i, %i+4) step = 1
> ```
> 
> changes to
> 
> ```
> [[in memory representation of canonical loop object]]
> %tiled#0 = omp.canonical_loop [0, %tc) step=4
> |-[child] %unrolled = omp.canonical_loop [0, 1) step=1
> ```
> 
> If this change is happening in-place on calling the operation `omp.unroll` then we do not need a result on LHS of `omp.unroll`. If it is not happening in-place, then we need another operation to now generate the second nested loop above. Is this correct or am I missing something?

I have not followed your syntax fully. But there is both a partial unroll and a full unroll. In the case of a partial unroll what is returned will be a `canonical_loop`. To keep it consistent wouldn't we want to return a `canonical_loop` for the full unroll too?
I was suggesting, in general, for operations (like unroll, tile, interchange) to take in a `canonical_loop` and also to return as result a `canonical_loop`.

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


More information about the Mlir-commits mailing list