[all-commits] [llvm/llvm-project] 6a6270: [Flang][OpenMP][MLIR] Initial array section mappin...

agozillon via All-commits all-commits at lists.llvm.org
Mon Oct 30 08:00:37 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6a62707c048e16ce9bad37ed8e3520799139436b
      https://github.com/llvm/llvm-project/commit/6a62707c048e16ce9bad37ed8e3520799139436b
  Author: agozillon <Andrew.Gozillon at amd.com>
  Date:   2023-10-30 (Mon, 30 Oct 2023)

  Changed paths:
    M mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
    A mlir/test/Target/LLVMIR/omptarget-array-sectioning-host.mlir
    A mlir/test/Target/LLVMIR/omptarget-byref-bycopy-generation-device.mlir
    A mlir/test/Target/LLVMIR/omptarget-byref-bycopy-generation-host.mlir
    M mlir/test/Target/LLVMIR/omptarget-llvm.mlir
    M mlir/test/Target/LLVMIR/omptarget-region-parallel-llvm.mlir
    A openmp/libomptarget/test/offloading/fortran/basic-target-region-1D-array-section.f90
    A openmp/libomptarget/test/offloading/fortran/basic-target-region-3D-array-section.f90
    A openmp/libomptarget/test/offloading/fortran/basic-target-region-3D-array.f90
    A openmp/libomptarget/test/offloading/fortran/basic-target-region-array.f90

  Log Message:
  -----------
  [Flang][OpenMP][MLIR] Initial array section mapping MLIR -> LLVM-IR lowering utilising omp.bounds (#68689)

This patch seeks to add initial lowering of OpenMP array sections within
target region map clauses from MLIR to LLVM IR.

This patch seeks to support fixed sized contiguous (don't think OpenMP
supports anything other than contiguous sections from my reading but i
could be wrong) arrays initially, before looking toward assumed size and
shaped arrays. The patch also currently does not include stride, it's
left for future work.

Although, assumed size works in some fashion (dummy arguments) with some
minor alterations to the OMPEarlyOutliner, so it is possible changes
made in the IsolatedFromAbove series may allow this to work with no
further required patches.

It utilises the generated omp.bounds to calculate the size of the mapped
OpenMP array (both for sectioned and un-sectioned arrays) as well as the
offset to be passed to the kernel argument structure.

Alongside these changes some refactoring of how map data is handled is
attempted, using a new MapData structure to keep track of information
utilised in the lowering of mapped values.

The initial addition of a more complex createDeviceArgumentAccessor that
utilises capture kinds similarly to (and loosely based on) Clang to
generate different kernel argument accesses is also added.

A similar function for altering how the kernel argument is passed to the
kernel argument structure on the host is also utilised
(createAlteredByCaptureMap), which allows modification of the
pointer/basePointer based on their capture (and bounds information).
It's of note ByRef, is the default for explicit mappings and ByCopy will
be the default for implicit captures, so the former is currently tested
in this patch and the latter is not for the moment.




More information about the All-commits mailing list