[all-commits] [llvm/llvm-project] 575b22: Revisit Dialect registration: require and store a ...

Mehdi Amini via All-commits all-commits at lists.llvm.org
Fri Aug 7 08:57:33 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 575b22b5d11bc4c4eb85dde456d9ac7f3cfa3924
      https://github.com/llvm/llvm-project/commit/575b22b5d11bc4c4eb85dde456d9ac7f3cfa3924
  Author: Mehdi Amini <joker.eph at gmail.com>
  Date:   2020-08-07 (Fri, 07 Aug 2020)

  Changed paths:
    M mlir/examples/standalone/lib/Standalone/StandaloneDialect.cpp
    M mlir/examples/toy/Ch2/mlir/Dialect.cpp
    M mlir/examples/toy/Ch3/mlir/Dialect.cpp
    M mlir/examples/toy/Ch4/mlir/Dialect.cpp
    M mlir/examples/toy/Ch5/mlir/Dialect.cpp
    M mlir/examples/toy/Ch6/mlir/Dialect.cpp
    M mlir/examples/toy/Ch7/mlir/Dialect.cpp
    M mlir/include/mlir/Dialect/LLVMIR/LLVMOpBase.td
    M mlir/include/mlir/Dialect/SDBM/SDBMDialect.h
    M mlir/include/mlir/IR/Dialect.h
    M mlir/include/mlir/IR/MLIRContext.h
    M mlir/lib/Dialect/AVX512/IR/AVX512Dialect.cpp
    M mlir/lib/Dialect/Affine/IR/AffineOps.cpp
    M mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
    M mlir/lib/Dialect/LLVMIR/IR/LLVMAVX512Dialect.cpp
    M mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
    M mlir/lib/Dialect/LLVMIR/IR/NVVMDialect.cpp
    M mlir/lib/Dialect/LLVMIR/IR/ROCDLDialect.cpp
    M mlir/lib/Dialect/Linalg/IR/LinalgTypes.cpp
    M mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
    M mlir/lib/Dialect/Quant/IR/QuantOps.cpp
    M mlir/lib/Dialect/SCF/SCF.cpp
    M mlir/lib/Dialect/SPIRV/SPIRVDialect.cpp
    M mlir/lib/Dialect/Shape/IR/Shape.cpp
    M mlir/lib/Dialect/StandardOps/IR/Ops.cpp
    M mlir/lib/Dialect/Vector/VectorOps.cpp
    M mlir/lib/IR/Dialect.cpp
    M mlir/lib/IR/MLIRContext.cpp
    M mlir/test/lib/Dialect/Test/TestDialect.cpp
    M mlir/tools/mlir-tblgen/DialectGen.cpp
    M mlir/unittests/IR/DialectTest.cpp

  Log Message:
  -----------
  Revisit Dialect registration: require and store a TypeID on dialects

This patch moves the registration to a method in the MLIRContext: getOrCreateDialect<ConcreteDialect>()

This method requires dialect to provide a static getDialectNamespace()
and store a TypeID on the Dialect itself, which allows to lazyily
create a dialect when not yet loaded in the context.
As a side effect, it means that duplicated registration of the same
dialect is not an issue anymore.

To limit the boilerplate, TableGen dialect generation is modified to
emit the constructor entirely and invoke separately a "init()" method
that the user implements.

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




More information about the All-commits mailing list