[all-commits] [llvm/llvm-project] f4fe71: [Flang][OpenMP] Implement workdistribute construct...
Chaitanya via All-commits
all-commits at lists.llvm.org
Fri Oct 17 19:26:54 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: f4fe7145df9f952808884f653b5bb4bb992b7b06
https://github.com/llvm/llvm-project/commit/f4fe7145df9f952808884f653b5bb4bb992b7b06
Author: Chaitanya <Krishna.Sankisa at amd.com>
Date: 2025-10-18 (Sat, 18 Oct 2025)
Changed paths:
M flang/include/flang/Optimizer/OpenMP/Passes.td
M flang/lib/Optimizer/OpenMP/CMakeLists.txt
A flang/lib/Optimizer/OpenMP/LowerWorkdistribute.cpp
M flang/lib/Optimizer/Passes/Pipelines.cpp
M flang/test/Fir/basic-program.fir
A flang/test/Lower/OpenMP/workdistribute-multiple.f90
A flang/test/Lower/OpenMP/workdistribute-saxpy-1d.f90
A flang/test/Lower/OpenMP/workdistribute-saxpy-2d.f90
A flang/test/Lower/OpenMP/workdistribute-saxpy-3d.f90
A flang/test/Lower/OpenMP/workdistribute-saxpy-and-scalar-assign.f90
A flang/test/Lower/OpenMP/workdistribute-saxpy-two-2d.f90
A flang/test/Lower/OpenMP/workdistribute-scalar-assign.f90
A flang/test/Lower/OpenMP/workdistribute-target-teams-clauses.f90
A flang/test/Lower/OpenMP/workdistribute-teams-unsupported-after.f90
A flang/test/Lower/OpenMP/workdistribute-teams-unsupported-before.f90
A flang/test/Transforms/OpenMP/lower-workdistribute-doloop.mlir
A flang/test/Transforms/OpenMP/lower-workdistribute-fission-host.mlir
A flang/test/Transforms/OpenMP/lower-workdistribute-fission-target.mlir
A flang/test/Transforms/OpenMP/lower-workdistribute-fission.mlir
A flang/test/Transforms/OpenMP/lower-workdistribute-runtime-assign-scalar.mlir
Log Message:
-----------
[Flang][OpenMP] Implement workdistribute construct lowering (#140523)
This PR introduces a new pass "lower-workdistribute"
Fortran array statements are lowered to fir as fir.do_loop unordered.
"lower-workdistribute" pass works mainly on identifying "fir.do_loop
unordered" that is nested in target{teams{workdistribute{fir.do_loop
unordered}}} and lowers it to
target{teams{parallel{wsloop{loop_nest}}}}. It hoists all the other ops
outside target region. Relaces heap allocation on target with
omp.target_allocmem and deallocation with omp.target_freemem from host.
Also replaces runtime function "Assign" with omp.target_memcpy from
host.
This pass implements following rewrites and optimisations:
- **FissionWorkdistribute**: finds the parallelizable ops within teams
{workdistribute} region and moves them to their own
teams{workdistribute} region.
- **WorkdistributeRuntimeCallLower**: finds the FortranAAssign calls
nested in teams {workdistribute{}} and lowers it to unordered do loop if
src is scalar and dest is array. Other runtime calls are not handled
currently.
- **WorkdistributeDoLower**: finds the fir.do_loop unoredered nested in
teams {workdistribute{fir.do_loop unoredered}} and lowers it to teams
{parallel { distribute {wsloop {loop_nest}}}}.
- **TeamsWorkdistributeToSingle**: hoists all the ops inside teams
{workdistribute{}} before teams op.
The work in this PR is C-P and updated from @ivanradanov commits from
coexecute implementation:
[flang_workdistribute_iwomp_2024](https://github.com/ivanradanov/llvm-project/commits/flang_workdistribute_iwomp_2024)
Paper related to this work by @ivanradanov ["Automatic Parallelization
and OpenMP Offloadingof Fortran Array
Notation"](https://www.osti.gov/servlets/purl/[2449728](https://www.osti.gov/servlets/purl/2449728))
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