summaryrefslogtreecommitdiff
path: root/mlir/lib/Dialect/Utils/StructuredOpsUtils.cpp
AgeCommit message (Collapse)Author
2025-03-20[mlir] Use *Set::insert_range (NFC) (#132326)Kazu Hirata
DenseSet, SmallPtrSet, SmallSet, SetVector, and StringSet recently gained C++23-style insert_range. This patch replaces: Dest.insert(Src.begin(), Src.end()); with: Dest.insert_range(Src); This patch does not touch custom begin like succ_begin for now.
2024-04-07[mlir][linalg]: Fixed possible memory leak in cloneToCollapsedOp (#87595)Aviad Cohen
* Direct call to `clone` function leads to memory leak. Instead, we should use `RewriterBase` clone function instead.
2023-10-26Add `isBatchVecmat` utilities for `linalg.batch_vecmat` (#70284)bjacob
`linalg.batch_vecmat` was just added in https://github.com/llvm/llvm-project/pull/70218, but I forgot then to add the standard `isBatchVecmat` utilities
2023-10-18[mlir] Add ContractionOpInterface utility functions for vector matrix ↵NatashaKnk
multiplication (#68945)
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
2023-03-20[mlir][Tensor] Fix build error due to missing `<>` in D146440.Mahesh Ravishankar
Differential Revision: https://reviews.llvm.org/D146458
2023-03-20[mlir][Tensor] Avoid dropping attributes for `tensor.pad` operations during ↵Mahesh Ravishankar
canonicalization. Reviewed By: hanchung Differential Revision: https://reviews.llvm.org/D146440
2023-01-12[mlir] Add operations to BlockAndValueMapping and rename it to IRMappingJeff Niu
The patch adds operations to `BlockAndValueMapping` and renames it to `IRMapping`. When operations are cloned, old operations are mapped to the cloned operations. This allows mapping from an operation to a cloned operation. Example: ``` Operation *opWithRegion = ... Operation *opInsideRegion = &opWithRegion->front().front(); IRMapping map Operation *newOpWithRegion = opWithRegion->clone(map); Operation *newOpInsideRegion = map.lookupOrNull(opInsideRegion); ``` Migration instructions: All includes to `mlir/IR/BlockAndValueMapping.h` should be replaced with `mlir/IR/IRMapping.h`. All uses of `BlockAndValueMapping` need to be renamed to `IRMapping`. Reviewed By: rriddle, mehdi_amini Differential Revision: https://reviews.llvm.org/D139665
2022-11-23[mlir] Remove clone methods from DPS interface.Alexander Belyaev
Differential Revision: https://reviews.llvm.org/D138586
2022-09-26[mlir] Add IteratorType enum to StructuredOpsUtils.Oleg Shyshkov
Summary: Use the new enum in TilingIterface and verify that `iterator_type` attribute in LinalgOp interface is compatible with the enum values. Later IteratorType enum will be used in LinalgInterface to replace the current `iterator_type` attribute array of string. Existing enums in Linalg are moved into a separate td file and tablegen build target. This is necessary, have one I32EnumAttr in a shared space that generated enum class definition and EnumAttrs is dialect-specific location. Otherwise there might be a conflict that I32EnumAttr generates enum definitions in multiple places. Differential Revision: https://reviews.llvm.org/D134634
2021-02-18Reland "[MLIR] Make structured op tests permutation invariant"Geoffrey Martin-Noble
Relands with fix swapping DEPENDS for LINK_LIBS. This reverts commit cd8cc00b9e2b2b2b10270f7485eb47759bc54cc1. Differential Revision: https://reviews.llvm.org/D97011
2021-02-19Revert "[MLIR] Make structured op tests permutation invariant"Mehdi Amini
This reverts commit b9ff67099ad6da931976e66f1510c5af2558a86e. The build is broken with -DBUILD_SHARED_LIBS=ON
2021-02-18[MLIR] Make structured op tests permutation invariantGeoffrey Martin-Noble
Extracts the relevant dimensions from the map under test to build up the maps to test against in a permutation-invariant way. This also includes a fix to the indexing maps used by isColumnMajorMatmul. The maps as currently written do not describe a column-major matmul. The linalg named op column_major_matmul has the correct maps (and notably fails the current test). If `C = matmul(A, B)` we want an operation that given A in column major format and B in column major format produces C in column major format. Given that for a matrix, faux column major is just transpose. `column_major_matmul(transpose(A), transpose(B)) = transpose(C)`. If `A` is `NxK` and `B` is `KxM`, then `C` is `NxM`, so `transpose(A)` is `KxN`, `transpose(B)` is `MxK` and `transpose(C)` is `MxN`, not `NxM` as these maps currently have. Reviewed By: nicolasvasilache Differential Revision: https://reviews.llvm.org/D96984