[all-commits] [llvm/llvm-project] 2ca464: [mlir][Async] Add option to LLVM lowering to use o...

zero9178 via All-commits all-commits at lists.llvm.org
Fri Feb 10 08:56:27 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2ca46421f85a1f4acf0d0b56ee31d76ff99ae3a1
      https://github.com/llvm/llvm-project/commit/2ca46421f85a1f4acf0d0b56ee31d76ff99ae3a1
  Author: Markus Böck <markus.boeck02 at gmail.com>
  Date:   2023-02-10 (Fri, 10 Feb 2023)

  Changed paths:
    M mlir/include/mlir/Conversion/Passes.td
    M mlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp
    M mlir/test/Conversion/AsyncToLLVM/convert-coro-to-llvm.mlir
    M mlir/test/Conversion/AsyncToLLVM/convert-runtime-to-llvm.mlir
    M mlir/test/Conversion/AsyncToLLVM/convert-to-llvm.mlir
    A mlir/test/Conversion/AsyncToLLVM/typed-pointers.mlir

  Log Message:
  -----------
  [mlir][Async] Add option to LLVM lowering to use opaque pointers

Part of https://discourse.llvm.org/t/rfc-switching-the-llvm-dialect-and-dialect-lowerings-to-opaque-pointers/68179

This patch adds the pass option 'use-opaque-pointers' to allow the dialect conversion from async to LLVM to create LLVM opaque pointers instead of typed pointers.
The gist of the changes boil down to having to propagate the choice of whether opaque or typed pointers should be used, to various helper functions that then either create typed pointers or opaque pointers.
This sadly creates a bit of a code duplication in comparison to other patches in this series, which I think is mostly unavoidable however, since a lot of the patterns in this lowering require the use of the AsyncTypeConverter, instead of the LLVMTypeConverter.

Besides that, the tests have been converter to opaque pointers with one file with typed pointer support having been created as regression tests.

Differential Revision: https://reviews.llvm.org/D143661


  Commit: 81767f52f49339be2c78fc9bf831856b9f57e2f0
      https://github.com/llvm/llvm-project/commit/81767f52f49339be2c78fc9bf831856b9f57e2f0
  Author: Markus Böck <markus.boeck02 at gmail.com>
  Date:   2023-02-10 (Fri, 10 Feb 2023)

  Changed paths:
    M flang/lib/Lower/OpenMP.cpp
    M flang/test/Lower/OpenMP/atomic-read.f90
    M flang/test/Lower/OpenMP/wsloop-reduction-add.f90
    M flang/test/Lower/OpenMP/wsloop-reduction-logical-and.f90
    M flang/test/Lower/OpenMP/wsloop-reduction-mul.f90
    M mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
    M mlir/include/mlir/Dialect/OpenMP/OpenMPTypeInterfaces.td
    M mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
    M mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
    M mlir/test/Conversion/OpenMPToLLVM/convert-to-llvmir.mlir
    M mlir/test/Dialect/OpenMP/invalid.mlir
    M mlir/test/Dialect/OpenMP/ops.mlir
    M mlir/test/Target/LLVMIR/openmp-llvm-invalid.mlir
    M mlir/test/Target/LLVMIR/openmp-llvm.mlir
    A mlir/test/Target/LLVMIR/openmp-reduction-typed-pointers.mlir
    M mlir/test/Target/LLVMIR/openmp-reduction.mlir

  Log Message:
  -----------
  [mlir][OpenMP] Add support for using Opaque Pointers in the OpenMP Dialect

The current OpenMP implementation assumes the use of typed pointers (or rather typed pointer like types). Given the support for typed pointers in LLVM is now pending removal, the OpenMP Dialect should be able to support opaque pointers as well, given that any users of it must lower OpenMP through the LLVM Dialect.

This patch fixes the above and adds support for using LLVM opaque pointers with the OpenMP dialect. This is implemented by making all related code not make use of the element type of pointer arguments. The few (one) op requiring a pointer element type now use an explicit `TypeAttr` for representing the element type.
More concretely, the list of changes are:
* `omp.atomic.read` now has an extra `TypeAttr` (also in syntax) which is the element type of the values read and stored from the operands
* `omp.reduction` now has an type argument in the syntax for both the accmulator and operand since the operand type can no longer be inferred from the accumulator
* `OpenMPToLLVMIRTranslation.cpp` was rewritten to never query element types of pointers
* Adjusted the verifier to be able to handle pointers without element types

Differential Revision: https://reviews.llvm.org/D143582


Compare: https://github.com/llvm/llvm-project/compare/7da2d644e039...81767f52f493


More information about the All-commits mailing list