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

Michael Kruse llvmlistbot at llvm.org
Wed Sep 6 15:41:23 PDT 2023


Meinersbur wrote:

> ```
> %cli = omp.canonical_loop [0, %tc) {...}
> %tiled = omp.tiled(%cli) { tile_size = 4 } -> omp.canonical_loop, omp.canonical_loop
> %unrolled = omp.unroll(%tiled#0) -> omp.canonical_loop
> %merged_loop = omp.replace(parent=%tiled#0, old_value=%tiled#1, new_value=%unrolled)
> omp.wsloop(%merged_loop)
> ```

> I believe the former is the original proposal from @Meinersbur. But Michael can confirm it.

I had previously proposed a `omp.execute`. `omp.canonical_loop` would be asynchronous, i.e. like a lambda. To execute the loop, one would need to pass the %cli (or the %cli that is returned after a transformation) to `omp.execute` and only then it would execute. I think because of the asynchronicity it would make everything more complex than necessary. 

If I understand correctly, the `omp.replace` operation seems related, but only delays the application of transformation until it replaces another loop, but not the `omp.canonical_loop` itself. I don't think the additional complexity is useful, in what cases would we want to apply a transformation, but not replace the original loop with it?


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


More information about the Mlir-commits mailing list