[all-commits] [llvm/llvm-project] 0e9523: [mlir] Support lowering of dialect attributes atta...

Sergio Afonso via All-commits all-commits at lists.llvm.org
Tue Mar 21 05:55:28 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0e9523efda8a4ad95ecb1d5b5e65e10bcc3711f5
      https://github.com/llvm/llvm-project/commit/0e9523efda8a4ad95ecb1d5b5e65e10bcc3711f5
  Author: Sergio Afonso <safonsof at amd.com>
  Date:   2023-03-21 (Tue, 21 Mar 2023)

  Changed paths:
    M flang/lib/Frontend/CMakeLists.txt
    M flang/lib/Optimizer/CodeGen/CMakeLists.txt
    M flang/lib/Optimizer/Dialect/CMakeLists.txt
    M flang/lib/Optimizer/Support/CMakeLists.txt
    M flang/lib/Optimizer/Support/InitFIR.cpp
    M flang/tools/tco/CMakeLists.txt
    M mlir/examples/toy/Ch6/CMakeLists.txt
    M mlir/examples/toy/Ch6/toyc.cpp
    M mlir/examples/toy/Ch7/CMakeLists.txt
    M mlir/examples/toy/Ch7/toyc.cpp
    M mlir/include/mlir/Target/LLVMIR/Dialect/All.h
    A mlir/include/mlir/Target/LLVMIR/Dialect/Builtin/BuiltinToLLVMIRTranslation.h
    A mlir/include/mlir/Target/LLVMIR/Dialect/GPU/GPUToLLVMIRTranslation.h
    M mlir/lib/CAPI/ExecutionEngine/CMakeLists.txt
    M mlir/lib/CAPI/ExecutionEngine/ExecutionEngine.cpp
    M mlir/lib/CAPI/RegisterEverything/CMakeLists.txt
    M mlir/lib/CAPI/RegisterEverything/RegisterEverything.cpp
    M mlir/lib/Dialect/GPU/CMakeLists.txt
    M mlir/lib/Dialect/GPU/Transforms/SerializeToBlob.cpp
    M mlir/lib/ExecutionEngine/CMakeLists.txt
    M mlir/lib/Target/LLVMIR/CMakeLists.txt
    A mlir/lib/Target/LLVMIR/Dialect/Builtin/BuiltinToLLVMIRTranslation.cpp
    A mlir/lib/Target/LLVMIR/Dialect/Builtin/CMakeLists.txt
    M mlir/lib/Target/LLVMIR/Dialect/CMakeLists.txt
    A mlir/lib/Target/LLVMIR/Dialect/GPU/CMakeLists.txt
    A mlir/lib/Target/LLVMIR/Dialect/GPU/GPUToLLVMIRTranslation.cpp
    M mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
    M mlir/tools/mlir-cpu-runner/CMakeLists.txt
    M mlir/tools/mlir-spirv-cpu-runner/CMakeLists.txt
    M mlir/tools/mlir-vulkan-runner/CMakeLists.txt
    M mlir/unittests/ExecutionEngine/Invoke.cpp

  Log Message:
  -----------
  [mlir] Support lowering of dialect attributes attached to top-level modules

This patch supports the processing of dialect attributes attached to top-level
module-type operations during MLIR-to-LLVMIR lowering.

This approach modifies the `mlir::translateModuleToLLVMIR()` function to call
`ModuleTranslation::convertOperation()` on the top-level operation, after its
body has been lowered. This, in turn, will get the
`LLVMTranslationDialectInterface` object associated to that operation's dialect
before trying to use it for lowering prior to processing dialect attributes
attached to the operation.

Since there are no `LLVMTranslationDialectInterface`s for the builtin and GPU
dialects, which define their own module-type operations, this patch also adds
and registers them. The requirement for always calling
`mlir::registerBuiltinDialectTranslation()` before any translation of MLIR to
LLVM IR where builtin module operations are present is introduced. The purpose
of these new translation interfaces is to succeed when processing module-type
operations, allowing the lowering process to continue and to prevent the
introduction of failures related to not finding such interfaces.

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




More information about the All-commits mailing list