#
3e6ae779 |
| 21-Nov-2023 |
Jie Fu <jiefu@tencent.com> |
[mlir] Non-void lambda does not return a value in all control paths in yieldReplacementForFusedProducer (NFC)
/llvm-project/mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp:703:5: error: non-v
[mlir] Non-void lambda does not return a value in all control paths in yieldReplacementForFusedProducer (NFC)
/llvm-project/mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp:703:5: error: non-void lambda does not return a value in all control paths [-Werror,-Wreturn-type] }; ^ 1 error generated.
show more ...
|
#
4a020018 |
| 20-Nov-2023 |
MaheshRavishankar <1663364+MaheshRavishankar@users.noreply.github.com> |
[NFC] Simplify the tiling implementation using cloning. (#72178)
The current implementation of tiling using `scf.for` is convoluted to
make sure that the destination passing style of the untiled pr
[NFC] Simplify the tiling implementation using cloning. (#72178)
The current implementation of tiling using `scf.for` is convoluted to
make sure that the destination passing style of the untiled program is
preserved. The addition of support to tile using `scf.forall` (adapted
from the transform operation in Linalg) in
https://github.com/llvm/llvm-project/pull/67083 used cloning of the
tiled operations to better streamline the implementation. This PR adapts
the other tiling methods to use a similar approach, making the
transformations (and handling destination passing style semantics) more
systematic.
---------
Co-authored-by: Abhishek-Varma <avarma094@gmail.com>
show more ...
|
Revision tags: llvmorg-17.0.5 |
|
#
98a6edd3 |
| 31-Oct-2023 |
Matthias Springer <me@m-sp.org> |
[mlir][Interfaces] `LoopLikeOpInterface`: Expose tied loop results (#70535)
Expose loop results, which correspond to the region iter_arg values that
are returned from the loop when there are no mor
[mlir][Interfaces] `LoopLikeOpInterface`: Expose tied loop results (#70535)
Expose loop results, which correspond to the region iter_arg values that
are returned from the loop when there are no more iterations. Exposing
loop results is optional because some loops (e.g., `scf.while`) do not
have a 1-to-1 mapping between region iter_args and op results.
Also add additional helper functions to query tied
results/iter_args/inits.
show more ...
|
Revision tags: llvmorg-17.0.4 |
|
#
3cd2a0bc |
| 28-Oct-2023 |
Matthias Springer <me@m-sp.org> |
[mlir][Interfaces] `LoopLikeOpInterface`: Add helpers to query tied inits/iter_args (#70408)
The `LoopLikeOpInterface` already has interface methods to query inits
and iter_args. This commit adds h
[mlir][Interfaces] `LoopLikeOpInterface`: Add helpers to query tied inits/iter_args (#70408)
The `LoopLikeOpInterface` already has interface methods to query inits
and iter_args. This commit adds helper functions to query tied
init/iter_arg pairs and removes the corresponding functions for
`scf::ForOp`.
show more ...
|
#
1c27899e |
| 20-Oct-2023 |
Adrian Kuegel <akuegel@google.com> |
[mlir][SCF] Pass result of getAsOpFoldResult to getBoundedTileSize.
A recent change modified the parameter tileSize from Value to OpFoldResult. Therefore we should call getAsOpFoldResult before pass
[mlir][SCF] Pass result of getAsOpFoldResult to getBoundedTileSize.
A recent change modified the parameter tileSize from Value to OpFoldResult. Therefore we should call getAsOpFoldResult before passing on the tileSize. Adjust a test regarding this new behavior.
show more ...
|
#
d871daea |
| 20-Oct-2023 |
MaheshRavishankar <1663364+MaheshRavishankar@users.noreply.github.com> |
[mlir][TilingInterface] Add scf::tileUsingSCFForallOp method to tile using the interface to generate `scf::forall`. (#67083)
Similar to `scf::tileUsingSCFForOp` that is a method that tiles
operatio
[mlir][TilingInterface] Add scf::tileUsingSCFForallOp method to tile using the interface to generate `scf::forall`. (#67083)
Similar to `scf::tileUsingSCFForOp` that is a method that tiles
operations that implement the `TilingInterface`, using `scf.for`
operations, this method introduces tiling of operations using
`scf.forall`. Most of this implementation is derived from
`linalg::tileToForallOp` method. Eventually that method will either be
deprecated or moved to use the method introduced here.
show more ...
|
Revision tags: llvmorg-17.0.3 |
|
#
8823e961 |
| 04-Oct-2023 |
Matthias Springer <me@m-sp.org> |
[mlir][ODS] Change `get...Mutable` to return `OpOperand &` for single operands (#66519)
The TableGen code generator now generates C++ code that returns a single
`OpOperand &` for `get...Mutable` of
[mlir][ODS] Change `get...Mutable` to return `OpOperand &` for single operands (#66519)
The TableGen code generator now generates C++ code that returns a single
`OpOperand &` for `get...Mutable` of operands that are not variadic and
not optional. `OpOperand::set`/`assign` can be used to set a value (same
as `MutableOperandRange::assign`). This is safer than
`MutableOperandRange` because only single values (and no longer
`ValueRange`) can be assigned.
E.g.:
```
// Assignment of multiple values to non-variadic operand.
// Before: Compiles, but produces invalid op.
// After: Compilation error.
extractSliceOp.getSourceMutable().assign({v1, v2});
```
show more ...
|
Revision tags: llvmorg-17.0.2 |
|
#
d2b7a8e8 |
| 27-Sep-2023 |
Adrian Kuegel <akuegel@google.com> |
[mlir] Partial revert of 93c42299bdb1ef094857ef2d065670af0695c26b
This part of the change was not NFC.
|
#
63086d6a |
| 27-Sep-2023 |
Matthias Springer <me@m-sp.org> |
[mlir][Interfaces] `LoopLikeOpInterface`: Add `replaceWithAdditionalYields` (#67121)
`affine::replaceForOpWithNewYields` and `replaceLoopWithNewYields` (for
"scf.for") are now interface methods and
[mlir][Interfaces] `LoopLikeOpInterface`: Add `replaceWithAdditionalYields` (#67121)
`affine::replaceForOpWithNewYields` and `replaceLoopWithNewYields` (for
"scf.for") are now interface methods and additional loop-carried
variables can now be added to "scf.for"/"affine.for" uniformly. (No more
`TypeSwitch` needed.)
Note: `scf.while` and other loops with loop-carried variables can
implement `replaceWithAdditionalYields`, but to keep this commit small,
that is not done in this commit.
show more ...
|
#
93c42299 |
| 26-Sep-2023 |
MaheshRavishankar <1663364+MaheshRavishankar@users.noreply.github.com> |
[mlir][TilingInterface] NFC code changes separated out from introduction of `scf::tileUsingSCFForallop`. (#67081)
This patch contains NFC changes that are precursor to the introduction
of `scf::til
[mlir][TilingInterface] NFC code changes separated out from introduction of `scf::tileUsingSCFForallop`. (#67081)
This patch contains NFC changes that are precursor to the introduction
of `scf::tileUsingSCFForallOp` method introduced in
https://github.com/llvm/llvm-project/pull/67083.
show more ...
|
#
0b2197b0 |
| 21-Sep-2023 |
Matthias Springer <me@m-sp.org> |
[mlir][Interfaces] Clean up `DestinationStyleOpInterface` (#67015)
* "init" operands are specified with `MutableOperandRange` (which gives
access to the underlying `OpOperand *`). No more magic num
[mlir][Interfaces] Clean up `DestinationStyleOpInterface` (#67015)
* "init" operands are specified with `MutableOperandRange` (which gives
access to the underlying `OpOperand *`). No more magic numbers.
* Remove most interface methods and make them helper functions. Only
`getInitsMutable` should be implemented.
* Provide separate helper functions for accessing mutable/immutable
operands (`OpOperand`/`Value`, in line with #66515): `getInitsMutable`
and `getInits` (same naming convention as auto-generated op accessors).
`getInputOperands` was not renamed because this function cannot return a
`MutableOperandRange` (because the operands are not necessarily
consecutive). `OpOperandVector` is no longer needed.
* The new `getDpsInits`/`getDpsInitsMutable` is more efficient than the
old `getDpsInitOperands` because no `SmallVector` is created. The new
functions return a range of operands.
* Fix a bug in `getDpsInputOperands`: out-of-bounds operands were
potentially returned.
show more ...
|
#
d69293c1 |
| 19-Sep-2023 |
Matthias Springer <me@m-sp.org> |
[mlir][SCF] `ForOp`: Remove `getIterArgNumberForOpOperand` (#66629)
This function was inconsistent with the remaining API because it
accepted `OpOperand &` that do not belong to the op. All the oth
[mlir][SCF] `ForOp`: Remove `getIterArgNumberForOpOperand` (#66629)
This function was inconsistent with the remaining API because it
accepted `OpOperand &` that do not belong to the op. All the other
functions assert. This helper function is also not really necessary, as
the iter_arg number is identical to the result number.
show more ...
|
Revision tags: llvmorg-17.0.1 |
|
#
6923a315 |
| 19-Sep-2023 |
Matthias Springer <me@m-sp.org> |
[mlir][IR] Change `MutableArrayRange` to enumerate `OpOperand &` (#66622)
In line with #66515, change `MutableArrayRange::begin`/`end` to
enumerate `OpOperand &` instead of `Value`. Also remove
`F
[mlir][IR] Change `MutableArrayRange` to enumerate `OpOperand &` (#66622)
In line with #66515, change `MutableArrayRange::begin`/`end` to
enumerate `OpOperand &` instead of `Value`. Also remove
`ForOp::getIterOpOperands`/`setIterArg`, which are now redundant.
Note: `MutableOperandRange` cannot be made a derived class of
`indexed_accessor_range_base` (like `OperandRange`), because
`MutableOperandRange::assign` can change the number of operands in the
range.
show more ...
|
#
170a25a7 |
| 19-Sep-2023 |
MaheshRavishankar <1663364+MaheshRavishankar@users.noreply.github.com> |
[mlir][TilingInterface] Make the tiling set tile sizes function use `OpFoldResult`. (#66566)
|
#
0f952cfe |
| 18-Sep-2023 |
Matthias Springer <me@m-sp.org> |
[mlir][IR] Change `MutableOperandRange::operator[]` to return an `OpOperand &` (#66515)
`operator[]` returns `OpOperand &` instead of `Value`.
* This allows users to get OpOperands by name instea
[mlir][IR] Change `MutableOperandRange::operator[]` to return an `OpOperand &` (#66515)
`operator[]` returns `OpOperand &` instead of `Value`.
* This allows users to get OpOperands by name instead of "magic" number.
E.g., `extractSliceOp->getOpOperand(0)` can be written as
`extractSliceOp.getSourceMutable()[0]`.
* `OperandRange` provides a read-only API to operands: `operator[]`
returns `Value`. `MutableOperandRange` now provides a mutable API:
`operator[]` returns `OpOperand &`, which can be used to set operands.
Note: The TableGen code generator could be changed to return `OpOperand
&` (instead of `MutableOperandRange`) for non-variadic and non-optional
arguments in a subsequent change. Then the `[0]` part in the above
example would no longer be necessary.
show more ...
|
Revision tags: llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3 |
|
#
2cc5f5d4 |
| 16-Aug-2023 |
Groverkss <groverkss@gmail.com> |
[mlir][Linalg] Implement tileReductionUsingScf for multiple reductions
This patch improves the reduction tiling for linalg to support multiple reduction dimensions.
Reviewed By: mravishankar
Diffe
[mlir][Linalg] Implement tileReductionUsingScf for multiple reductions
This patch improves the reduction tiling for linalg to support multiple reduction dimensions.
Reviewed By: mravishankar
Differential Revision: https://reviews.llvm.org/D158005
show more ...
|
Revision tags: llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init |
|
#
6596b0dd |
| 22-Jun-2023 |
Matthias Springer <me@m-sp.org> |
[mlir][tensor] Clean up tensor::DimOp usage
* Remove duplicate functions. `tensor::getMixedSize` and `tensor::getMixedSizes` should be used. * Use `tensor::getMixedSize` instead of `createOrFold<ten
[mlir][tensor] Clean up tensor::DimOp usage
* Remove duplicate functions. `tensor::getMixedSize` and `tensor::getMixedSizes` should be used. * Use `tensor::getMixedSize` instead of `createOrFold<tensor::DimOp>`. This is more efficient. `createOrFold` will create an op an immediately try to fold it. In case of a static dimension size, an attribute can be used directly.
Differential Revision: https://reviews.llvm.org/D153332
show more ...
|
Revision tags: llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4 |
|
#
5550c821 |
| 08-May-2023 |
Tres Popp <tpopp@google.com> |
[mlir] Move casting calls from methods to function calls
The MLIR classes Type/Attribute/Operation/Op/Value support cast/dyn_cast/isa/dyn_cast_or_null functionality through llvm's doCast functionali
[mlir] Move casting calls from methods to function calls
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
show more ...
|
Revision tags: llvmorg-16.0.3 |
|
#
4c48f016 |
| 20-Apr-2023 |
Matthias Springer <springerm@google.com> |
[mlir][Affine][NFC] Wrap dialect in "affine" namespace
This cleanup aligns the affine dialect with all the other dialects.
Differential Revision: https://reviews.llvm.org/D148687
|
Revision tags: llvmorg-16.0.2, llvmorg-16.0.1 |
|
#
f080f112 |
| 30-Mar-2023 |
Oleg Shyshkov <shyshkov@google.com> |
[mlir][scf] Create constants for tiling in parent with isolated region.
FuncOp is IsolatedFromAbove, so this change doesn't alter current behaviour, but the current code fails if the tile op is in a
[mlir][scf] Create constants for tiling in parent with isolated region.
FuncOp is IsolatedFromAbove, so this change doesn't alter current behaviour, but the current code fails if the tile op is in an op with IsolatedFromAbove trait.
An alternative would be to create constant in the same region where they're used a rely on CSE to figure out where to move them.
Differential Revision: https://reviews.llvm.org/D147273
show more ...
|
#
3af1c48c |
| 20-Mar-2023 |
Mahesh Ravishankar <ravishankarm@google.com> |
Changes to `SCFFuseProducerOfSliceResult` to also return the operations created during fusion.
This is follow up to https://reviews.llvm.org/D145133 that allows propogating information about ops tha
Changes to `SCFFuseProducerOfSliceResult` to also return the operations created during fusion.
This is follow up to https://reviews.llvm.org/D145133 that allows propogating information about ops that are fused back to the caller.
Reviewed By: hanchung
Differential Revision: https://reviews.llvm.org/D146254
show more ...
|
Revision tags: llvmorg-16.0.0, llvmorg-16.0.0-rc4 |
|
#
809e3d8c |
| 02-Mar-2023 |
Mahesh Ravishankar <ravishankarm@google.com> |
[mlir][TilingInterface] Modify `TilingInterface` methods to better return the state of the transformed IR.
Currently the `getTiledImplementation` and `generateResultTileValue` return just `SmallVect
[mlir][TilingInterface] Modify `TilingInterface` methods to better return the state of the transformed IR.
Currently the `getTiledImplementation` and `generateResultTileValue` return just `SmallVector<Operation *>` and `FailureOr<Value>`.
- For `getTiledImplementation` returning empty implies tiling wasnt done. There is also an implicit assumption that the tiled operation results correspond to the tiled values of the result of the original operation. This cannot handle cases where the tiled implementation might use multiple operations to compute the tiled value for the results of the untiled operation. Sometimes, the tiled operation might not directly give the tiled values, and might require casts, etc to get a replacement. - For `generateResultTileValue`, it is assumed that the op defining the returned `Value` is the operation that represents the tiled computation. Again presence of casts, etc violate this.
Instead make these methods return ``` struct TilingResult { SmallVector<Operation *> tiledOps; SmallVector<Value> tiledValues; }; ```
The `tiledOps` represent the operations generated that are relevant for subsequent transformations. The `tiledValues` represent the tiled values for the results of the original operation. This better transmits the state of the transformed IR.
As a consequence the following methods also return `FailureOr<TilingResult>` - `tensor::replaceExtractSliceWithTiledProducer` - `tensor::bubbleUpPadSlice`
Differential Revision: https://reviews.llvm.org/D145133
show more ...
|
#
a0a76804 |
| 15-Mar-2023 |
Jakub Kuderski <kubak@google.com> |
[ADT] Allow `llvm::enumerate` to enumerate over multiple ranges
This does not work by a mere composition of `enumerate` and `zip_equal`, because C++17 does not allow for recursive expansion of struc
[ADT] Allow `llvm::enumerate` to enumerate over multiple ranges
This does not work by a mere composition of `enumerate` and `zip_equal`, because C++17 does not allow for recursive expansion of structured bindings.
This implementation uses `zippy` to manage the iteratees and adds the stream of indices as the first zipped range. Because we have an upfront assertion that all input ranges are of the same length, we only need to check if the second range has ended during iteration.
As a consequence of using `zippy`, `enumerate` will now follow the reference and lifetime semantics of the `zip*` family of functions. The main difference is that `enumerate` exposes each tuple of references through a new tuple-like type `enumerate_result`, with the familiar `.index()` and `.value()` member functions.
Because the `enumerate_result` returned on dereference is a temporary, enumeration result can no longer be used through an lvalue ref.
Reviewed By: dblaikie, zero9178
Differential Revision: https://reviews.llvm.org/D144503
show more ...
|
#
1cff4cbd |
| 13-Mar-2023 |
Nicolas Vasilache <nicolas.vasilache@gmail.com> |
[mlir][Transform] NFC - Various API cleanups and use RewriterBase in lieu of PatternRewriter
Depends on: D145685
Differential Revision: https://reviews.llvm.org/D145977
|
Revision tags: llvmorg-16.0.0-rc3, llvmorg-16.0.0-rc2 |
|
#
5c9013e2 |
| 28-Jan-2023 |
Kazu Hirata <kazu@google.com> |
Use std::optional instead of llvm::Optional (NFC)
|