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

Kareem Ergawy via All-commits all-commits at lists.llvm.org
Thu Apr 3 20:56:54 PDT 2025


  Branch: refs/heads/users/ergawy/pft_to_do_concurrent
  Home:   https://github.com/llvm/llvm-project
  Commit: b9ac977f6eb44a5e1b5f2c2177de7310150f4d45
      https://github.com/llvm/llvm-project/commit/b9ac977f6eb44a5e1b5f2c2177de7310150f4d45
  Author: ergawy <kareem.ergawy at amd.com>
  Date:   2025-04-03 (Thu, 03 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: 3d5b28340169c4d435796558d7a74c759f5c7962
      https://github.com/llvm/llvm-project/commit/3d5b28340169c4d435796558d7a74c759f5c7962
  Author: ergawy <kareem.ergawy at amd.com>
  Date:   2025-04-03 (Thu, 03 Apr 2025)

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

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


  Commit: 2a19465c5deee9b33098ab8f68060bc0f2d95006
      https://github.com/llvm/llvm-project/commit/2a19465c5deee9b33098ab8f68060bc0f2d95006
  Author: ergawy <kareem.ergawy at amd.com>
  Date:   2025-04-03 (Thu, 03 Apr 2025)

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

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


  Commit: 2be50ea6e097f7e40e537110fb166605b9b71a37
      https://github.com/llvm/llvm-project/commit/2be50ea6e097f7e40e537110fb166605b9b71a37
  Author: ergawy <kareem.ergawy at amd.com>
  Date:   2025-04-03 (Thu, 03 Apr 2025)

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

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


  Commit: 3bb167ae19e1ea9c33910d4319bf7556bf582b80
      https://github.com/llvm/llvm-project/commit/3bb167ae19e1ea9c33910d4319bf7556bf582b80
  Author: ergawy <kareem.ergawy at amd.com>
  Date:   2025-04-03 (Thu, 03 Apr 2025)

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

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


  Commit: f86a5c62129ceff7f90674dd9b0d2401bc66c33b
      https://github.com/llvm/llvm-project/commit/f86a5c62129ceff7f90674dd9b0d2401bc66c33b
  Author: ergawy <kareem.ergawy at amd.com>
  Date:   2025-04-03 (Thu, 03 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


Compare: https://github.com/llvm/llvm-project/compare/212229070f96...f86a5c62129c

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