- Jan 22, 2021
-
-
MaheshRavishankar authored
Fusion of generic/indexed_generic operations with tensor_reshape by expansion when the latter just adds/removes unit-dimensions is disabled since it just adds unit-trip count loops. Differential Revision: https://reviews.llvm.org/D94626
-
MaheshRavishankar authored
Differential Revision: https://reviews.llvm.org/D93086
-
MaheshRavishankar authored
representing dependence from producer result to consumer. With Linalg on tensors the dependence between operations can be from the result of the producer to the consumer. This change just does a NFC refactoring of the LinalgDependenceGraphElem to allow representing both OpResult and OpOperand*. Differential Revision: https://reviews.llvm.org/D95208
-
Lei Zhang authored
spv.Ordered/spv.Unordered are meant for OpenCL Kernel capability. For Vulkan Shader capability, we should use spv.IsNan to check whether a number is NaN. Add a new pattern for converting `std.cmpf ord|uno` to spv.IsNan and bumped the pattern converting to spv.Ordered/spv.Unordered to a higher benefit. The SPIR-V target environment will properly select between these two patterns. Reviewed By: mravishankar Differential Revision: https://reviews.llvm.org/D95237
-
Hanhan Wang authored
- Extend spirv::ConstantOp::getZero/One to handle float, vector of int, and vector of float. - Refactor ZeroExtendI1Pattern to use getZero/One methods. - Add one more test for lowering std.zexti which extends vector<4xi1> to vector<4xi64>. Reviewed By: antiagainst Differential Revision: https://reviews.llvm.org/D95120
-
Hanhan Wang authored
`linalg.pad_tensor` is an operation that pads the `source` tensor with given `low` and `high` padding config. Example 1: ```mlir %pad_value = ... : f32 %1 = linalg.pad_tensor %0 low[1, 2] high[2, 3] { ^bb0(%arg0 : index, %arg1 : index): linalg.yield %pad_value : f32 } : tensor<?x?xf32> to tensor<?x?xf32> ``` Example 2: ```mlir %pad_value = ... : f32 %1 = linalg.pad_tensor %arg0 low[2, %arg1, 3, 3] high[3, 3, %arg1, 2] { ^bb0(%arg2: index, %arg3: index, %arg4: index, %arg5: index): linalg.yield %pad_value : f32 } : tensor<1x2x2x?xf32> to tensor<6x?x?x?xf32> ``` Reviewed By: nicolasvasilache Differential Revision: https://reviews.llvm.org/D93704
-
- Jan 21, 2021
-
-
River Riddle authored
A cast-like operation is one that converts from a set of input types to a set of output types. The arity of the inputs may be from 0-N, whereas the arity of the outputs may be anything from 1-N. Cast-like operations are removable in cases where they produce a "no-op", i.e when the input types and output types match 1-1. Differential Revision: https://reviews.llvm.org/D94831
-
- Jan 20, 2021
-
-
Nicolas Vasilache authored
This may simplify the composition of patterns but is otherwise NFC.
-
Nicolas Vasilache authored
Like SubView, SubTensor/SubTensorInsertOp are allowed to have rank-reducing/expanding semantics. In the case of SubTensorInsertOp , the rank of offsets/sizes/strides should be the rank of the destination tensor. Also, add a builder flavor for SubTensorOp to return a rank-reduced tensor. Differential Revision: https://reviews.llvm.org/D95076
-
Nicolas Vasilache authored
-
Aart Bik authored
Use cases with 16- or even 8-bit pointer/index structures have been identified. Reviewed By: penpornk Differential Revision: https://reviews.llvm.org/D95015
-
Jackson Fellows authored
Add a constant folder for DivFOp. Analogous to existing folders for AddFOp, SubFOp, and MulFOp. Matches the behavior of existing LLVM constant folding (https://github.com/llvm/llvm-project/blob/999f5da6b3088fa4c0bb9d05b358d015ca74c71f/llvm/lib/IR/ConstantFold.cpp#L1432). Reviewed By: ftynse Differential Revision: https://reviews.llvm.org/D94939
-
- Jan 19, 2021
-
-
Sean Silva authored
- DynamicTensorFromElementsOp - TensorFromElements Differential Revision: https://reviews.llvm.org/D94994
-
Nicolas Vasilache authored
In prehistorical times, AffineApplyOp was allowed to produce multiple values. This allowed the creation of intricate SSA use-def chains. AffineApplyNormalizer was originally introduced as a means of reusing the AffineMap::compose method to write SSA use-def chains. Unfortunately, symbols that were produced by an AffineApplyOp needed to be promoted to dims and reordered for the mathematical composition to be valid. Since then, single result AffineApplyOp became the law of the land but the original assumptions were not revisited. This revision revisits these assumptions and retires AffineApplyNormalizer. Differential Revision: https://reviews.llvm.org/D94920
-
Mehdi Amini authored
-
- Jan 16, 2021
-
-
Thomas Raoux authored
-
Thomas Raoux authored
This allow using this helper outside of the linalg canonicalization. Differential Revision: https://reviews.llvm.org/D94826
-
- Jan 15, 2021
-
-
MaheshRavishankar authored
The operantion is an identity if the values yielded by the operation is the argument of the basic block of that operation. Add this missing check. Differential Revision: https://reviews.llvm.org/D94819
-
Alexander Belyaev authored
Differential Revision: https://reviews.llvm.org/D94764
-
Valentin Clement authored
Add builtin f80 and f128 following @schweitz proposition https://llvm.discourse.group/t/rfc-adding-better-support-for-higher-precision-floating-point/2526/5 Reviewed By: ftynse, rriddle Differential Revision: https://reviews.llvm.org/D94737
-
Aart Bik authored
This is a very minor improvement during iteration graph construction. If the first attempt considering the dimension order of all tensors fails, a second attempt is made using the constraints of sparse tensors only. Dense tensors prefer dimension order (locality) but provide random access if needed, enabling the compilation of more sparse kernels. Reviewed By: penpornk Differential Revision: https://reviews.llvm.org/D94709
-
MaheshRavishankar authored
With the recent changes to linalg on tensor semantics, the tiling operations works out-of-the-box for generic operations. Add a test to verify that and some minor refactoring. Differential Revision: https://reviews.llvm.org/D93077
-
MaheshRavishankar authored
Add canonicalization to replace use of the result of a linalg operation on tensors in a dim operation, to use one of the operands of the linalg operations instead. This allows the linalg op itself to be deleted when all its non-dim uses are removed (say through tiling, etc.) Differential Revision: https://reviews.llvm.org/D93076
-
- Jan 14, 2021
-
-
MaheshRavishankar authored
linalg.generic/indexed_generic operations on tensors whose body is just yielding the (non-induction variable) arguments of the operation can be canonicalized by replacing uses of the result with the corresponding arguments. Differential Revision: https://reviews.llvm.org/D94581
-
- Jan 13, 2021
-
-
Aart Bik authored
Similar to the parallelization strategies, the vectorization strategies provide control on what loops should be vectorize. Unlike the parallel strategies, only innermost loops are considered, but including reductions, with the control of vectorizing dense loops only or dense and sparse loops. The vectorized loops are always controlled by a vector mask to avoid overrunning the iterations, but subsequent vector operation folding removes redundant masks and replaces the operations with more efficient counterparts. Similarly, we will rely on subsequent loop optimizations to further optimize masking, e.g. using an unconditional full vector loop and scalar cleanup loop. The current strategy already demonstrates a nice interaction between the sparse compiler and all prior optimizations that went into the vector dialect. Ongoing discussion at: https://llvm.discourse.group/t/mlir-support-for-sparse-tensors/2020/10 Reviewed By: penpornk Differential Revision: https://reviews.llvm.org/D94551
-
Tres Popp authored
This corrects the last 2 issues caught by tests when causing dialect conversion rollbacks to occur. Differential Revision: https://reviews.llvm.org/D94623
-
David Blaikie authored
-
- Jan 12, 2021
-
-
Nicolas Vasilache authored
This revision uniformizes fusion APIs to allow passing OpOperand, OpResult and adds a finer level of control fusion. Differential Revision: https://reviews.llvm.org/D94493
-
Alex Zinenko authored
Continue the convergence between LLVM dialect and built-in types by using the built-in vector type whenever possible, that is for fixed vectors of built-in integers and built-in floats. LLVM dialect vector type is still in use for pointers, less frequent floating point types that do not have a built-in equivalent, and scalable vectors. However, the top-level `LLVMVectorType` class has been removed in favor of free functions capable of inspecting both built-in and LLVM dialect vector types: `LLVM::getVectorElementType`, `LLVM::getNumVectorElements` and `LLVM::getFixedVectorType`. Additional work is necessary to design an implemented the extensions to built-in types so as to remove the `LLVMFixedVectorType` entirely. Note that the default output format for the built-in vectors does not have whitespace around the `x` separator, e.g., `vector<4xf32>` as opposed to the LLVM dialect vector type format that does, e.g., `!llvm.vec<4 x fp128>`. This required changing the FileCheck patterns in several tests. Reviewed By: mehdi_amini, silvas Differential Revision: https://reviews.llvm.org/D94405
-
Rob Suderman authored
getDynOperands behavior is commonly used in a number of passes. Refactored to use a helper function and avoid code reuse. Differential Revision: https://reviews.llvm.org/D94340
-
- Jan 11, 2021
-
-
Aart Bik authored
This ensures the memref base + indices expression is well-formed Reviewed By: ThomasRaoux, ftynse Differential Revision: https://reviews.llvm.org/D94441
-
MaheshRavishankar authored
When fusing tensor_reshape ops with generic/indexed_Generic op, new linalg.init_tensor operations were created for the `outs` of the fused op. While correct (technically) it is better to just reshape the original `outs` operands and rely on canonicalization of init_tensor -> tensor_reshape to achieve the same effect. Differential Revision: https://reviews.llvm.org/D93774
-
Thomas Raoux authored
This allow more accurate modeling of the side effects and allow dead code elimination to remove dead transfer ops. Differential Revision: https://reviews.llvm.org/D94318
-
MaheshRavishankar authored
Reshaping an init_tensor can be folded to a init_tensor op of the final type. Differential Revision: https://reviews.llvm.org/D93773
-
Lei Zhang authored
Linalg ops are perfect loop nests. When materializing the concrete loop nest, the default order specified by the Linalg op's iterators may not be the best for further CodeGen: targets frequently need to plan the loop order in order to gain better data access. And different targets can have different preferences. So there should exist a way to control the order. Reviewed By: nicolasvasilache Differential Revision: https://reviews.llvm.org/D91795
-
Christian Sigg authored
Do not cache gpu.async.token type so that the pass can be created before the GPU dialect is registered. Reviewed By: ftynse Differential Revision: https://reviews.llvm.org/D94397
-
ergawy authored
This commit adds support for (de-)serializing SpecConstantOpeation. One thing worth noting is that during deserialization, we assign a fake ID to enclosed ops inside SpecConstantOpeation. We need to do this in order for deserialization logic to properly update ID to value map and to later reference the created value from the sibling 'spv::YieldOp'. Reviewed By: antiagainst Differential Revision: https://reviews.llvm.org/D93591
-
- Jan 10, 2021
-
-
Nicolas Vasilache authored
This assertion is an old remnant from earlier days when only affine functions existed. It is not the place of affine map composition to check whether orthogonal considerations on what is allowed to be a symbol under the AffineScope trait.
-
- Jan 09, 2021
-
-
Aart Bik authored
This change makes the scatter/gather syntax more consistent with the syntax of all the other memory operations in the Vector dialect (order of types, use of [] for index, etc.). This will make the MLIR code easier to read. In addition, the pass_thru parameter of the gather has been made mandatory (there is very little benefit in using the implicit "undefined" values). Reviewed By: nicolasvasilache Differential Revision: https://reviews.llvm.org/D94352
-
Lei Zhang authored
The dialect conversion framework was enhanced to handle type conversion automatically. OpConversionPattern already contains a pointer to the TypeConverter. There is no need to duplicate it in a separate subclass. This removes the only reason for a SPIRVOpLowering subclass. It adapts to use core infrastructure and simplifies the code. Also added a utility function to OpConversionPattern for getting TypeConverter as a certain subclass. Reviewed By: hanchung Differential Revision: https://reviews.llvm.org/D94080
-