[all-commits] [llvm/llvm-project] ece5e2: [flang][fir] Lower `do concurrent` loop nests to `...

Kareem Ergawy via All-commits all-commits at lists.llvm.org
Mon Apr 14 21:08:23 PDT 2025


  Branch: refs/heads/users/ergawy/pft_to_do_concurrent
  Home:   https://github.com/llvm/llvm-project
  Commit: ece5e2309f08b274e273e201249f7f9b6a9f1e22
      https://github.com/llvm/llvm-project/commit/ece5e2309f08b274e273e201249f7f9b6a9f1e22
  Author: ergawy <kareem.ergawy at amd.com>
  Date:   2025-04-14 (Mon, 14 Apr 2025)

  Changed paths:
    M flang/lib/Lower/Bridge.cpp
    M flang/lib/Optimizer/Builder/FIRBuilder.cpp
    M flang/test/Lower/do_concurrent.f90
    M flang/test/Lower/do_concurrent_local_default_init.f90
    M flang/test/Lower/loops.f90
    M flang/test/Lower/loops3.f90
    M flang/test/Lower/nsw.f90

  Log Message:
  -----------
  [flang][fir] Lower `do concurrent` loop nests to `fir.do_concurrent`

Adds support for lowering `do concurrent` nests from PFT to the new
`fir.do_concurrent` MLIR op as well as its special terminator
`fir.do_concurrent.loop` which models the actual loop nest.

To that end, this PR emits the allocations for the iteration variables
within the block of the `fir.do_concurrent` op and creates a region for
the `fir.do_concurrent.loop` op that accepts arguments equal in number
to the number of the input `do concurrent` iteration ranges.

For example, given the following input:
```fortran
   do concurrent(i=1:10, j=11:20)
   end do
```
the changes in this PR emit the following MLIR:
```mlir
    fir.do_concurrent {
      %22 = fir.alloca i32 {bindc_name = "i"}
      %23:2 = hlfir.declare %22 {uniq_name = "_QFsub1Ei"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
      %24 = fir.alloca i32 {bindc_name = "j"}
      %25:2 = hlfir.declare %24 {uniq_name = "_QFsub1Ej"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
      fir.do_concurrent.loop (%arg1, %arg2) = (%18, %20) to (%19, %21) step (%c1, %c1_0) {
        %26 = fir.convert %arg1 : (index) -> i32
        fir.store %26 to %23#0 : !fir.ref<i32>
        %27 = fir.convert %arg2 : (index) -> i32
        fir.store %27 to %25#0 : !fir.ref<i32>
      }
    }
```


  Commit: 8e081d21406e8b12b97edd79001bda5e472fde04
      https://github.com/llvm/llvm-project/commit/8e081d21406e8b12b97edd79001bda5e472fde04
  Author: ergawy <kareem.ergawy at amd.com>
  Date:   2025-04-14 (Mon, 14 Apr 2025)

  Changed paths:
    M flang/lib/Lower/Bridge.cpp

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


  Commit: 765c0611e88eb494009d71953eff99109077a0fe
      https://github.com/llvm/llvm-project/commit/765c0611e88eb494009d71953eff99109077a0fe
  Author: ergawy <kareem.ergawy at amd.com>
  Date:   2025-04-14 (Mon, 14 Apr 2025)

  Changed paths:
    M flang/lib/Lower/Bridge.cpp

  Log Message:
  -----------
  update comment


  Commit: b4e505956cff9111b827c2986b8d892889e4b1ff
      https://github.com/llvm/llvm-project/commit/b4e505956cff9111b827c2986b8d892889e4b1ff
  Author: ergawy <kareem.ergawy at amd.com>
  Date:   2025-04-14 (Mon, 14 Apr 2025)

  Changed paths:
    M flang/lib/Lower/Bridge.cpp

  Log Message:
  -----------
  rename isUnordered


  Commit: 0d841d39e7872a4dd9ba3a147191961457f37d14
      https://github.com/llvm/llvm-project/commit/0d841d39e7872a4dd9ba3a147191961457f37d14
  Author: ergawy <kareem.ergawy at amd.com>
  Date:   2025-04-14 (Mon, 14 Apr 2025)

  Changed paths:
    M flang/lib/Lower/Bridge.cpp

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


  Commit: 91ad25d35a24f3544e340cfda5be98a10923e5ec
      https://github.com/llvm/llvm-project/commit/91ad25d35a24f3544e340cfda5be98a10923e5ec
  Author: ergawy <kareem.ergawy at amd.com>
  Date:   2025-04-14 (Mon, 14 Apr 2025)

  Changed paths:
    M flang/test/Transforms/DoConcurrent/basic_host.f90
    M flang/test/Transforms/DoConcurrent/locally_destroyed_temp.f90
    M flang/test/Transforms/DoConcurrent/loop_nest_test.f90
    M flang/test/Transforms/DoConcurrent/multiple_iteration_ranges.f90
    M flang/test/Transforms/DoConcurrent/non_const_bounds.f90
    M flang/test/Transforms/DoConcurrent/not_perfectly_nested.f90

  Log Message:
  -----------
  disable dc to omp tests for now


  Commit: f1061b49fccd271e8e9a399836787605e91bb8df
      https://github.com/llvm/llvm-project/commit/f1061b49fccd271e8e9a399836787605e91bb8df
  Author: ergawy <kareem.ergawy at amd.com>
  Date:   2025-04-14 (Mon, 14 Apr 2025)

  Changed paths:
    M flang/lib/Lower/Bridge.cpp

  Log Message:
  -----------
  format


Compare: https://github.com/llvm/llvm-project/compare/2a30b1949800...f1061b49fccd

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