[all-commits] [llvm/llvm-project] 1d7120: [mlir] Split out AttrDef/TypeDef and pattern const...

River Riddle via All-commits all-commits at lists.llvm.org
Tue Mar 15 00:51:07 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1d7120c69a9baed2ffc74067fda202a4ee35f720
      https://github.com/llvm/llvm-project/commit/1d7120c69a9baed2ffc74067fda202a4ee35f720
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2022-03-15 (Tue, 15 Mar 2022)

  Changed paths:
    M flang/include/flang/Optimizer/Dialect/CanonicalizationPatterns.td
    M flang/include/flang/Optimizer/Dialect/FIRTypes.td
    M llvm/include/llvm/TableGen/Record.h
    M llvm/lib/TableGen/Record.cpp
    M mlir/examples/toy/Ch3/mlir/ToyCombine.td
    M mlir/examples/toy/Ch4/mlir/ToyCombine.td
    M mlir/examples/toy/Ch5/mlir/ToyCombine.td
    M mlir/examples/toy/Ch6/mlir/ToyCombine.td
    M mlir/examples/toy/Ch7/mlir/ToyCombine.td
    M mlir/include/mlir/Dialect/Async/IR/AsyncTypes.td
    M mlir/include/mlir/Dialect/EmitC/IR/EmitCAttributes.td
    M mlir/include/mlir/Dialect/EmitC/IR/EmitCTypes.td
    M mlir/include/mlir/Dialect/LLVMIR/LLVMAttrDefs.td
    M mlir/include/mlir/Dialect/PDL/IR/PDLTypes.td
    M mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorAttrDefs.td
    A mlir/include/mlir/IR/AttrTypeBase.td
    M mlir/include/mlir/IR/BuiltinAttributes.td
    M mlir/include/mlir/IR/BuiltinLocationAttributes.td
    M mlir/include/mlir/IR/BuiltinTypes.td
    M mlir/include/mlir/IR/EnumAttr.td
    M mlir/include/mlir/IR/OpBase.td
    A mlir/include/mlir/IR/PatternBase.td
    M mlir/lib/Conversion/GPUToNVVM/GPUToNVVM.td
    M mlir/lib/Conversion/GPUToROCDL/GPUToROCDL.td
    M mlir/lib/Conversion/ShapeToStandard/ShapeToStandard.td
    M mlir/lib/Dialect/Arithmetic/IR/ArithmeticCanonicalization.td
    M mlir/lib/Dialect/SPIRV/IR/SPIRVCanonicalization.td
    M mlir/lib/Dialect/Shape/IR/ShapeCanonicalization.td
    M mlir/test/lib/Dialect/Test/TestAttrDefs.td
    M mlir/test/lib/Dialect/Test/TestOps.td
    M mlir/test/mlir-tblgen/attr-or-type-format-invalid.td
    M mlir/test/mlir-tblgen/attr-or-type-format.td
    M mlir/test/mlir-tblgen/attrdefs.td
    M mlir/test/mlir-tblgen/default-type-attr-print-parser.td
    M mlir/test/mlir-tblgen/expect-symbol.td
    M mlir/test/mlir-tblgen/op-attribute.td
    M mlir/test/mlir-tblgen/op-decl-and-defs.td
    M mlir/test/mlir-tblgen/rewriter-errors.td
    M mlir/test/mlir-tblgen/rewriter-indexing.td
    M mlir/test/mlir-tblgen/rewriter-static-matcher.td
    M mlir/test/mlir-tblgen/typedefs.td
    M mlir/test/python/python_test_ops.td
    M mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp
    M mlir/tools/mlir-tblgen/OpDocGen.cpp

  Log Message:
  -----------
  [mlir] Split out AttrDef/TypeDef and pattern constructs from OpBase.td

OpBase.td has formed into a huge monolith of all ODS constructs. This
commits starts to rectify that by splitting out some constructs to their
own .td files.

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


  Commit: 84d2549e82ba44ded64ae3626a11116cf97ee424
      https://github.com/llvm/llvm-project/commit/84d2549e82ba44ded64ae3626a11116cf97ee424
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2022-03-15 (Tue, 15 Mar 2022)

  Changed paths:
    A mlir/docs/AttributesAndTypes.md
    M mlir/docs/LangRef.md
    M mlir/docs/OpDefinitions.md
    R mlir/docs/Tutorials/DefiningAttributesAndTypes.md

  Log Message:
  -----------
  [mlir] Rewrite and modernize the documentation for defining Attributes/Types

The current documentation is super old, crusty, and at times wrong. This commit
rewrites the documentation to focus on the TableGen declarative definition,
expounds on various components, and moves the doc out of Tutorials/ and into
a new top level `AttributesAndTypes.md` doc. As part of this, the AttrDef/TypeDef
documentation in OpDefinitions.md is removed.

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


  Commit: 23e3cbe24a51604a03a379664f67ed79e5fef897
      https://github.com/llvm/llvm-project/commit/23e3cbe24a51604a03a379664f67ed79e5fef897
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2022-03-15 (Tue, 15 Mar 2022)

  Changed paths:
    M flang/include/flang/Optimizer/Dialect/FIRTypes.td
    M mlir/include/mlir/Dialect/Async/IR/AsyncTypes.td
    M mlir/include/mlir/Dialect/EmitC/IR/EmitCAttributes.td
    M mlir/include/mlir/Dialect/EmitC/IR/EmitCTypes.td
    M mlir/include/mlir/Dialect/LLVMIR/LLVMAttrDefs.td
    M mlir/include/mlir/Dialect/PDL/IR/PDLTypes.td
    M mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorAttrDefs.td
    M mlir/include/mlir/IR/AttrTypeBase.td
    M mlir/include/mlir/TableGen/AttrOrTypeDef.h
    M mlir/lib/TableGen/AttrOrTypeDef.cpp
    M mlir/test/lib/Dialect/Test/TestAttrDefs.td
    M mlir/test/lib/Dialect/Test/TestTypeDefs.td
    M mlir/test/lib/Dialect/Test/TestTypes.cpp
    M mlir/test/mlir-tblgen/attrdefs.td
    M mlir/test/mlir-tblgen/testdialect-typedefs.mlir
    M mlir/test/mlir-tblgen/typedefs.td
    M mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp
    M mlir/tools/mlir-tblgen/OpDocGen.cpp

  Log Message:
  -----------
  [mlir] Refactor how parser/printers are specified for AttrDef/TypeDef

There is currently an awkwardly complex set of rules for how a
parser/printer is generated for AttrDef/TypeDef. It can change depending on if a
mnemonic was specified, if there are parameters, if using the assemblyFormat, if
individual parser/printer code blocks were specified, etc. This commit refactors
this to make what the attribute/type wants more explicit, and to better align
with how formats are specified for operations.

Firstly, the parser/printer code blocks are removed in favor of a
`hasCustomAssemblyFormat` bit field. This aligns with the operation format
specification (and is nice to remove code blocks from ODS).

This commit also adds a requirement to explicitly set `assemblyFormat` or
`hasCustomAssemblyFormat` when the mnemonic is set and the attr/type
has no parameters. This removes the weird implicit matrix of behavior,
and also encourages the author to make a conscious choice of either C++
or declarative format instead of implicitly opting them into the C++
format (we should be pushing towards declarative when possible).

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


Compare: https://github.com/llvm/llvm-project/compare/4767e267757f...23e3cbe24a51


More information about the All-commits mailing list