- Dec 02, 2020
-
-
Christian Sigg authored
Given that OpState already implicit converts to Operator*, this seems reasonable. The alternative would be to add more functions to OpState which forward to Operation. Reviewed By: rriddle, ftynse Differential Revision: https://reviews.llvm.org/D92266
-
- Nov 26, 2020
-
-
Aart Bik authored
This change gives sparse compiler clients more control over selecting individual types for the pointers and indices in the sparse storage schemes. Narrower width obviously results in smaller memory footprints, but the range should always suffice for the maximum number of entries or index value. Reviewed By: penpornk Differential Revision: https://reviews.llvm.org/D92126
-
Sean Silva authored
It still had the old name from before ElementwiseMappable was added.
-
- Nov 25, 2020
-
-
Aart Bik authored
This CL adds the ability to request different parallelization strategies for the generate code. Every "parallel" loop is a candidate, and converted to a parallel op if it is an actual for-loop (not a while) and the strategy allows dense/sparse outer/inner parallelization. This will connect directly with the work of @ezhulenev on parallel loops. Still TBD: vectorization strategy Reviewed By: penpornk Differential Revision: https://reviews.llvm.org/D91978
-
- Nov 24, 2020
-
-
Aart Bik authored
Generalizes invariant handling to anything defined outside the Linalg op (parameters and SSA computations). Fixes bug that was using parameter number as tensor number. Reviewed By: penpornk Differential Revision: https://reviews.llvm.org/D91985
-
Nicolas Vasilache authored
Print part of an op of the form: ``` <optional-offset-prefix>`[` offset-list `]` <optional-size-prefix>`[` size-list `]` <optional-stride-prefix>[` stride-list `]` ``` Also address some leftover nits. Differential revision: https://reviews.llvm.org/D92031
-
Alexander Belyaev authored
Differential Revision: https://reviews.llvm.org/D92014
-
- Nov 23, 2020
-
-
Nicolas Vasilache authored
-
MaheshRavishankar authored
Exposing some utility functions from Linalg to allow for promotion of fused views outside of the core tile+fuse logic. This is an alternative to patch D91322 which adds the promotion logic to the tileAndFuse method. Downside with that approach is that it is not easily customizable based on needs. Differential Revision: https://reviews.llvm.org/D91503
-
MaheshRavishankar authored
Enhance the tile+fuse logic to allow fusing a sequence of operations. Make sure the value used to obtain tile shape is a SubViewOp/SubTensorOp. Current logic used to get the bounds of loop depends on the use of `getOrCreateRange` method on `SubViewOp` and `SubTensorOp`. Make sure that the value/dim used to compute the range is from such ops. This fix is a reasonable WAR, but a btter fix would be to make `getOrCreateRange` method be a method of `ViewInterface`. Differential Revision: https://reviews.llvm.org/D90991
-
Nicolas Vasilache authored
Differential Revision: https://reviews.llvm.org/D91956
-
Nicolas Vasilache authored
This revision refactors code used in various Linalg transformations and makes it a first class citizen to the LinalgStructureOpInterface. This is in preparation to allowing more advanced Linalg behavior but is otherwise NFC. Differential revision: https://reviews.llvm.org/D91863
-
- Nov 21, 2020
-
-
Aart Bik authored
Adds tests for full sum reduction (tensors summed up into scalars) and the well-known sampled-dense-dense-matrix-product. Refines the optimizations rules slightly to handle the summation better. Reviewed By: penpornk Differential Revision: https://reviews.llvm.org/D91818
-
- Nov 20, 2020
-
-
Thomas Raoux authored
Add transformation to be able to forward transfer_write into transfer_read operation and to be able to remove dead transfer_write when a transfer_write is overwritten before being read. Differential Revision: https://reviews.llvm.org/D91321
-
Mikhail Goncharov authored
This reverts commit f8284d21. Revert "[mlir][Linalg] NFC: Expose some utility functions used for promotion." This reverts commit 0c59f515. Revert "Remove unused isZero function" This reverts commit 0f9f0a40. Change f8284d21 led to multiple failures in IREE compilation.
-
Geoffrey Martin-Noble authored
Unused since https://reviews.llvm.org/D91503 and triggering -Wunused-function Reviewed By: rriddle Differential Revision: https://reviews.llvm.org/D91838
-
MaheshRavishankar authored
Exposing some utility functions from Linalg to allow for promotion of fused views outside of the core tile+fuse logic. This is an alternative to patch D91322 which adds the promotion logic to the tileAndFuse method. Downside with that approach is that it is not easily customizable based on needs. Differential Revision: https://reviews.llvm.org/D91503
-
MaheshRavishankar authored
Enhance the tile+fuse logic to allow fusing a sequence of operations. Differential Revision: https://reviews.llvm.org/D90991
-
MaheshRavishankar authored
Differential Revision: https://reviews.llvm.org/D91749
-
- Nov 19, 2020
-
-
River Riddle authored
* Move ops to a BuiltinOps.h * Add file comments
-
Lei Zhang authored
This commit starts a new pass and patterns for converting Linalg named ops to generic ops. This enables us to leverage the flexbility from generic ops during transformations. Right now only linalg.conv is supported; others will be added when useful. Reviewed By: nicolasvasilache Differential Revision: https://reviews.llvm.org/D91357
-
Aart Bik authored
Rationale: Make sure preconditions are tested already during verfication. Currently, the only way a sparse rewriting rule can fail is if (1) the linalg op does not have sparse annotations, or (2) a yet to be handled operation is encounted inside the op Reviewed By: penpornk Differential Revision: https://reviews.llvm.org/D91748
-
- Nov 18, 2020
-
-
MaheshRavishankar authored
Differential Revision: https://reviews.llvm.org/D91502
-
- Nov 17, 2020
-
-
Aart Bik authored
As discussed in https://llvm.discourse.group/t/mlir-support-for-sparse-tensors/2020 this CL is the start of sparse tensor compiler support in MLIR. Starting with a "dense" kernel expressed in the Linalg dialect together with per-dimension sparsity annotations on the tensors, the compiler automatically lowers the kernel to sparse code using the methods described in Fredrik Kjolstad's thesis. Many details are still TBD. For example, the sparse "bufferization" is purely done locally since we don't have a global solution for propagating sparsity yet. Furthermore, code to input and output the sparse tensors is missing. Nevertheless, with some hand modifications, the generated MLIR can be easily converted into runnable code already. Reviewed By: nicolasvasilache, ftynse Differential Revision: https://reviews.llvm.org/D90994
-
Stephan Herhut authored
This enables the use of fusion on buffers in partially lowered programs. Differential Revision: https://reviews.llvm.org/D91613
-
River Riddle authored
These includes have been deprecated in favor of BuiltinDialect.h, which contains the definitions of ModuleOp and FuncOp. Differential Revision: https://reviews.llvm.org/D91572
-
- Nov 16, 2020
-
-
Nicolas Vasilache authored
scf.parallel is currently not a good fit for tiling on tensors. Instead provide a path to parallelism directly through scf.for. For now, this transformation ignores the distribution scheme and always does a block-cyclic mapping (where block is the tile size). Differential revision: https://reviews.llvm.org/D90475
-
- Nov 14, 2020
-
-
Aart Bik authored
motivated by a refactoring in the new sparse code (yet to be merged), this avoids some lengthy code dup Reviewed By: mehdi_amini Differential Revision: https://reviews.llvm.org/D91465
-
Sean Silva authored
That way, it runs in parallel across functions.
-
- Nov 13, 2020
-
-
MaheshRavishankar authored
Using LinalgOp will reduce the repeated conversion from Operation <-> LinalgOp. Differential Revision: https://reviews.llvm.org/D91101
-
River Riddle authored
[mlir][Interfaces] Add implicit casts from concrete operation types to the interfaces they implement. This removes the need to have an explicit `cast<>` given that we always know it `isa` instance of the interface. Differential Revision: https://reviews.llvm.org/D91304
-
- Nov 12, 2020
-
-
Sean Silva authored
We lower them to a std.global_memref (uniqued by constant value) + a std.get_global_memref to produce the corresponding memref value. This allows removing Linalg's somewhat hacky lowering of tensor constants, now that std properly supports this. Differential Revision: https://reviews.llvm.org/D91306
-
Sean Silva authored
It was incorrect in the presence of a tensor argument with multiple uses. The bufferization of subtensor_insert was writing into a converted memref operand, but there is no guarantee that the converted memref for that operand is safe to write into. In this case, the same converted memref is written to in-place by the subtensor_insert bufferization, violating the tensor-level semantics. I left some comments in a TODO about ways forward on this. I will be working actively on this problem in the coming days. Differential Revision: https://reviews.llvm.org/D91371
-
MaheshRavishankar authored
This change does two main things 1) An operation might have multiple dependences to the same producer. Not tracking them correctly can result in incorrect code generation with fusion. To rectify this the dependence tracking needs to also have the operand number in the consumer. 2) Improve the logic used to find the fused loops making it easier to follow. The only constraint for fusion is that linalg ops (on buffers) have update semantics for the result. Fusion should be such that only one iteration of the fused loop (which is also a tiled loop) must touch only one (disjoint) tile of the output. This could be relaxed by allowing for recomputation that is the default when oeprands are tensors, or can be made legal with promotion of the fused view (in future). Differential Revision: https://reviews.llvm.org/D90579
-
Aart Bik authored
This CL integrates the new sparse annotations (hereto merely added as fully transparent attributes) more tightly to the generic linalg op in order to add verification of the annotations' consistency as well as to make make other passes more aware of their presence (in the long run, rewriting rules must preserve the integrity of the annotations). Reviewed By: nicolasvasilache Differential Revision: https://reviews.llvm.org/D91224
-
- Nov 10, 2020
-
-
Sean Silva authored
This patch converts elementwise ops on tensors to linalg.generic ops with the same elementwise op in the payload (except rewritten to operate on scalars, obviously). This is a great form for later fusion to clean up. E.g. ``` // Compute: %arg0 + %arg1 - %arg2 func @f(%arg0: tensor<?xf32>, %arg1: tensor<?xf32>, %arg2: tensor<?xf32>) -> tensor<?xf32> { %0 = addf %arg0, %arg1 : tensor<?xf32> %1 = subf %0, %arg2 : tensor<?xf32> return %1 : tensor<?xf32> } ``` Running this through `mlir-opt -convert-std-to-linalg -linalg-fusion-for-tensor-ops` we get: ``` func @f(%arg0: tensor<?xf32>, %arg1: tensor<?xf32>, %arg2: tensor<?xf32>) -> tensor<?xf32> { %0 = linalg.generic {indexing_maps = [#map0, #map0, #map0, #map0], iterator_types = ["parallel"]} ins(%arg0, %arg1, %arg2 : tensor<?xf32>, tensor<?xf32>, tensor<?xf32>) { ^bb0(%arg3: f32, %arg4: f32, %arg5: f32): // no predecessors %1 = addf %arg3, %arg4 : f32 %2 = subf %1, %arg5 : f32 linalg.yield %2 : f32 } -> tensor<?xf32> return %0 : tensor<?xf32> } ``` So the elementwise ops on tensors have nicely collapsed into a single linalg.generic, which is the form we want for further transformations. Differential Revision: https://reviews.llvm.org/D90354
-
- Nov 09, 2020
-
-
Nicolas Vasilache authored
This revision adds support for bufferization by using a mix of `tensor_load`, `subview`, `linalg.copy` and `tensor_to_memref`.
-
- Nov 06, 2020
-
-
Sean Silva authored
I ran into this pattern when converting elementwise ops like `addf %arg0, %arg : tensor<?xf32>` to linalg. Redundant arguments can also easily arise from linalg-fusion-for-tensor-ops. Also, fix some small bugs in the logic in LinalgStructuredOpsInterface.td. Differential Revision: https://reviews.llvm.org/D90812
-
Mehdi Amini authored
-
- Nov 05, 2020
-
-
Nicolas Vasilache authored
The LinalgDependenceGraph and alias analysis provide the necessary analysis for the Linalg fusion on buffers case. However this is not enough for linalg on tensors which require proper memory effects to play nicely with DCE and other transformations. This revision adds side effects to Linalg ops that were previously missing and has 2 consequences: 1. one example in the copy removal pass now fails since the linalg.generic op has side effects and the pass does not perform alias analysis / distinguish between reads and writes. 2. a few examples in fusion-tensor.mlir need to return the resulting tensor otherwise DCE automatically kicks in as part of greedy pattern application. Differential Revision: https://reviews.llvm.org/D90762
-