[all-commits] [llvm/llvm-project] b77bac: [mlir] Introduce dialect interfaces for translatio...

ftynse via All-commits all-commits at lists.llvm.org
Fri Feb 12 08:50:09 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b77bac0572340d4e5b6095a82e0fcbcc01870645
      https://github.com/llvm/llvm-project/commit/b77bac0572340d4e5b6095a82e0fcbcc01870645
  Author: Alex Zinenko <zinenko at google.com>
  Date:   2021-02-12 (Fri, 12 Feb 2021)

  Changed paths:
    M mlir/examples/toy/Ch6/toyc.cpp
    M mlir/examples/toy/Ch7/toyc.cpp
    M mlir/include/mlir/Target/LLVMIR.h
    A mlir/include/mlir/Target/LLVMIR/Dialect/LLVMIR/LLVMToLLVMIRTranslation.h
    A mlir/include/mlir/Target/LLVMIR/LLVMTranslationInterface.h
    M mlir/include/mlir/Target/LLVMIR/ModuleTranslation.h
    M mlir/lib/Target/CMakeLists.txt
    A mlir/lib/Target/LLVMIR/CMakeLists.txt
    M mlir/lib/Target/LLVMIR/ConvertToLLVMIR.cpp
    M mlir/lib/Target/LLVMIR/ConvertToNVVMIR.cpp
    M mlir/lib/Target/LLVMIR/ConvertToROCDLIR.cpp
    A mlir/lib/Target/LLVMIR/Dialect/CMakeLists.txt
    A mlir/lib/Target/LLVMIR/Dialect/LLVMIR/CMakeLists.txt
    A mlir/lib/Target/LLVMIR/Dialect/LLVMIR/LLVMToLLVMIRTranslation.cpp
    M mlir/lib/Target/LLVMIR/LLVMAVX512Intr.cpp
    M mlir/lib/Target/LLVMIR/LLVMArmNeonIntr.cpp
    M mlir/lib/Target/LLVMIR/LLVMArmSVEIntr.cpp
    M mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
    M mlir/tools/mlir-cpu-runner/mlir-cpu-runner.cpp
    M mlir/tools/mlir-cuda-runner/mlir-cuda-runner.cpp
    M mlir/tools/mlir-rocm-runner/mlir-rocm-runner.cpp
    M mlir/tools/mlir-spirv-cpu-runner/mlir-spirv-cpu-runner.cpp
    M mlir/tools/mlir-vulkan-runner/mlir-vulkan-runner.cpp
    M mlir/unittests/ExecutionEngine/Invoke.cpp

  Log Message:
  -----------
  [mlir] Introduce dialect interfaces for translation to LLVM IR

The existing approach to translation to the LLVM IR relies on a single
translation supporting the base LLVM dialect, extensible through inheritance to
support intrinsic-based dialects also derived from LLVM IR such as NVVM and
AVX512. This approach does not scale well as it requires additional
translations to be created for each new intrinsic-based dialect and does not
allow them to mix in the same module, contrary to the rest of the MLIR
infrastructure. Furthermore, OpenMP translation ingrained itself into the main
translation mechanism.

Start refactoring the translation to LLVM IR to operate using dialect
interfaces. Each dialect that contains ops translatable to LLVM IR can
implement the interface for translating them, and the top-level translation
driver can operate on interfaces without knowing about specific dialects.
Furthermore, the delayed dialect registration mechanism allows one to avoid a
dependency on LLVM IR in the dialect that is translated to it by implementing
the translation as a separate library and only registering it at the client
level.

This change introduces the new mechanism and factors out the translation of the
"main" LLVM dialect. The remaining dialects will follow suit.

Reviewed By: nicolasvasilache

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




More information about the All-commits mailing list