1. May 11, 2024
    • agozillon's avatar
      [Flang][OpenMP][MLIR] Initial derived type member map support (#82853) · e8fabf9d
      agozillon authored
      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.
      e8fabf9d
    • Andrew Gozillon's avatar
      [𝘀𝗽𝗿] changes introduced through rebase · de578a57
      Andrew Gozillon authored
      Created using spr 1.3.4
      
      [skip ci]
      de578a57
  2. May 10, 2024