- Apr 05, 2021
-
-
MaheshRavishankar authored
The moved `populate` methods are only relevant to Linalg operations. So they are better of in `linalg` namespace. Also rename `populateLinalgTensorOpsFusionPatterns` to `populateElementwiseOpsFusionPatterns`. This makes the scope of these patterns explicit and disambiguates it with fusion on tensors using tile + fuse. Differential Revision: https://reviews.llvm.org/D99819
-
- Apr 02, 2021
-
-
Lei Zhang authored
This commit add utility functions for creating push constant storage variable and loading values from it. Along the way, performs some clean up: * Deleted `setABIAttrs`, which is just a 4-liner function with one user. * Moved `SPIRVConverstionTarget` into `mlir` namespace, to be consistent with `SPIRVTypeConverter` and `LLVMConversionTarget`. Reviewed By: mravishankar Differential Revision: https://reviews.llvm.org/D99725
-
Aart Bik authored
Rationale: Small indices and values, when allowed by the required range of the input tensors, can reduce the memory footprint of sparse tensors even more. Note, however, that we must be careful zero extending the values (since sparse tensors never use negatives for indexing), but LLVM treats the index type as signed in most memory operations (like the scatter and gather). This CL dots all the i's in this regard. Reviewed By: bixia Differential Revision: https://reviews.llvm.org/D99777
-
- Apr 01, 2021
-
-
Aden Grue authored
Differential Revision: https://reviews.llvm.org/D99229
-
- Mar 31, 2021
-
-
Matthias Springer authored
This is in preparation for adding a new "mask" operand. The existing "masked" attribute was used to specify dimensions that may be out-of-bounds. Such transfers can be lowered to masked load/stores. The new "in_bounds" attribute is used to specify dimensions that are guaranteed to be within bounds. (Semantics is inverted.) Differential Revision: https://reviews.llvm.org/D99639
-
Nicolas Vasilache authored
This revision adds support to properly add the body of registered builtin named linalg ops. At this time, indexing_map and iterator_type support is still missing so the op is not executable yet. Differential Revision: https://reviews.llvm.org/D99578
-
Alexander Belyaev authored
This reverts commit 883912ab.
-
- Mar 30, 2021
-
-
Inho Seo authored
This verification is to check if the indices for static shaped operands on linalgOps access out of bound memory or not. For dynamic shaped operands, we would be able to check it on runtime stage. Found several invalid Linalg ops testcases, and fixed them. Reviewed By: hanchung Differential Revision: https://reviews.llvm.org/D98390
-
- Mar 29, 2021
-
-
MaheshRavishankar authored
Differential Revision: https://reviews.llvm.org/D99533
-
MaheshRavishankar authored
A new `InterfaceMethod` is added to `InferShapedTypeOpInterface` that allows an operation to return the `Value`s for each dim of its results. It is intended for the case where the `Value` returned for each dim is computed using the operands and operation attributes. This interface method is for cases where the result dim of an operation can be computed independently, and it avoids the need to aggregate all dims of a result into a single shape value. This also implies that this is not suitable for cases where the result type is unranked (for which the existing interface methods is to be used). Also added is a canonicalization pattern that uses this interface and resolves the shapes of the output in terms of the shapes of the inputs. Moving Linalg ops to use this interface, so that many canonicalization patterns implemented for individual linalg ops to achieve the same result can be removed in favor of the added canonicalization pattern. Differential Revision: https://reviews.llvm.org/D97887
-
MaheshRavishankar authored
Subtensor operations that are taking a slice out of a tensor that is unit-extent along a dimension can be rewritten to drop that dimension. Differential Revision: https://reviews.llvm.org/D99226
-
MaheshRavishankar authored
Drop usage of `emitRemark` and use `notifyMatchFailure` instead to avoid unnecessary spew during compilation. Differential Revision: https://reviews.llvm.org/D99485
-
thomasraoux authored
Convert transfer_read ops with permutation maps into simpler transfer_read with minority map + vector.braodcast and vector.transpose. And transfer_read with leading dimensions broacast into transfer_read of lower rank. Differential Revision: https://reviews.llvm.org/D99019
-
Frederik Gossen authored
Differential Revision: https://reviews.llvm.org/D99161
-
Alexander Belyaev authored
This reverts commit 06b03800. Until some kind of support for region args is added.
-
Julian Gross authored
Add a new clone operation to the memref dialect. This operation implicitly copies data from a source buffer to a new buffer. In contrast to the linalg.copy operation, this operation does not accept a target buffer as an argument. Instead, this operation performs a conceptual allocation which does not need to be performed manually. Furthermore, this operation resolves the dependency from the linalg-dialect in the BufferDeallocation pass. In addition, we also extended the canonicalization patterns to fold clone operations. The copy removal pass has been removed. Differential Revision: https://reviews.llvm.org/D99172
-
KareemErgawy-TomTom authored
This patch folds the following pattern: ``` %arg0 = ... %0 = sexti %arg0 : i1 to i8 %1 = trunci %0 : i8 to i1 ``` into just `%arg0`. Reviewed By: mehdi_amini Differential Revision: https://reviews.llvm.org/D99464
-
- Mar 27, 2021
-
-
KareemErgawy-TomTom authored
This patch folds the following pattern: ``` %arg0 = ... %0 = zexti %arg0 : i1 to i8 %1 = trunci %0 : i8 to i1 ``` into just `%arg0`. Reviewed By: mehdi_amini Differential Revision: https://reviews.llvm.org/D99453
-
Jacques Pienaar authored
Now that NoTerminator is possible this op can be removed/it was only needed structurally before. NFC.
-
- Mar 25, 2021
-
-
Alexander Belyaev authored
Folds away TiledLoopOp output tensors when the following conditions are met: * result of `linalg.tiled_loop` has no uses * output tensor is the argument of `linalg.yield` Example: ``` %0 = linalg.tiled_loop ... outs (%out, %out_buf:tensor<...>, memref<...>) { ... linalg.yield %out : tensor ... } ``` Becomes ``` linalg.tiled_loop ... outs (%out_buf:memref<...>) { ... linalg.yield } ``` Differential Revision: https://reviews.llvm.org/D99333
-
Mehdi Amini authored
Define a `NoTerminator` traits that allows operations with a single block region to not provide a terminator In particular for Graph Regions, the terminator needs is just a historical artifact of the generalization of MLIR from CFG region. Operations like Module don't need a terminator, and before Module migrated to be an operation with region there wasn't any needed. To validate the feature, the ModuleOp is migrated to use this trait and the ModuleTerminator operation is deleted. This patch is likely to break clients, if you're in this case: - you may iterate on a ModuleOp with `getBody()->without_terminator()`, the solution is simple: just remove the ->without_terminator! - you created a builder with `Builder::atBlockTerminator(module_body)`, just use `Builder::atBlockEnd(module_body)` instead. - you were handling ModuleTerminator: it isn't needed anymore. - for generic code, a `Block::mayNotHaveTerminator()` may be used. Differential Revision: https://reviews.llvm.org/D98468
-
- Mar 24, 2021
-
-
Lei Zhang authored
For such op chains, we can create new linalg.fill ops with the result type of the linalg.tensor_reshape op. Differential Revision: https://reviews.llvm.org/D99116
-
Lei Zhang authored
init tensor operands also has indexing map and generally follow the same constraints we expect for non-init-tensor operands. Differential Revision: https://reviews.llvm.org/D99115
-
Lei Zhang authored
This commit exposes an option to the pattern FoldWithProducerReshapeOpByExpansion to allow folding unit dim reshapes. This gives callers more fine-grained controls. Differential Revision: https://reviews.llvm.org/D99114
-
Lei Zhang authored
This identifies a pattern where the producer affine min/max op is bound to a dimension/symbol that is used as a standalone expression in the consumer affine op's map. In that case the producer affine min/max op can be merged into its consumer. For example, a pattern like the following: ``` %0 = affine.min affine_map<()[s0] -> (s0 + 16, s0 * 8)> ()[%sym1] %1 = affine.min affine_map<(d0)[s0] -> (s0 + 4, d0)> (%0)[%sym2] ``` Can be turned into: ``` %1 = affine.min affine_map< ()[s0, s1] -> (s0 + 4, s1 + 16, s1 * 8)> ()[%sym2, %sym1] ``` Differential Revision: https://reviews.llvm.org/D99016
-
Lei Zhang authored
If there are multiple identical expressions in an affine min/max op's map, we can just keep one. Differential Revision: https://reviews.llvm.org/D99015
-
Lei Zhang authored
Until now Linalg fusion only allow fusing producers whose operands are all permutation indexing maps. It's easier to deduce the subtensor/subview but it is an unnecessary constraint, as in tiling we have more advanced logic to deduce the subranges even when the operand is not of permutation indexing maps, e.g., the input operand for convolution ops. This patch uses the logic on tiling side to deduce subranges for fusion. This enables fusing convolution with its consumer ops when possible. Along the way, we are now generating proper affine.min ops to guard against size boundaries, if we cannot be certain they won't be out of bounds. Differential Revision: https://reviews.llvm.org/D99014
-
Lei Zhang authored
This is a preparation step to reuse makeTiledShapes in tensor fusion. Along the way, did some lightweight cleanups. Differential Revision: https://reviews.llvm.org/D99013
-
Tobias Gysi authored
All linalg operations having a region builder shall call it during op creation. Calling it during vectorization is obsolete. Differential Revision: https://reviews.llvm.org/D99168
-
Alex Zinenko authored
Index type is an integer type of target-specific bitwidth present in many MLIR operations (loops, memory accesses). Converting values of this type to fixed-size integers has always been problematic. Introduce a data layout entry to specify the bitwidth of `index` in a given layout scope, defaulting to 64 bits, which is a commonly used assumption, e.g., in constants. Port builtin-to-LLVM type conversion to use this data layout entry when converting `index` type and untie it from pointer size. This is particularly relevant for GPU targets. Keep a possibility to forcibly override the index type in lowerings. Depends On D98525 Reviewed By: herhut Differential Revision: https://reviews.llvm.org/D98937
-
Alex Zinenko authored
ModuleOp is a natural place to provide scoped data layout information. However, it is undesirable for ModuleOp to implement the entirety of DataLayoutOpInterface because that would require either pushing the interface inside the IR library instead of a separate library, or putting the default implementation of the interface as inline functions in headers leading to binary bloat. Instead, ModuleOp accepts an arbitrary data layout spec attribute and has a dedicated hook to extract it, and DataLayout is modified to know about ModuleOp particularities. Reviewed By: herhut, nicolasvasilache Differential Revision: https://reviews.llvm.org/D98500
-
Nicolas Vasilache authored
Fix the BlockAndValueMapping update that was missing entries for scf.for op's blockIterArgs. Skip cloning subtensors of the padded tensor as the logic for these is separate. Add a filter to drop side-effecting ops. Tests are beefed up to verify the IR is sound in all hoisting configurations for 2-level 3-D tiled matmul. Differential Revision: https://reviews.llvm.org/D99255
-
Vladislav Vinogradov authored
Use new `MemRefType::getMemorySpace` method with generic Attribute in cases, where there is no specific logic around the memory space. Reviewed By: rriddle Differential Revision: https://reviews.llvm.org/D99154
-
- Mar 23, 2021
-
-
River Riddle authored
[mlir][Pattern] Add better support for using interfaces/traits to match root operations in rewrite patterns To match an interface or trait, users currently have to use the `MatchAny` tag. This tag can be quite problematic for compile time for things like the canonicalizer, as the `MatchAny` patterns may get applied to *every* operation. This revision adds better support by bucketing interface/trait patterns based on which registered operations have them registered. This means that moving forward we will only attempt to match these patterns to operations that have this interface registered. Two simplify defining patterns that match traits and interfaces, two new utility classes have been added: OpTraitRewritePattern and OpInterfaceRewritePattern. Differential Revision: https://reviews.llvm.org/D98986
-
Chris Lattner authored
This provides a simplified way to implement 'matchAndRewrite' style canonicalization patterns for ops that don't need the full power of RewritePatterns. Using this style, you can implement a static method with a signature like: ``` LogicalResult AssertOp::canonicalize(AssertOp op, PatternRewriter &rewriter) { return success(); } ``` instead of dealing with defining RewritePattern subclasses. This also adopts this for a few canonicalization patterns in the std dialect to show how it works. Differential Revision: https://reviews.llvm.org/D99143
-
Alex Zinenko authored
-
Nicolas Vasilache authored
This revision introduces proper backward slice computation during the hoisting of PadTensorOp. This allows hoisting padding even across multiple levels of tiling. Such hoisting requires the proper handling of loop bounds that may depend on enclosing loop variables. Differential revision: https://reviews.llvm.org/D98965
-
Frederik Gossen authored
This reverts commit 5f8acd4f.
-
Frederik Gossen authored
Differential Revision: https://reviews.llvm.org/D99156
-
Frederik Gossen authored
Differential Revision: https://reviews.llvm.org/D99159
-