[all-commits] [llvm/llvm-project] 95fe47: [Flang][OpenMP] Initial mapping of Fortran pointer...
agozillon via All-commits
all-commits at lists.llvm.org
Mon Feb 5 09:45:20 PST 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 95fe47ca7e99d999108705640e49075f4c5f39a7
https://github.com/llvm/llvm-project/commit/95fe47ca7e99d999108705640e49075f4c5f39a7
Author: agozillon <Andrew.Gozillon at amd.com>
Date: 2024-02-05 (Mon, 05 Feb 2024)
Changed paths:
A flang/docs/OpenMP-descriptor-management.md
A flang/include/flang/Optimizer/CodeGen/CodeGenOpenMP.h
M flang/include/flang/Optimizer/Dialect/FIRType.h
M flang/include/flang/Optimizer/Transforms/Passes.h
M flang/include/flang/Optimizer/Transforms/Passes.td
M flang/include/flang/Tools/CLOptions.inc
M flang/lib/Lower/OpenMP.cpp
M flang/lib/Optimizer/CodeGen/CMakeLists.txt
M flang/lib/Optimizer/CodeGen/CodeGen.cpp
A flang/lib/Optimizer/CodeGen/CodeGenOpenMP.cpp
M flang/lib/Optimizer/Dialect/FIRType.cpp
M flang/lib/Optimizer/Transforms/CMakeLists.txt
A flang/lib/Optimizer/Transforms/OMPDescriptorMapInfoGen.cpp
M flang/test/Fir/convert-to-llvm-openmp-and-fir.fir
M flang/test/Integration/OpenMP/map-types-and-sizes.f90
M flang/test/Lower/OpenMP/FIR/array-bounds.f90
M flang/test/Lower/OpenMP/FIR/target.f90
A flang/test/Lower/OpenMP/allocatable-array-bounds.f90
A flang/test/Lower/OpenMP/allocatable-map.f90
M flang/test/Lower/OpenMP/array-bounds.f90
M flang/test/Lower/OpenMP/target.f90
A flang/test/Transforms/omp-descriptor-map-info-gen.fir
M mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
M mlir/include/mlir/Dialect/OpenMP/OpenMPOpsInterfaces.td
M mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
M mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
M mlir/test/Dialect/OpenMP/ops.mlir
A mlir/test/Target/LLVMIR/omptarget-fortran-allocatable-types-host.mlir
A openmp/libomptarget/test/offloading/fortran/target-map-allocatable-array-section-1d-bounds.f90
A openmp/libomptarget/test/offloading/fortran/target-map-allocatable-array-section-3d-bounds.f90
A openmp/libomptarget/test/offloading/fortran/target-map-allocatable-map-scopes.f90
A openmp/libomptarget/test/offloading/fortran/target-map-enter-exit-allocatables.f90
A openmp/libomptarget/test/offloading/fortran/target-map-enter-exit-array.f90
A openmp/libomptarget/test/offloading/fortran/target-map-pointer-scopes-enter-exit.f90
A openmp/libomptarget/test/offloading/fortran/target-map-pointer-target-array-section-3d-bounds.f90
A openmp/libomptarget/test/offloading/fortran/target-map-pointer-target-scopes.f90
Log Message:
-----------
[Flang][OpenMP] Initial mapping of Fortran pointers and allocatables for target devices (#71766)
This patch seeks to add an initial lowering for pointers and allocatable variables
captured by implicit and explicit map in Flang OpenMP for Target operations that
take map clauses e.g. Target, Target Update. Target Exit/Enter etc.
Currently this is done by treating the type that lowers to a descriptor
(allocatable/pointer/assumed shape) as a map of a record type (e.g. a structure) as that's
effectively what descriptor types lower to in LLVM-IR and what they're represented as
in the Fortran runtime (written in C/C++). The descriptor effectively lowers to a structure
containing scalar and array elements that represent various aspects of the underlying
data being mapped (lower bound, upper bound, extent being the main ones of interest
in most cases) and a pointer to the allocated data. In this current iteration of the mapping
we map the structure in it's entirety and then attach the underlying data pointer and map
the data to the device, this allows most of the required data to be resident on the device
for use. Currently we do not support the addendum (another block of pointer data), but
it shouldn't be too difficult to extend this to support it.
The MapInfoOp generation for descriptor types is primarily handled in an optimization
pass, where it expands BoxType (descriptor types) map captures into two maps, one for
the structure (scalar elements) and the other for the pointer data (base address) and
links them in a Parent <-> Child relationship. The later lowering processes will then treat
them as a conjoined structure with a pointer member map.
More information about the All-commits
mailing list