[Mlir-commits] [mlir] [OpenMP][MLIR] Add omp.canonical_loop operation, !omp.cli type, omp.new_cli operation (PR #71712)

Kiran Chandramohan llvmlistbot at llvm.org
Fri Nov 10 03:02:06 PST 2023


kiranchandramohan wrote:

@ftynse It will be great if you can have a look at this patch. I guess it is a bit long, but this follows from some of the earlier discussion in https://discourse.llvm.org/t/rfc-mlir-openmp-loop-transformation-tile-and-unroll-directive-operation-support-for-omp-dialect/65301/14 and subsequent proposals by @Meinersbur and follow up work by @jsjodin. Basically, we are looking for feedback from people experienced with loop related constructs in MLIR.

Essentially this introduces canonical loops, adds a canonical loop type, a new operation to generate canonical loop ids. The canonical loop ids are operands of canonical loops and this is what distinguishes one canonical loop from another. The loop transformation operation (omp.tile below) operates on these canonical loop ids. This way was preferred over `omp.canonical_loop` returning a value and that value being used as identifier of loops in loop transformation operations.

```
    %outer = omp.new_cli : !omp.cli
    %inner = omp.new_cli : !omp.cli
    omp.canonical_loop %iv1 : i32 in [0, %tripcount), %outer : !omp.cli{
      omp.canonical_loop %iv2 : i32 in [0, %tc), %inner : !omp.cli {
        %a = load %arrA[%iv1, %iv2] : memref<?x?xf32>
        store %a, %arrB[%iv1, %iv2] : memref<?x?xf32>
      }
    }
    omp.tile(%outer, %inner : !omp.cli, !omp.cli)
```    

Thanks in advance.



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


More information about the Mlir-commits mailing list