[all-commits] [llvm/llvm-project] 6f7653: [MLIR][OpenMP][OMPIRBuilder] Add lowering support ...

Sergio Afonso via All-commits all-commits at lists.llvm.org
Fri Aug 2 02:56:04 PDT 2024


  Branch: refs/heads/users/skatrak/target-host-04-llvm
  Home:   https://github.com/llvm/llvm-project
  Commit: 6f7653b1ff22cfbd449b5e0c29d67271578bb582
      https://github.com/llvm/llvm-project/commit/6f7653b1ff22cfbd449b5e0c29d67271578bb582
  Author: Sergio Afonso <safonsof at amd.com>
  Date:   2024-08-02 (Fri, 02 Aug 2024)

  Changed paths:
    M flang/test/Integration/OpenMP/map-types-and-sizes.f90
    M llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
    M llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
    M llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
    M mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
    M mlir/test/Target/LLVMIR/omptarget-array-sectioning-host.mlir
    M mlir/test/Target/LLVMIR/omptarget-byref-bycopy-generation-host.mlir
    A mlir/test/Target/LLVMIR/omptarget-depend-host-only.mlir
    M mlir/test/Target/LLVMIR/omptarget-depend.mlir
    M mlir/test/Target/LLVMIR/omptarget-fortran-allocatable-types-host.mlir
    M mlir/test/Target/LLVMIR/omptarget-fortran-common-block-host.mlir
    M mlir/test/Target/LLVMIR/omptarget-nested-record-type-mapping-host.mlir
    M mlir/test/Target/LLVMIR/omptarget-record-type-mapping-host.mlir
    A mlir/test/Target/LLVMIR/omptarget-region-host-only.mlir
    M mlir/test/Target/LLVMIR/omptarget-region-llvm.mlir

  Log Message:
  -----------
  [MLIR][OpenMP][OMPIRBuilder] Add lowering support for omp.target_triples

This patch modifies MLIR to LLVM IR lowering of the OpenMP dialect to take into
consideration the contents of the `omp.target_triples` module attribute while
generating code for `omp.target` operations.

It adds the `OpenMPIRBuilderConfig::TargetTriples` field and initializes it
using the `amendOperation` flow of the `OpenMPToLLVMIRTranslation` pass. Some
changes are introduced into the `OpenMPIRBuilder` to allow passing the
information about whether a target region is intended to be offloaded from
outside.

The result of this change is that offloading calls are only generated when the
`--offload-arch` or `-fopenmp-targets` options are given to the compiler.
Otherwise, only the host fallback code is generated. This fixes linker errors
currently triggered by `flang-new` if a source file containing a `target`
construct is compiled without any of the aforementioned options.

Several unit tests impacted by these changes, which are intended to check host
code generated for `omp.target` operations, are updated to contain the new
attribute. Without it, no calls to `__tgt_target_kernel` and associated control
flow operations are generated.

Fixes #100209.



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