llvm-project/mlir
Jeff Niu e179532284 [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
2022-07-31 20:01:31 -04:00
..
benchmark/python [NFC] Remove obsolete all_passes_registration from integration tests. 2022-07-16 18:18:43 -07:00
cmake/modules [CMake] Fix add_subdirectory llvm builds 2022-07-26 11:24:23 +02:00
docs [mlir] Remove types from attributes 2022-07-31 20:01:31 -04:00
examples Replace Optional::hasValue with has_value or operator bool. NFC 2022-07-29 10:57:25 -07:00
include [mlir] Remove types from attributes 2022-07-31 20:01:31 -04:00
lib [mlir] Remove types from attributes 2022-07-31 20:01:31 -04:00
python Adding a new variant of DepthwiseConv2D 2022-07-21 14:36:57 -04:00
test [mlir] Remove types from attributes 2022-07-31 20:01:31 -04:00
tools [mlir] Remove types from attributes 2022-07-31 20:01:31 -04:00
unittests [mlir] Remove types from attributes 2022-07-31 20:01:31 -04:00
utils [mlir][spirv] Rename spv.ocl to spv.cl. NFC. 2022-07-20 17:46:45 -04:00
.clang-format [mlir] Add missing newline at end of .clang-format file 2022-06-14 23:59:00 -07:00
.clang-tidy Enable readability-redundant-smartptr-get in MLIR local clang-tidy config 2022-01-08 20:07:11 +00:00
CMakeLists.txt [cmake] Don't export `LLVM_TOOLS_INSTALL_DIR` anymore 2022-07-21 19:04:00 +00:00
LICENSE.TXT
README.md

README.md

Multi-Level Intermediate Representation

See https://mlir.llvm.org/ for more information.