summaryrefslogtreecommitdiff
path: root/mlir/test/lib/Dialect/Shape/TestShapeFunctions.cpp
AgeCommit message (Collapse)Author
2023-09-12Update some uses of `getAttr()` to be explicit about Inherent vs Discardable ↵Mehdi Amini
(NFC)
2023-05-12[mlir] Move casting calls from methods to function callsTres Popp
The MLIR classes Type/Attribute/Operation/Op/Value support cast/dyn_cast/isa/dyn_cast_or_null functionality through llvm's doCast functionality in addition to defining methods with the same name. This change begins the migration of uses of the method to the corresponding function call as has been decided as more consistent. Note that there still exist classes that only define methods directly, such as AffineExpr, and this does not include work currently to support a functional cast/isa call. Caveats include: - This clang-tidy script probably has more problems. - This only touches C++ code, so nothing that is being generated. Context: - https://mlir.llvm.org/deprecation/ at "Use the free function variants for dyn_cast/cast/isa/…" - Original discussion at https://discourse.llvm.org/t/preferred-casting-style-going-forward/68443 Implementation: This first patch was created with the following steps. The intention is to only do automated changes at first, so I waste less time if it's reverted, and so the first mass change is more clear as an example to other teams that will need to follow similar steps. Steps are described per line, as comments are removed by git: 0. Retrieve the change from the following to build clang-tidy with an additional check: https://github.com/llvm/llvm-project/compare/main...tpopp:llvm-project:tidy-cast-check 1. Build clang-tidy 2. Run clang-tidy over your entire codebase while disabling all checks and enabling the one relevant one. Run on all header files also. 3. Delete .inc files that were also modified, so the next build rebuilds them to a pure state. 4. Some changes have been deleted for the following reasons: - Some files had a variable also named cast - Some files had not included a header file that defines the cast functions - Some files are definitions of the classes that have the casting methods, so the code still refers to the method instead of the function without adding a prefix or removing the method declaration at the same time. ``` ninja -C $BUILD_DIR clang-tidy run-clang-tidy -clang-tidy-binary=$BUILD_DIR/bin/clang-tidy -checks='-*,misc-cast-functions'\ -header-filter=mlir/ mlir/* -fix rm -rf $BUILD_DIR/tools/mlir/**/*.inc git restore mlir/lib/IR mlir/lib/Dialect/DLTI/DLTI.cpp\ mlir/lib/Dialect/Complex/IR/ComplexDialect.cpp\ mlir/lib/**/IR/\ mlir/lib/Dialect/SparseTensor/Transforms/SparseVectorization.cpp\ mlir/lib/Dialect/Vector/Transforms/LowerVectorMultiReduction.cpp\ mlir/test/lib/Dialect/Test/TestTypes.cpp\ mlir/test/lib/Dialect/Transform/TestTransformDialectExtension.cpp\ mlir/test/lib/Dialect/Test/TestAttributes.cpp\ mlir/unittests/TableGen/EnumsGenTest.cpp\ mlir/test/python/lib/PythonTestCAPI.cpp\ mlir/include/mlir/IR/ ``` Differential Revision: https://reviews.llvm.org/D150123
2022-04-22[mlir] Add shape.funcJacques Pienaar
Add shape func op for use (primarily) in shape function_library op. Allows setting default dialect for some simpler authoring. This is a minimal version of the ops needed. Differential Revision: https://reviews.llvm.org/D124055
2022-04-18[mlir:NFC] Remove the forward declaration of FuncOp in the mlir namespaceRiver Riddle
FuncOp has been moved to the `func` namespace for a little over a month, the using directive can be dropped now.
2022-04-04[mlir] Rework the implementation of TypeIDRiver Riddle
This commit restructures how TypeID is implemented to ideally avoid the current problems related to shared libraries. This is done by changing the "implicit" fallback path to use the name of the type, instead of using a static template variable (which breaks shared libraries). The major downside to this is that it adds some additional initialization costs for the implicit path. Given the use of type names for uniqueness in the fallback, we also no longer allow types defined in anonymous namespaces to have an implicit TypeID. To simplify defining an ID for these classes, a new `MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID` macro was added to allow for explicitly defining a TypeID directly on an internal class. To help identify when types are using the fallback, `-debug-only=typeid` can be used to log which types are using implicit ids. This change generally only requires changes to the test passes, which are all defined in anonymous namespaces, and thus can't use the fallback any longer. Differential Revision: https://reviews.llvm.org/D122775
2021-12-08Adjust "end namespace" comment in MLIR to match new agree'd coding styleMehdi Amini
See D115115 and this mailing list discussion: https://lists.llvm.org/pipermail/llvm-dev/2021-December/154199.html Differential Revision: https://reviews.llvm.org/D115309
2021-11-16[mlir][NFC] Replace references to Identifier with StringAttrRiver Riddle
This is part of the replacement of Identifier with StringAttr. Differential Revision: https://reviews.llvm.org/D113953
2021-06-16Migrate MLIR test passes to the new registration APIMehdi Amini
Make sure they all define getArgument()/getDescription(). Depends On D104421 Differential Revision: https://reviews.llvm.org/D104426
2021-02-09[mlir][IR] Remove the concept of `OperationProperties`River Riddle
These properties were useful for a few things before traits had a better integration story, but don't really carry their weight well these days. Most of these properties are already checked via traits in most of the code. It is better to align the system around traits, and improve the performance/cost of traits in general. Differential Revision: https://reviews.llvm.org/D96088
2021-01-06[mlir] Remove a number of methods from mlir::OpState that just forward to ↵Christian Sigg
mlir::Operation. All call sites have been converted in previous changes.
2020-12-31[mlir][shape] Add shape.lib attributeJacques Pienaar
Enable querying shape function library ops from the module. Currently supports singular or array of them (as long as array has all unique ops in mappings). The preferred canonical form would have one library, but given the invariant on the mapping, this can easily be achieved by a simple merging pass. Preferred the attribute approach vs naming convention as these could be added in multiple different ways.
2020-12-09[mlir] Use mlir::OpState::operator->() to get to methods of mlir::Operation. ↵Christian Sigg
This is a preparation step to remove the corresponding methods from OpState. Reviewed By: silvas, rriddle Differential Revision: https://reviews.llvm.org/D92878
2020-11-29[mlir] Add a shape function library opJacques Pienaar
Op with mapping from ops to corresponding shape functions for those op in the library and mechanism to associate shape functions to functions. The mapping of operand to shape function is kept separate from the shape functions themselves as the operation is associated to the shape function and not vice versa, and one could have a common library of shape functions that can be used in different contexts. Use fully qualified names and require a name for shape fn lib ops for now and an explicit print/parse (based around the generated one & GPU module op ones). This commit reverts d9da4c3e73720badfcac5c0dc63c0285bb690770. Fixes missing headers (don't know how that was working locally). Differential Revision: https://reviews.llvm.org/D91672
2020-11-29Revert "[mlir] Add a shape function library op"Mehdi Amini
This reverts commit 6dd9596b19d7679c562f8e866be6d0c3d7c21994. Build is broken.
2020-11-28[mlir] Add a shape function library opJacques Pienaar
Op with mapping from ops to corresponding shape functions for those op in the library and mechanism to associate shape functions to functions. The mapping of operand to shape function is kept separate from the shape functions themselves as the operation is associated to the shape function and not vice versa, and one could have a common library of shape functions that can be used in different contexts. Use fully qualified names and require a name for shape fn lib ops for now and an explicit print/parse (based around the generated one & GPU module op ones). Differential Revision: https://reviews.llvm.org/D91672