[all-commits] [llvm/llvm-project] e17953: [mlir] Remove types from attributes
Jeff Niu via All-commits
all-commits at lists.llvm.org
Sun Jul 31 17:01:46 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: e1795322844ca45ecbcdca8669929a46c666127e
https://github.com/llvm/llvm-project/commit/e1795322844ca45ecbcdca8669929a46c666127e
Author: Jeff Niu <jeff at modular.com>
Date: 2022-07-31 (Sun, 31 Jul 2022)
Changed paths:
M mlir/docs/AttributesAndTypes.md
M mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.td
M mlir/include/mlir/Dialect/CommonFolders.h
M mlir/include/mlir/Dialect/Complex/IR/ComplexAttributes.td
M mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
M mlir/include/mlir/Dialect/EmitC/IR/EmitCAttributes.td
M mlir/include/mlir/Dialect/MLProgram/IR/MLProgramAttributes.h
M mlir/include/mlir/Dialect/MLProgram/IR/MLProgramAttributes.td
M mlir/include/mlir/Dialect/SPIRV/IR/SPIRVStructureOps.td
M mlir/include/mlir/IR/AttrTypeBase.td
M mlir/include/mlir/IR/AttributeSupport.h
M mlir/include/mlir/IR/Attributes.h
M mlir/include/mlir/IR/BuiltinAttributeInterfaces.h
M mlir/include/mlir/IR/BuiltinAttributeInterfaces.td
M mlir/include/mlir/IR/BuiltinAttributes.h
M mlir/include/mlir/IR/BuiltinAttributes.td
A mlir/include/mlir/IR/BuiltinTypeInterfaces.h
M mlir/include/mlir/IR/BuiltinTypes.h
M mlir/lib/AsmParser/DialectSymbolParser.cpp
M mlir/lib/CAPI/IR/IR.cpp
M mlir/lib/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.cpp
M mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp
M mlir/lib/Dialect/Arithmetic/IR/ArithmeticOps.cpp
M mlir/lib/Dialect/Complex/IR/ComplexOps.cpp
M mlir/lib/Dialect/EmitC/IR/EmitC.cpp
M mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
M mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
M mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
M mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp
M mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp
M mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
M mlir/lib/Dialect/SPIRV/IR/SPIRVCanonicalization.cpp
M mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp
M mlir/lib/Dialect/Vector/IR/VectorOps.cpp
M mlir/lib/IR/AsmPrinter.cpp
M mlir/lib/IR/AttributeDetail.h
M mlir/lib/IR/BuiltinAttributeInterfaces.cpp
M mlir/lib/IR/BuiltinAttributes.cpp
M mlir/lib/IR/MLIRContext.cpp
M mlir/lib/IR/TypeUtilities.cpp
M mlir/lib/Rewrite/ByteCode.cpp
M mlir/lib/TableGen/AttrOrTypeDef.cpp
M mlir/lib/Target/Cpp/TranslateToCpp.cpp
M mlir/lib/Target/SPIRV/Serialization/Serializer.cpp
M mlir/test/Dialect/LLVMIR/invalid.mlir
M mlir/test/Dialect/SPIRV/IR/structure-ops.mlir
M mlir/test/IR/file-metadata-resources.mlir
M mlir/test/lib/Dialect/Test/TestAttrDefs.td
M mlir/test/lib/Dialect/Test/TestAttributes.cpp
M mlir/test/lib/Dialect/Test/TestOps.td
M mlir/test/mlir-tblgen/attr-or-type-format.td
M mlir/test/mlir-tblgen/attrdefs.td
M mlir/test/mlir-tblgen/op-result.td
M mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp
M mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp
M mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
M mlir/unittests/IR/AttributeTest.cpp
Log Message:
-----------
[mlir] Remove types from attributes
This patch removes the `type` field from `Attribute` along with the
`Attribute::getType` accessor.
Going forward, this means that attributes in MLIR will no longer have
types as a first-class concept. This patch lays the groundwork to
incrementally remove or refactor code that relies on generic attributes
being typed. The immediate impact will be on attributes that rely on
`Attribute` containing a type, such as `IntegerAttr`,
`DenseElementsAttr`, and `ml_program::ExternAttr`, which will now need
to define a type parameter on their storage classes. This will save
memory as all other attribute kinds will no longer contain a type.
Moreover, it will not be possible to generically query the type of an
attribute directly. This patch provides an attribute interface
`TypedAttr` that implements only one method, `getType`, which can be
used to generically query the types of attributes that implement the
interface. This interface can be used to retain the concept of a "typed
attribute". The ODS-generated accessor for a `type` parameter
automatically implements this method.
Next steps will be to refactor the assembly formats of certain operations
that rely on `parseAttribute(type)` and `printAttributeWithoutType` to
remove special handling of type elision until `type` can be removed from
the dialect parsing hook entirely; and incrementally remove uses of
`TypedAttr`.
Reviewed By: lattner, rriddle, jpienaar
Differential Revision: https://reviews.llvm.org/D130092
More information about the All-commits
mailing list