[all-commits] [llvm/llvm-project] 973ddb: Define a `NoTerminator` traits that allows operati...

Mehdi Amini via All-commits all-commits at lists.llvm.org
Wed Mar 24 20:59:38 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 973ddb7d6e96e744a785ba64c065b592987a005f
      https://github.com/llvm/llvm-project/commit/973ddb7d6e96e744a785ba64c065b592987a005f
  Author: Mehdi Amini <joker.eph at gmail.com>
  Date:   2021-03-25 (Thu, 25 Mar 2021)

  Changed paths:
    M mlir/docs/LangRef.md
    M mlir/docs/Traits.md
    M mlir/docs/Tutorials/Toy/Ch-6.md
    M mlir/docs/Tutorials/UnderstandingTheIRStructure.md
    M mlir/examples/toy/Ch6/mlir/LowerToLLVM.cpp
    M mlir/examples/toy/Ch7/mlir/LowerToLLVM.cpp
    M mlir/include/mlir/IR/BuiltinOps.h
    M mlir/include/mlir/IR/BuiltinOps.td
    M mlir/include/mlir/IR/OpBase.td
    M mlir/include/mlir/IR/OpDefinition.h
    M mlir/include/mlir/IR/OpImplementation.h
    M mlir/include/mlir/IR/Region.h
    M mlir/include/mlir/IR/RegionKindInterface.h
    M mlir/include/mlir/IR/RegionKindInterface.td
    M mlir/include/mlir/Parser.h
    M mlir/lib/Bindings/Python/mlir/dialects/_builtin_ops_ext.py
    M mlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp
    M mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp
    M mlir/lib/Conversion/GPUToVulkan/ConvertGPULaunchFuncToVulkanLaunchFunc.cpp
    M mlir/lib/Conversion/GPUToVulkan/ConvertLaunchFuncToVulkanCalls.cpp
    M mlir/lib/Conversion/LinalgToLLVM/LinalgToLLVM.cpp
    M mlir/lib/Conversion/LinalgToSPIRV/LinalgToSPIRVPass.cpp
    M mlir/lib/Conversion/LinalgToStandard/LinalgToStandard.cpp
    M mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp
    M mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.cpp
    M mlir/lib/Conversion/ShapeToStandard/ShapeToStandard.cpp
    M mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRVPass.cpp
    M mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp
    M mlir/lib/Dialect/StandardOps/Transforms/FuncBufferize.cpp
    M mlir/lib/IR/AsmPrinter.cpp
    M mlir/lib/IR/Block.cpp
    M mlir/lib/IR/BuiltinDialect.cpp
    M mlir/lib/IR/SymbolTable.cpp
    M mlir/lib/IR/Verifier.cpp
    M mlir/lib/Parser/Parser.cpp
    M mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
    M mlir/lib/Transforms/SymbolDCE.cpp
    M mlir/lib/Transforms/Utils/RegionUtils.cpp
    M mlir/test/Bindings/Python/context_managers.py
    M mlir/test/Bindings/Python/dialects.py
    M mlir/test/Bindings/Python/dialects/builtin.py
    M mlir/test/Bindings/Python/dialects/linalg/opdsl/emit_structured_generic.py
    M mlir/test/Bindings/Python/dialects/linalg/ops.py
    M mlir/test/Bindings/Python/insertion_point.py
    M mlir/test/Bindings/Python/ir_operation.py
    M mlir/test/Bindings/Python/ods_helpers.py
    M mlir/test/Bindings/Python/pass_manager.py
    M mlir/test/CAPI/ir.c
    M mlir/test/CAPI/pass.c
    M mlir/test/IR/invalid-module-op.mlir
    M mlir/test/IR/invalid.mlir
    M mlir/test/IR/module-op.mlir
    M mlir/test/IR/print-ir-defuse.mlir
    M mlir/test/IR/print-ir-nesting.mlir
    M mlir/test/IR/region.mlir
    M mlir/test/Transforms/test-legalizer-analysis.mlir
    M mlir/test/lib/Dialect/Test/TestDialect.cpp
    M mlir/test/lib/Dialect/Test/TestPatterns.cpp
    M mlir/test/lib/Transforms/TestConvVectorization.cpp
    M mlir/tools/mlir-tblgen/OpFormatGen.cpp

  Log Message:
  -----------
  Define a `NoTerminator` traits that allows operations with a single block region to not provide a terminator

In particular for Graph Regions, the terminator needs is just a
historical artifact of the generalization of MLIR from CFG region.
Operations like Module don't need a terminator, and before Module
migrated to be an operation with region there wasn't any needed.

To validate the feature, the ModuleOp is migrated to use this trait and
the ModuleTerminator operation is deleted.

This patch is likely to break clients, if you're in this case:

- you may iterate on a ModuleOp with `getBody()->without_terminator()`,
  the solution is simple: just remove the ->without_terminator!
- you created a builder with `Builder::atBlockTerminator(module_body)`,
  just use `Builder::atBlockEnd(module_body)` instead.
- you were handling ModuleTerminator: it isn't needed anymore.
- for generic code, a `Block::mayNotHaveTerminator()` may be used.

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




More information about the All-commits mailing list