[all-commits] [llvm/llvm-project] 1094ff: [flang][fir] Add MLIR op for `do concurrent` (#130...

Kareem Ergawy via All-commits all-commits at lists.llvm.org
Tue Mar 18 02:54:05 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1094ffcafbc909cf4caecaf331e97ef16250e42d
      https://github.com/llvm/llvm-project/commit/1094ffcafbc909cf4caecaf331e97ef16250e42d
  Author: Kareem Ergawy <kareem.ergawy at amd.com>
  Date:   2025-03-18 (Tue, 18 Mar 2025)

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

  Log Message:
  -----------
  [flang][fir] Add MLIR op for `do concurrent` (#130893)

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
  fir.do_concurrent {
    %i = fir.alloca i32
    %j = fir.alloca i32
    fir.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 `fir.do_concurrent` wrapper op encapsulates both the actual loop and
the allocations required for the iteration variables. The
`fir.do_concurrent.loop` op is a multi-dimensional op that contains the
loop control and body. See the ops' docs for more info.



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