[all-commits] [llvm/llvm-project] db1c19: [mlir] take LLVMContext in MLIR-to-LLVM-IR transla...

ftynse via All-commits all-commits at lists.llvm.org
Fri Aug 7 05:22:50 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: db1c197bf8247d8dced41ae2f579168c7b54d9ef
      https://github.com/llvm/llvm-project/commit/db1c197bf8247d8dced41ae2f579168c7b54d9ef
  Author: Alex Zinenko <zinenko at google.com>
  Date:   2020-08-07 (Fri, 07 Aug 2020)

  Changed paths:
    M mlir/docs/Tutorials/Toy/Ch-6.md
    M mlir/examples/toy/Ch6/toyc.cpp
    M mlir/examples/toy/Ch7/toyc.cpp
    M mlir/include/mlir/Conversion/GPUCommon/GPUCommonPass.h
    M mlir/include/mlir/Dialect/LLVMIR/LLVMDialect.h
    M mlir/include/mlir/Target/LLVMIR.h
    M mlir/include/mlir/Target/LLVMIR/ModuleTranslation.h
    M mlir/include/mlir/Target/NVVMIR.h
    M mlir/include/mlir/Target/ROCDLIR.h
    M mlir/lib/Conversion/GPUCommon/ConvertKernelFuncToBlob.cpp
    M mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
    M mlir/lib/ExecutionEngine/ExecutionEngine.cpp
    M mlir/lib/Target/LLVMIR/ConvertToLLVMIR.cpp
    M mlir/lib/Target/LLVMIR/ConvertToNVVMIR.cpp
    M mlir/lib/Target/LLVMIR/ConvertToROCDLIR.cpp
    M mlir/lib/Target/LLVMIR/LLVMAVX512Intr.cpp
    M mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
    M mlir/tools/mlir-rocm-runner/mlir-rocm-runner.cpp

  Log Message:
  -----------
  [mlir] take LLVMContext in MLIR-to-LLVM-IR translation

Due to the original type system implementation, LLVMDialect in MLIR contains an
LLVMContext in which the relevant objects (types, metadata) are created. When
an MLIR module using the LLVM dialect (and related intrinsic-based dialects
NVVM, ROCDL, AVX512) is converted to LLVM IR, it could only live in the
LLVMContext owned by the dialect. The type system no longer relies on the
LLVMContext, so this limitation can be removed. Instead, translation functions
now take a reference to an LLVMContext in which the LLVM IR module should be
constructed. The caller of the translation functions is responsible for
ensuring the same LLVMContext is not used concurrently as the translation no
longer uses a dialect-wide context lock.

As an additional bonus, this change removes the need to recreate the LLVM IR
module in a different LLVMContext through printing and parsing back, decreasing
the compilation overhead in JIT and GPU-kernel-to-blob passes.

Reviewed By: rriddle, mehdi_amini

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




More information about the All-commits mailing list