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

Kareem Ergawy via All-commits all-commits at lists.llvm.org
Wed Mar 12 22:01:20 PDT 2025


  Branch: refs/heads/users/ergawy/hlfir_do_concurrent_op_1_mlir_op
  Home:   https://github.com/llvm/llvm-project
  Commit: 90e3c13ca603f51952cacca0a9f62cc229fa5900
      https://github.com/llvm/llvm-project/commit/90e3c13ca603f51952cacca0a9f62cc229fa5900
  Author: ergawy <kareem.ergawy at amd.com>
  Date:   2025-03-12 (Wed, 12 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: 26f4359dd83ca3a3fbd3552067ec74a54f9cc749
      https://github.com/llvm/llvm-project/commit/26f4359dd83ca3a3fbd3552067ec74a54f9cc749
  Author: ergawy <kareem.ergawy at amd.com>
  Date:   2025-03-12 (Wed, 12 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: 207255890b9b42e4b789f4630e321752326ce37f
      https://github.com/llvm/llvm-project/commit/207255890b9b42e4b789f4630e321752326ce37f
  Author: ergawy <kareem.ergawy at amd.com>
  Date:   2025-03-13 (Thu, 13 Mar 2025)

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

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


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

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