summaryrefslogtreecommitdiff
path: root/mlir/lib/Dialect/MemRef/Transforms/MultiBuffer.cpp
AgeCommit message (Collapse)Author
2025-08-26[mlir][MemRef] Address TODO to use early_inc to simplify elimination of uses ↵Samarth Narang
(NFC) (#155123)
2025-07-24[mlir][NFC] update `mlir/Dialect` create APIs (18/n) (#149925)Maksim Levental
See https://github.com/llvm/llvm-project/pull/147168 for more info.
2025-07-12[llvm] Remove unused includes (NFC) (#148342)Kazu Hirata
These are identified by misc-include-cleaner. I've filtered out those that break builds. Also, I'm staying away from llvm-config.h, config.h, and Compiler.h, which likely cause platform- or compiler-specific build failures.
2025-02-14[MLIR][NFC] Return MemRefType in memref.subview return type inference ↵Tomás Longeri
functions (#120024) Avoids the need for cast, and matches the extra build functions, which take a `MemRefType`
2024-01-17[mlir][IR] Rename "update root" to "modify op" in rewriter API (#78260)Matthias Springer
This commit renames 4 pattern rewriter API functions: * `updateRootInPlace` -> `modifyOpInPlace` * `startRootUpdate` -> `startOpModification` * `finalizeRootUpdate` -> `finalizeOpModification` * `cancelRootUpdate` -> `cancelOpModification` The term "root" is a misnomer. The root is the op that a rewrite pattern matches against (https://mlir.llvm.org/docs/PatternRewriter/#root-operation-name-optional). A rewriter must be notified of all in-place op modifications, not just in-place modifications of the root (https://mlir.llvm.org/docs/PatternRewriter/#pattern-rewriter). The old function names were confusing and have contributed to various broken rewrite patterns. Note: The new function names use the term "modify" instead of "update" for consistency with the `RewriterBase::Listener` terminology (`notifyOperationModified`).
2023-09-19[mlir][Interfaces] `LoopLikeOpInterface`: Support ops with multiple regions ↵Matthias Springer
(#66754) This commit implements `LoopLikeOpInterface` on `scf.while`. This enables LICM (and potentially other transforms) on `scf.while`. `LoopLikeOpInterface::getLoopBody()` is renamed to `getLoopRegions` and can now return multiple regions. Also fix a bug in the default implementation of `LoopLikeOpInterface::isDefinedOutsideOfLoop()`, which returned "false" for some values that are defined outside of the loop (in a nested op, in such a way that the value does not dominate the loop). This interface is currently only used for LICM and there is no way to trigger this bug, so no test is added.
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-04-20[mlir][Affine][NFC] Wrap dialect in "affine" namespaceMatthias Springer
This cleanup aligns the affine dialect with all the other dialects. Differential Revision: https://reviews.llvm.org/D148687
2023-03-28[mlir][MemRef] Move transform related functions in Transforms.hQuentin Colombet
NFC
2023-03-01[mlir][MemRef] Rewrite multi-buffering with proper composable abstractionsNicolas Vasilache
Rewrite and document multi-buffering properly: 1. Use IndexingUtils / StaticValueUtils instead of duplicating functionality 2. Properly plumb RewriterBase through. 3. Add support 4. Better debug messages. This revision is otherwise almost NFC, if it weren't for the extra DeallocOp support that would previoulsy make multi-buffering fail. Depends on: D145036 Differential Revision: https://reviews.llvm.org/D145055
2023-02-17[mlir] add option to multi-bufferingThomas Raoux
Allow user to apply multi-buffering transformation for cases where proving that there is no loop carried dependency is not trivial. In this case user needs to ensure that the data are written and read in the same iteration otherwise the result is incorrect. Differential Revision: https://reviews.llvm.org/D144227
2023-02-16[mlir][MemRef] NFC - Add debug information to MultiBuffer.cppNicolas Vasilache
2022-12-17mlir/tblgen: use std::optional in generationRamkumar Ramachandra
This is part of an effort to migrate from llvm::Optional to std::optional. This patch changes the way mlir-tblgen generates .inc files, and modifies tests and documentation appropriately. It is a "no compromises" patch, and doesn't leave the user with an unpleasant mix of llvm::Optional and std::optional. A non-trivial change has been made to ControlFlowInterfaces to split one constructor into two, relating to a build failure on Windows. See also: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716 Signed-off-by: Ramkumar Ramachandra <r@artagnon.com> Differential Revision: https://reviews.llvm.org/D138934
2022-11-25[MLIR] Adopt `DenseI64ArrayAttr` in tensor, memref and linalg transformLorenzo Chelini
This commit is a first step toward removing inconsistencies between dynamic and static attributes (i64 v. index) by dropping `I64ArrayAttr` and using `DenseI64ArrayAttr` in Tensor, Memref and Linalg Transform ops. In Linalg Transform ops only `TileToScfForOp` and `TileOp` have been updated. See related discussion: https://discourse.llvm.org/t/rfc-inconsistency-between-dynamic-and-static-attributes-i64-v-index/66612/1 Reviewed By: nicolasvasilache Differential Revision: https://reviews.llvm.org/D138567
2022-10-12Apply clang-tidy fixes for llvm-else-after-return in MultiBuffer.cpp (NFC)Mehdi Amini
2022-10-03[mlir][memref] Extend multi-buffering transformKirsten Lee
Extend multi-buffering to simplify the affine map created if any of its operands are constants. This avoids downstream problems where more complex affine.apply operations cannot be expanded. Transfer attributes from the old allocation to the new allocation. Reviewed By: ThomasRaoux Differential Revision: https://reviews.llvm.org/D134894
2022-09-28[mlir][transform] Add multi-buffering to the transform dialectKirsten Lee
Add the plumbing necessary to call the memref dialect's multiBuffer function. This will allow separation between choosing which buffers to multi-buffer and the actual transform. Alter the multibuffer function to return the newly created allocation if multi-buffering succeeds. This is necessary to communicate with the transform dialect hooks what allocation multi-buffering created. Reviewed By: ftynse, nicolasvasilache Differential Revision: https://reviews.llvm.org/D133985
2022-07-10[mlir] Flip accessors to prefixed form (NFC)Jacques Pienaar
Another mechanical sweep to keep diff small for flip to _Prefixed.
2022-07-05[mlir][memref] Improve type inference for rank-reducing subviewsMatthias Springer
The result shape of a rank-reducing subview cannot be inferred in the general case. Just the result rank is not enough. The only thing that we can infer is the layout map. This change also improves the bufferization patterns of tensor.extract_slice and tensor.insert_slice to fully support rank-reducing operations. Differential Revision: https://reviews.llvm.org/D129144
2022-02-24[mlir][memref] Add transformation to do loop multi-bufferingThomas Raoux
This transformation is useful to break dependency between consecutive loop iterations by increasing the size of a temporary buffer. This is usually combined with heavy software pipelining. Differential Revision: https://reviews.llvm.org/D119406