[all-commits] [llvm/llvm-project] 5e118f: Introduce MLIR Op Properties
Mehdi Amini via All-commits
all-commits at lists.llvm.org
Mon May 1 23:17:00 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 5e118f933b6590cecd7f1afb30845a1594bc4a5d
https://github.com/llvm/llvm-project/commit/5e118f933b6590cecd7f1afb30845a1594bc4a5d
Author: Mehdi Amini <joker.eph at gmail.com>
Date: 2023-05-01 (Mon, 01 May 2023)
Changed paths:
M mlir/docs/LangRef.md
M mlir/include/mlir-c/Interfaces.h
M mlir/include/mlir/Conversion/LLVMCommon/Pattern.h
M mlir/include/mlir/IR/DialectBase.td
M mlir/include/mlir/IR/ExtensibleDialect.h
A mlir/include/mlir/IR/ODSSupport.h
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/Operation.h
M mlir/include/mlir/IR/OperationSupport.h
M mlir/include/mlir/Interfaces/InferTypeOpInterface.h
M mlir/include/mlir/Interfaces/InferTypeOpInterface.td
M mlir/include/mlir/TableGen/Argument.h
M mlir/include/mlir/TableGen/Class.h
M mlir/include/mlir/TableGen/Dialect.h
M mlir/include/mlir/TableGen/Operator.h
A mlir/include/mlir/TableGen/Property.h
M mlir/include/mlir/Transforms/DialectConversion.h
M mlir/include/mlir/Transforms/OneToNTypeConversion.h
M mlir/lib/AsmParser/Parser.cpp
M mlir/lib/Bindings/Python/IRInterfaces.cpp
M mlir/lib/CAPI/IR/IR.cpp
M mlir/lib/CAPI/Interfaces/Interfaces.cpp
M mlir/lib/Dialect/GPU/Transforms/AsyncRegionRewriter.cpp
M mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
M mlir/lib/Dialect/MemRef/Transforms/ExpandStridedMetadata.cpp
M mlir/lib/Dialect/SCF/IR/SCF.cpp
M mlir/lib/Dialect/Shape/IR/Shape.cpp
M mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
M mlir/lib/Dialect/Tosa/Transforms/TosaDecomposeTransposeConv.cpp
M mlir/lib/Dialect/Tosa/Transforms/TosaInferShapes.cpp
M mlir/lib/Dialect/Vector/IR/VectorOps.cpp
M mlir/lib/IR/AsmPrinter.cpp
M mlir/lib/IR/CMakeLists.txt
M mlir/lib/IR/MLIRContext.cpp
A mlir/lib/IR/ODSSupport.cpp
M mlir/lib/IR/Operation.cpp
M mlir/lib/IR/OperationSupport.cpp
M mlir/lib/Interfaces/InferTypeOpInterface.cpp
M mlir/lib/Rewrite/ByteCode.cpp
M mlir/lib/TableGen/CMakeLists.txt
M mlir/lib/TableGen/CodeGenHelpers.cpp
M mlir/lib/TableGen/Dialect.cpp
M mlir/lib/TableGen/Operator.cpp
A mlir/lib/TableGen/Property.cpp
M mlir/test/Bytecode/versioning/versioned_attr.mlir
M mlir/test/Bytecode/versioning/versioned_op.mlir
M mlir/test/Conversion/OneToNTypeConversion/one-to-n-type-conversion.mlir
M mlir/test/Conversion/OneToNTypeConversion/scf-structural-one-to-n-type-conversion.mlir
M mlir/test/Dialect/Shape/invalid.mlir
M mlir/test/Dialect/Tosa/invalid.mlir
M mlir/test/IR/greedy-pattern-rewriter-driver.mlir
M mlir/test/IR/invalid.mlir
M mlir/test/IR/parser.mlir
A mlir/test/IR/properties.mlir
M mlir/test/IR/test-fold-adaptor.mlir
M mlir/test/IR/test-manual-cpp-fold.mlir
M mlir/test/IR/traits.mlir
M mlir/test/Interfaces/InferIntRangeInterface/infer-int-range-test-ops.mlir
M mlir/test/Transforms/decompose-call-graph-types.mlir
M mlir/test/Transforms/test-legalizer.mlir
M mlir/test/Transforms/test-operation-folder.mlir
M mlir/test/lib/Dialect/Test/TestDialect.cpp
M mlir/test/lib/Dialect/Test/TestDialect.h
M mlir/test/lib/Dialect/Test/TestDialect.td
M mlir/test/lib/Dialect/Test/TestOps.td
M mlir/test/lib/Dialect/Test/TestPatterns.cpp
M mlir/test/mlir-tblgen/constraint-unique.td
M mlir/test/mlir-tblgen/interfaces-as-constraints.td
M mlir/test/mlir-tblgen/op-attribute.td
M mlir/test/mlir-tblgen/op-decl-and-defs.td
M mlir/test/mlir-tblgen/op-format.td
M mlir/test/mlir-tblgen/op-result.td
M mlir/test/mlir-tblgen/pattern.mlir
M mlir/test/mlir-tblgen/return-types.mlir
M mlir/test/python/python_test_ops.td
M mlir/tools/mlir-tblgen/FormatGen.cpp
M mlir/tools/mlir-tblgen/FormatGen.h
M mlir/tools/mlir-tblgen/OpClass.cpp
M mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
M mlir/tools/mlir-tblgen/OpFormatGen.cpp
M mlir/unittests/Debug/FileLineColLocBreakpointManagerTest.cpp
M mlir/unittests/IR/AdaptorTest.cpp
M mlir/unittests/IR/CMakeLists.txt
A mlir/unittests/IR/OpPropertiesTest.cpp
M mlir/unittests/IR/OperationSupportTest.cpp
M mlir/unittests/Transforms/DialectConversion.cpp
Log Message:
-----------
Introduce MLIR Op Properties
This new features enabled to dedicate custom storage inline within operations.
This storage can be used as an alternative to attributes to store data that is
specific to an operation. Attribute can also be stored inside the properties
storage if desired, but any kind of data can be present as well. This offers
a way to store and mutate data without uniquing in the Context like Attribute.
See the OpPropertiesTest.cpp for an example where a struct with a
std::vector<> is attached to an operation and mutated in-place:
struct TestProperties {
int a = -1;
float b = -1.;
std::vector<int64_t> array = {-33};
};
More complex scheme (including reference-counting) are also possible.
The only constraint to enable storing a C++ object as "properties" on an
operation is to implement three functions:
- convert from the candidate object to an Attribute
- convert from the Attribute to the candidate object
- hash the object
Optional the parsing and printing can also be customized with 2 extra
functions.
A new options is introduced to ODS to allow dialects to specify:
let usePropertiesForAttributes = 1;
When set to true, the inherent attributes for all the ops in this dialect
will be using properties instead of being stored alongside discardable
attributes.
The TestDialect showcases this feature.
Another change is that we introduce new APIs on the Operation class
to access separately the inherent attributes from the discardable ones.
We envision deprecating and removing the `getAttr()`, `getAttrsDictionary()`,
and other similar method which don't make the distinction explicit, leading
to an entirely separate namespace for discardable attributes.
Recommit d572cd1b067f after fixing python bindings build.
Differential Revision: https://reviews.llvm.org/D141742
More information about the All-commits
mailing list