[all-commits] [llvm/llvm-project] 99c760: [flang][hlfir] Add MLIR op for `do concurrent`

Kareem Ergawy via All-commits all-commits at lists.llvm.org
Sun Mar 16 23:16:37 PDT 2025


  Branch: refs/heads/users/ergawy/hlfir_do_concurrent_op_1_mlir_op
  Home:   https://github.com/llvm/llvm-project
  Commit: 99c76085fe77cbb286237e980ab7a642ca31a7c9
      https://github.com/llvm/llvm-project/commit/99c76085fe77cbb286237e980ab7a642ca31a7c9
  Author: ergawy <kareem.ergawy at amd.com>
  Date:   2025-03-17 (Mon, 17 Mar 2025)

  Changed paths:
    M flang/include/flang/Optimizer/HLFIR/HLFIROps.td
    M flang/lib/Optimizer/HLFIR/IR/HLFIROps.cpp
    A flang/test/HLFIR/do_concurrent.fir
    M flang/test/HLFIR/invalid.fir

  Log Message:
  -----------
  [flang][hlfir] Add MLIR op for `do concurrent`

Adds new MLIR ops to model `do concurrent`. In order to make `do
concurrent` representation self-contained, a loop is modeled using 2
ops, one wrapper and one that contains the actual body of the loop. For
example, a 2D `do concurrent` loop is modeled as follows:

```mlir
  hlfir.do_concurrent {
    %i = fir.alloca i32
    %j = fir.alloca i32
    hlfir.do_concurrent.loop
      (%i_iv, %j_iv) = (%i_lb, %j_lb) to (%i_ub, %j_ub) step (%i_st, %j_st) {
      %0 = fir.convert %i_iv : (index) -> i32
      fir.store %0 to %i : !fir.ref<i32>

      %1 = fir.convert %j_iv : (index) -> i32
      fir.store %1 to %j : !fir.ref<i32>
    }
  }
```

The `hlfir.do_concurrent` wrapper op encapsulates both the actual loop
and the allocations required for the iteration variables. The
`hlfir.do_concurrent.loop` op is a multi-dimensional op that contains
the loop control and body. See the ops' docs for more info.


  Commit: e3db9f02fe47e7c96313636f2ea25e0d2bfdaec9
      https://github.com/llvm/llvm-project/commit/e3db9f02fe47e7c96313636f2ea25e0d2bfdaec9
  Author: ergawy <kareem.ergawy at amd.com>
  Date:   2025-03-17 (Mon, 17 Mar 2025)

  Changed paths:
    M flang/include/flang/Optimizer/HLFIR/HLFIROps.td
    M flang/lib/Optimizer/HLFIR/IR/HLFIROps.cpp

  Log Message:
  -----------
  handle review comments


  Commit: 1c7a3e953b3b752b03179c5e9f095f52b9e8b3b5
      https://github.com/llvm/llvm-project/commit/1c7a3e953b3b752b03179c5e9f095f52b9e8b3b5
  Author: ergawy <kareem.ergawy at amd.com>
  Date:   2025-03-17 (Mon, 17 Mar 2025)

  Changed paths:
    M flang/include/flang/Optimizer/HLFIR/HLFIROps.td

  Log Message:
  -----------
  handle review comments


  Commit: 1dc58b5bf5437f5856b1bb6512cfd878d90b2f01
      https://github.com/llvm/llvm-project/commit/1dc58b5bf5437f5856b1bb6512cfd878d90b2f01
  Author: ergawy <kareem.ergawy at amd.com>
  Date:   2025-03-17 (Mon, 17 Mar 2025)

  Changed paths:
    M flang/include/flang/Optimizer/Dialect/FIROps.td
    M flang/include/flang/Optimizer/HLFIR/HLFIROps.td
    M flang/lib/Optimizer/Dialect/FIROps.cpp
    M flang/lib/Optimizer/HLFIR/IR/HLFIROps.cpp
    A flang/test/Fir/do_concurrent.fir
    M flang/test/Fir/invalid.fir
    R flang/test/HLFIR/do_concurrent.fir
    M flang/test/HLFIR/invalid.fir

  Log Message:
  -----------
  Move ops to fir


Compare: https://github.com/llvm/llvm-project/compare/207255890b9b...1dc58b5bf543

To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list