[all-commits] [llvm/llvm-project] e8fabf: [Flang][OpenMP][MLIR] Initial derived type member ...

agozillon via All-commits all-commits at lists.llvm.org
Fri May 10 11:07:31 PDT 2024


  Branch: refs/heads/users/agozillon/main.flangopenmpmlir-initial-derived-type-member-map-support
  Home:   https://github.com/llvm/llvm-project
  Commit: e8fabf9d3bebc2b8a5aa62071f44dd024e4b4745
      https://github.com/llvm/llvm-project/commit/e8fabf9d3bebc2b8a5aa62071f44dd024e4b4745
  Author: agozillon <Andrew.Gozillon at amd.com>
  Date:   2024-05-10 (Fri, 10 May 2024)

  Changed paths:
    M flang/docs/OpenMP-descriptor-management.md
    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/ClauseProcessor.cpp
    M flang/lib/Lower/OpenMP/ClauseProcessor.h
    M flang/lib/Lower/OpenMP/OpenMP.cpp
    M flang/lib/Lower/OpenMP/Utils.cpp
    M flang/lib/Lower/OpenMP/Utils.h
    M flang/lib/Optimizer/Transforms/CMakeLists.txt
    R flang/lib/Optimizer/Transforms/OMPDescriptorMapInfoGen.cpp
    A flang/lib/Optimizer/Transforms/OMPMapInfoFinalization.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/allocatable-array-bounds.f90
    M flang/test/Lower/OpenMP/allocatable-map.f90
    M flang/test/Lower/OpenMP/array-bounds.f90
    A flang/test/Lower/OpenMP/derived-type-map.f90
    M flang/test/Lower/OpenMP/map-component-ref.f90
    M flang/test/Lower/OpenMP/target.f90
    R flang/test/Transforms/omp-descriptor-map-info-gen.fir
    A flang/test/Transforms/omp-map-info-finalization.fir

  Log Message:
  -----------
  [Flang][OpenMP][MLIR] Initial derived type member map support (#82853)

This patch is one in a stack of four patches that seeks to refactor
slightly and extend the current record type map support that was
put in place for Fortran's descriptor types to handle explicit
member mapping for record types at a single level of depth.

For example, the below case where members of Fortran
derived types are mapped explicitly:


```
  type :: scalar_and_array
    real(4) :: real
    integer(4) :: array(10)
    integer(4) :: int
  end type scalar_and_array
  type(scalar_and_array) :: scalar_arr

  !$omp target map(tofrom: scalar_arr%int, scalar_arr%real)
```
```
    type :: bottom_layer
      real(8) :: i2
      real(4) :: array_i2(10)
      real(4) :: array_j2(10)
    end type bottom_layer

    type :: top_layer
      real(4) :: i
      integer(4) :: array_i(10)
      real(4) :: j
      type(bottom_layer) :: nested
      integer, allocatable :: array_j(:)
      integer(4) :: k
    end type top_layer
    
    type(top_layer) :: top_dtype

!$omp target map(tofrom: top_dtype%nested%i2, top_dtype%k, top_dtype%nested%array_i2)
```
Current cases of derived type mapping left for future work are:

- Fortran's automagical mapping of all elements and nested elements of a
derived type
- explicit member mapping of a derived type and then constituent members
(redundant in Fortran due to former case but still legal as far as I am
aware)
- explicit member mapping of a record type (may be handled reasonably,
just not fully tested in this iteration)
- explicit member mapping for Fortran allocatable types (a variation of
nested record types)

This patch seeks to support this by extending the Flang-new OpenMP
lowering to
support generation of this newly required information, creating the
necessary
parent <-to-> member map_info links, calculating the member indices and
setting if it's a partial map.

The OMPDescriptorMapInfoGen pass has also been generalized into a map
finalization phase, now named OMPMapInfoFinalization. This pass was
extended
to support the insertion of member maps into the BlockArg and
MapOperands of
relevant map carrying operations. Similar to the method in which
descriptor types
are expanded and constituent members inserted.



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