[all-commits] [llvm/llvm-project] 3e2e10: Clarify the invariant of the MLIR pass pipeline ar...

Mehdi Amini via All-commits all-commits at lists.llvm.org
Mon Aug 7 18:46:32 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3e2e10b55260befaa80ba837f69ff9ff92e65ad8
      https://github.com/llvm/llvm-project/commit/3e2e10b55260befaa80ba837f69ff9ff92e65ad8
  Author: Mehdi Amini <joker.eph at gmail.com>
  Date:   2023-08-07 (Mon, 07 Aug 2023)

  Changed paths:
    M mlir/include/mlir/Pass/Pass.h
    M mlir/lib/Pass/Pass.cpp

  Log Message:
  -----------
  Clarify the invariant of the MLIR pass pipeline around `Pass::initialize()`

This method should not load new dialect or affect the context itself.

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


  Commit: 370a6f094d52ee0f23f363dfeb0c66bcfdac4699
      https://github.com/llvm/llvm-project/commit/370a6f094d52ee0f23f363dfeb0c66bcfdac4699
  Author: Mehdi Amini <joker.eph at gmail.com>
  Date:   2023-08-07 (Mon, 07 Aug 2023)

  Changed paths:
    M mlir/include/mlir/Transforms/DialectConversion.h
    M mlir/lib/Transforms/Utils/DialectConversion.cpp

  Log Message:
  -----------
  [MLIR] Make the `ConversionTarget` const ref in the DialectConversion (NFC)

It isn't mutated during the conversion already, communicate this through the API.

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


  Commit: 4529797a9d7c19105815cc9a3f19571b5fca2d06
      https://github.com/llvm/llvm-project/commit/4529797a9d7c19105815cc9a3f19571b5fca2d06
  Author: Mehdi Amini <joker.eph at gmail.com>
  Date:   2023-08-07 (Mon, 07 Aug 2023)

  Changed paths:
    A mlir/include/mlir/Conversion/ConvertToLLVM/ToLLVMInterface.h
    A mlir/include/mlir/Conversion/ConvertToLLVM/ToLLVMPass.h
    M mlir/include/mlir/Conversion/NVVMToLLVM/NVVMToLLVM.h
    M mlir/include/mlir/Conversion/Passes.h
    M mlir/include/mlir/Conversion/Passes.td
    M mlir/include/mlir/IR/DialectRegistry.h
    M mlir/include/mlir/InitAllExtensions.h
    M mlir/lib/Conversion/CMakeLists.txt
    A mlir/lib/Conversion/ConvertToLLVM/CMakeLists.txt
    A mlir/lib/Conversion/ConvertToLLVM/ConvertToLLVMPass.cpp
    A mlir/lib/Conversion/ConvertToLLVM/ToLLVMInterface.cpp
    M mlir/lib/Conversion/NVVMToLLVM/NVVMToLLVM.cpp
    M mlir/lib/Dialect/LLVMIR/IR/NVVMDialect.cpp
    M mlir/lib/IR/Dialect.cpp
    M mlir/test/Conversion/NVVMToLLVM/nvvm-to-llvm.mlir

  Log Message:
  -----------
  Add a generic "convert-to-llvm" pass delegating to an interface

The multiple -convert-XXX-to-llvm passes are really nice testing tools for
individual dialects, but the expectation is that a proper conversion should
assemble the conversion patterns using `populateXXXToLLVMConversionPatterns()
APIs. However most customers just chain the conversion passes by convenience.

This pass makes it composable more transparently to assemble the required
patterns for conversion to LLVM dialect by using an interface.
The Pass will scan the input and collect all the dialect present, and for
those who implement the `ConvertToLLVMPatternInterface` it will use it to
populate the conversion pattern, and possible the conversion target.

Since these conversions can involve intermediate dialects, or target other
dialects than LLVM (for example AVX or NVVM), this pass can't statically
declare the required `getDependentDialects()` before the pass pipeline
begins. This is worked around by using an extension in the dialectRegistry
that will be invoked for every new loaded dialects in the context. This
allows to lookup the interface ahead of time and use it to query the
dependent dialects.

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


Compare: https://github.com/llvm/llvm-project/compare/0bdbe7bd7f15...4529797a9d7c


More information about the All-commits mailing list