[all-commits] [llvm/llvm-project] ff071d: [flang][DoConcurrent] Map reduction variables as t...

Kareem Ergawy via All-commits all-commits at lists.llvm.org
Tue Apr 7 22:54:22 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ff071d61654e1b4e8e2cba73e58e418d080812f4
      https://github.com/llvm/llvm-project/commit/ff071d61654e1b4e8e2cba73e58e418d080812f4
  Author: Kareem Ergawy <kareem.ergawy at amd.com>
  Date:   2026-04-08 (Wed, 08 Apr 2026)

  Changed paths:
    M flang/lib/Optimizer/OpenMP/DoConcurrentConversion.cpp
    M flang/test/Transforms/DoConcurrent/reduce_device.mlir
    A flang/test/Transforms/DoConcurrent/reduce_device_min.f90
    A offload/test/offloading/fortran/do-concurrent-to-omp-min-reduce.f90

  Log Message:
  -----------
  [flang][DoConcurrent] Map reduction variables as tofrom ByRef for device offloading (#189378)

Scalar reduction variables in `do concurrent reduce(...)` were being
mapped with `implicit ByCopy` when offloaded to device, because
`genMapInfoOpForLiveIn` treated all trivial types uniformly. This caused
the reduction result to be silently dropped — the device-side reduction
would compute the correct value but never write it back to the host.

Fix by detecting reduction variables and forcing `implicit tofrom ByRef`
mapping, matching the behavior of explicit
`!$omp target teams distribute parallel do reduction(...)`.

Co-authored-by: ergawy <kareem.ergawy at amd.com>
Co-authored-by: Claude <noreply at anthropic.com>
Made-with: Cursor

Fixes: https://github.com/ROCm/llvm-project/issues/1844

Co-authored-by: Claude <noreply at anthropic.com>



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