[all-commits] [llvm/llvm-project] 008ca2: [flang][OpenMP] Move reductions `loop` to `teams` ...
Kareem Ergawy via All-commits
all-commits at lists.llvm.org
Tue Mar 25 04:30:25 PDT 2025
Branch: refs/heads/users/ergawy/loop_to_distribute_reduction
Home: https://github.com/llvm/llvm-project
Commit: 008ca28370d1d4b1e055ca03b00ac54491dce3a4
https://github.com/llvm/llvm-project/commit/008ca28370d1d4b1e055ca03b00ac54491dce3a4
Author: ergawy <kareem.ergawy at amd.com>
Date: 2025-03-25 (Tue, 25 Mar 2025)
Changed paths:
M flang/lib/Optimizer/OpenMP/GenericLoopConversion.cpp
M flang/test/Lower/OpenMP/loop-directive.f90
Log Message:
-----------
[flang][OpenMP] Move reductions `loop` to `teams` when `loop` is mapped to `distribute`
Follow-up to #132003, in particular, see
https://github.com/llvm/llvm-project/pull/132003#issuecomment-2739701936.
This PR extends reduction support for `loop` directives. Consider the
following scenario:
```fortran
subroutine bar
implicit none
integer :: x, i
!$omp teams loop reduction(+: x)
DO i = 1, 5
call foo()
END DO
end subroutine
```
Note the following:
* According to the spec, the `reduction` clause will be attached to
`loop` during earlier stages in the compiler.
* Additionally, `loop` cannot be mapped to `distribute parallel for`
due to the call to a foreign function inside the loop's body.
* Therefore, `loop` must be mapped to `distribute`.
* However, `distribute` does not have `reduction` clauses.
* As a result, we have to move the `reduction`s from the `loop` to its
parent `teams` directive, which is what is done by this PR.
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