summaryrefslogtreecommitdiff
path: root/mlir
Commit message (Collapse)AuthorAgeFilesLines
* [mlir][sparse] Fixing sparse_reshape.mlir integration test (followup to D150822)wren romano2023-05-171-4/+4
| | | | | | | | | For some reason, even though D150822 passed the buildbot, it failed to catch this test Reviewed By: anlunx Differential Revision: https://reviews.llvm.org/D150830
* [mlir][sparse] Fixing GPU tests (followup to D150330)wren romano2023-05-173-6/+6
| | | | | | | | The GPU tests weren't updated when rebasing D150330, so this patch fixes that. Reviewed By: anlunx Differential Revision: https://reviews.llvm.org/D150822
* [mlir][sparse] Renaming the STEA field `dimLevelType` to `lvlTypes`wren romano2023-05-17172-1240/+1229
| | | | | | | | | | | | | | | | | | This commit is part of the migration of towards the new STEA syntax/design. In particular, this commit includes the following changes: * Renaming compiler-internal functions/methods: * `SparseTensorEncodingAttr::{getDimLevelType => getLvlTypes}` * `Merger::{getDimLevelType => getLvlType}` (for consistency) * `sparse_tensor::{getDimLevelType => buildLevelType}` (to help reduce confusion vs actual getter methods) * Renaming external facets to match: * the STEA parser and printer * the C and Python bindings * PyTACO However, the actual renaming of the `DimLevelType` itself (along with all the "dlt" names) will be handled in a separate commit. Reviewed By: aartbik Differential Revision: https://reviews.llvm.org/D150330
* [mlir][irdl] Add `irdl.any_of` operationMathieu Fehr2023-05-1711-27/+525
| | | | | | | | | | | | | | | | | | | | | | | | | | | The `irdl.any_of` operation represent a constraint that is satisfied if any of its subconstraint is satisfied. For instance, in the following example: ``` %0 = irdl.is f32 %1 = irdl.is f64 %2 = irdl.any_of(f32, f64) ``` `%2` can only be satisfied by `f32` or `f64`. Note that the verification algorithm required by `irdl.any_of` is non-trivial, since we want that the order of arguments of `irdl.any_of` to not matter. For this reason, our registration algorithm fails if two constraints used by `any_of` might be satisfied by the same `Attribute`. This is approximated by checking the possible `Attribute` bases of each constraints. Depends on D145734 Reviewed By: Mogball Differential Revision: https://reviews.llvm.org/D145735
* [mlir][openacc] Add firstprivate representationValentin Clement2023-05-173-23/+218
| | | | | | | | | | | | | | Add a representation for firstprivate clause modeled on the private representation added in D150622. The firstprivate recipe operation has an additional mandatory region representing a sequences of operations needed to copy the initial value to the created private copy. Depends on D150622 Reviewed By: razvanlupusoru Differential Revision: https://reviews.llvm.org/D150729
* [mlir][openacc] Add private representationValentin Clement2023-05-175-1/+185
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently privatization is not well represented in the OpenACC dialect. This patch is a prototype to model privatization with a dedicated operation that declares how the private value is created and destroyed. The newly introduced operation is `acc.private.recipe` and it declares an OpenACC privatization. The operation requires one mandatory and one optional region. 1. The initializer region specifies how to create and initialize a new private value. For example in Fortran, a derived-type might have a default initialization. The region has an argument that contains the value that need to be privatized. This is useful if the type is not a known at compile time and the private value is needed to create its copy. 2. The destroy region specifies how to destruct the value when it reaches its end of life. It takes the privatized value as argument. A same privatization can be used for multiple operand if they have the same type and do not require a specific default initialization. Example: ```mlir acc.private.recipe @privatization_f32 : f32 init { ^bb0(%0: f32): // init region contains a sequence of operations to create and initialize the // copy if needed. } destroy { ^bb0(%0: f32): // destroy region contains a sequences of operations to destruct the created // copy. } // The privatization symbol is then used in the corresponding operation. acc.parallel private(@privatization_f32 -> %a : f32) { } ``` Reviewed By: razvanlupusoru, jeanPerier Differential Revision: https://reviews.llvm.org/D150622
* [mlir][vector] Separate out vector transfer + tensor slice patternsLei Zhang2023-05-178-312/+384
| | | | | | | | | | | | | | These patterns touches the structure generated from tiling so it affects later steps like bufferization and vector hoisting. Instead of putting them in canonicalization, this commit creates separate entry points for them to be called explicitly. This is NFC regarding the functionality and tests of those patterns. It also addresses two TODO items in the codebase. Reviewed By: ThomasRaoux Differential Revision: https://reviews.llvm.org/D150702
* [mlir] don't hardcode PDL_Operation in Transform dialect extensionsAlex Zinenko2023-05-1726-212/+193
| | | | | | | | | | | | | | | | | Update operations in Transform dialect extensions defined in the Affine, GPU, MemRef and Tensor dialects to use the more generic `TransformHandleTypeInterface` type constraint instead of hardcoding `PDL_Operation`. See https://discourse.llvm.org/t/rfc-type-system-for-the-transform-dialect/65702 for motivation. Remove the dependency on PDLDialect from these extensions. Update tests to use `!transform.any_op` instead of `!pdl.operation`. Reviewed By: nicolasvasilache Differential Revision: https://reviews.llvm.org/D150781
* Revert "Reland "[CMake] Bumps minimum version to 3.20.0.""Nico Weber2023-05-172-2/+9
| | | | | | | | | | | | | | This reverts commit 65429b9af6a2c99d340ab2dcddd41dab201f399c. Broke several projects, see https://reviews.llvm.org/D144509#4347562 onwards. Also reverts follow-up commit "[OpenMP] Compile assembly files as ASM, not C" This reverts commit 4072c8aee4c89c4457f4f30d01dc9bb4dfa52559. Also reverts fix attempt "[cmake] Set CMP0091 to fix Windows builds after the cmake_minimum_required bump" This reverts commit 7d47dac5f828efd1d378ba44a97559114f00fb64.
* [mlir][irdl] Add verification of IRDL opsMathieu Fehr2023-05-1710-5/+412
| | | | | | | | | | | | | | | | This patch adds verification on registered IRDL operations, types, and attributes. This is done through an interface implemented by operations from the `irdl` dialect, which translate the operations into `Constraint`. This interface is then use in the `registerDialect` function to generate verifiers for the entire operation/type/attribute. Depends on D145733 Reviewed By: Mogball Differential Revision: https://reviews.llvm.org/D145734
* [mlir][llvm] Mark additional ops as pure.Tobias Gysi2023-05-172-2/+2
| | | | | | | | | | | The revision marks the overflow arithmetic intrinsics and the freeze operation as pure. This change enables inlining and possible other optimizations for these operations. Reviewed By: Dinistro Differential Revision: https://reviews.llvm.org/D150679
* [mlir][llvm] Saturation arithmetic intrinsics.Tobias Gysi2023-05-173-0/+143
| | | | | | | | Add the saturation arithmetic intrinsics to the LLVM dialect. Reviewed By: Dinistro Differential Revision: https://reviews.llvm.org/D150676
* [mlir][openacc][NFC] Rename ReductionOp to ReductionOperatorValentin Clement2023-05-161-23/+25
| | | | | | | | | | | | As we are moving on with new design for the private clause representation, the reduction clause will aslo get remodeled. In order to new clash with a new dedicated reduction operation, this patch rename the current ReductionOp to ReductionOperator. It might just become obsolete once the new design is in place. Reviewed By: razvanlupusoru Differential Revision: https://reviews.llvm.org/D150711
* [mlir][sparse] Add sparse rewriting rules for tensor::ReshapeOpAnlun Xu2023-05-163-1/+234
| | | | | | Reviewed By: aartbik Differential Revision: https://reviews.llvm.org/D149564
* [mlir][sparse][gpu] set cubin flag when building for cudaAart Bik2023-05-161-0/+8
| | | | | | Reviewed By: Peiming Differential Revision: https://reviews.llvm.org/D150692
* [mlir][sparse] Add a helper class to help lowering operations with/without ↵Peiming Liu2023-05-162-143/+181
| | | | | | | | function calls Reviewed By: aartbik Differential Revision: https://reviews.llvm.org/D150477
* [Clang][Flang][OpenMP] Add loadOffloadInfoMetadata and ↵Andrew Gozillon2023-05-161-4/+8
| | | | | | | | | | | | createOffloadEntriesAndInfoMetadata into OMPIRBuilder's finalize and initialize This allows the generation of OpenMP offload metadata for the OpenMP dialect when lowering to LLVM-IR and moves some of the shared logic between the OpenMP Dialect and Clang into the IRBuilder. Reviewers: jsjodin, jdoerfert, kiranchandramohan Differential Revision: https://reviews.llvm.org/D148370
* [mlir][Linalg] Split vectorization testsAndrzej Warzynski2023-05-164-1205/+1201
| | | | | | | | | | | | | Split Linalg vectorization tests from "vectorization.mlir" across more specialised test files: * vectorize-tensor-extract.mlir - tests for tensor.extract with no masking, * vectorize-tensor-extract-masked.mlir - tests for tensor.extract with masking, * vectorization-masked.mlir - all other tests that use masking, * vectorisation.mlir - the remaining tests. Differential Revision: https://reviews.llvm.org/D149843
* [mlir][openacc] Add ReturnLike trait to acc.yield operationValentin Clement2023-05-162-1/+3
| | | | | | | | Just add the trait as acc.yield is a return like op. Reviewed By: razvanlupusoru, jeanPerier Differential Revision: https://reviews.llvm.org/D150617
* [mlir][llvm] Add is constant intrinsic.Tobias Gysi2023-05-163-3/+25
| | | | | | | | | | The revision adds LLVM's is constant intrinsic. Depends on D150643 Reviewed By: Dinistro Differential Revision: https://reviews.llvm.org/D150660
* [mlir][GPU] Rename MLIRGPUOps CMake target to MLIRGPUDialectMatthias Springer2023-05-1621-22/+22
| | | | | | This is for consistency with other dialects. Differential Revision: https://reviews.llvm.org/D150659
* [mlir] drop spurious PDL includeAlex Zinenko2023-05-161-1/+0
|
* [mlir][llvm] Add expect intrinsics.Tobias Gysi2023-05-168-3/+89
| | | | | | | | | The revision adds the LLVM expect and expect.with.probability intrinsics. Reviewed By: Dinistro, ftynse Differential Revision: https://reviews.llvm.org/D150643
* [mlir] Fix memory explosion when converting global variable bodies in ↵Tung D. Le2023-05-162-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ModuleTranslation There is memory explosion when converting the body or initializer region of a large global variable, e.g. a constant array. For example, when translating a constant array of 100000 strings: ``` llvm.mlir.global internal constant @cats_strings() {addr_space = 0 : i32, alignment = 16 : i64} : !llvm.array<100000 x ptr<i8>> { %0 = llvm.mlir.undef : !llvm.array<100000 x ptr<i8>> %1 = llvm.mlir.addressof @om_1 : !llvm.ptr<array<1 x i8>> %2 = llvm.getelementptr %1[0, 0] : (!llvm.ptr<array<1 x i8>>) -> !llvm.ptr<i8> %3 = llvm.insertvalue %2, %0[0] : !llvm.array<100000 x ptr<i8>> %4 = llvm.mlir.addressof @om_2 : !llvm.ptr<array<1 x i8>> %5 = llvm.getelementptr %4[0, 0] : (!llvm.ptr<array<1 x i8>>) -> !llvm.ptr<i8> %6 = llvm.insertvalue %5, %3[1] : !llvm.array<100000 x ptr<i8>> %7 = llvm.mlir.addressof @om_3 : !llvm.ptr<array<1 x i8>> %8 = llvm.getelementptr %7[0, 0] : (!llvm.ptr<array<1 x i8>>) -> !llvm.ptr<i8> %9 = llvm.insertvalue %8, %6[2] : !llvm.array<100000 x ptr<i8>> %10 = llvm.mlir.addressof @om_4 : !llvm.ptr<array<1 x i8>> %11 = llvm.getelementptr %10[0, 0] : (!llvm.ptr<array<1 x i8>>) -> !llvm.ptr<i8> %12 = llvm.insertvalue %11, %9[3] : !llvm.array<100000 x ptr<i8>> ... (ignore the remaining part) } ``` where `@om_1`, `@om_2`, ... are string global constants. Each time an operation is converted to LLVM, a new constant is created. When it comes to `llvm.insertvalue`, a new constant array of 100000 elements is created and the old constant array (input) is not destroyed. This causes memory explosion. We observed that, on a system with 128 GB memory, the translation of 100000 elements got killed due to using up all the memory. On a system with 64 GB, 65536 elements was enough to cause the translation killed. This patch fixes the issue by checking generated constants and destroyed them if there is no use. By the fix, the translation of 100000 elements only takes about 1.6 GB memory, and finishes without any error. Reviewed By: ftynse, kiranchandramohan Differential Revision: https://reviews.llvm.org/D148487
* [mlir][nfc] Remove unnecessary `-split-input-file`Andrzej Warzynski2023-05-161-1/+1
|
* [MemRefToLLVM][NFC] Use early exit for the getter of the buffer ptrQuentin Colombet2023-05-161-11/+13
| | | | Address review comment from https://reviews.llvm.org/D148947
* [mlir] [mem2reg] Adapt to be pattern-friendly.Théo Degioanni2023-05-1611-225/+357
| | | | | | | | | | | | | | | | | | | | | | | This revision modifies the mem2reg interfaces and algorithm to be more omfortable to use as a pattern. The motivation behind this is that currently the pattern needs to be applied to the scope op of the region in which allocators should be promoted. However, a more natural way to apply the pattern would be to apply it on the allocator directly. This is not only clearer but easier to parallelize. This revision changes the mem2reg pattern to operate this way. This required restraining the interfaces to only mutate IR using RewriterBase, as the previously used escape hatch is not granular enough to match on the region that is modified only. This has the unfortunate cost of preventing batching allocator promotion and making the block argument adding logic more complex. Because batching no longer made any sense, I made the internal analyzer/promoter decoupling private again. This also adds statistics to the mem2reg infrastructure. Reviewed By: gysit Differential Revision: https://reviews.llvm.org/D150432
* [mlir] update types in remaining Linalg TransformOps testAlex Zinenko2023-05-1617-319/+319
| | | | | | | | | | | All ops now support explicit type specification, update types to use `!transform.any_op` instead of `!pdl.operation` for consistency. Depends On D144515 Reviewed By: nicolasvasilache Differential Revision: https://reviews.llvm.org/D150592
* [mlir] make structured transform ops use typesAlex Zinenko2023-05-1646-1123/+1304
| | | | | | | | | | | | | | | | | | | | | Types have been introduced a while ago and provide for better readability and transform-time verification. Use them in the ops from the structured transform dialect extension. In most cases, the types are appended as trailing functional types or a derived format of the functional type that allows for an empty right hand size without the annoying `-> ()` syntax (similarly to `func.func` declaration that may omit the arrow). When handles are used inside mixed static/dynamic lists, such as tile sizes, types of those handles follow them immediately as in `sizes [%0 : !transform.any_value, 42]`. This allows for better readability than matching the trailing type. Update code to remove hardcoded PDL dependencies and expunge PDL from structured transform op code. Reviewed By: nicolasvasilache Differential Revision: https://reviews.llvm.org/D144515
* [mlir][linalg] Add a test for linalg.matmul --> vector.outerproductAndrzej Warzynski2023-05-161-0/+36
| | | | | | | | | Representing matmuls as a sum of outer products is central to various matrix extensions (e.g. Arm's SME). This test demonstrates how to use Linalg's vectoriser and Vector's lowerings to represent `linalg.matmul` as a chain of `vector.outerproduct` Ops. Differential Revision: https://reviews.llvm.org/D150457
* [mlir] Add mlir translate flag to print errors only.Tobias Gysi2023-05-162-3/+60
| | | | | | | | | | | The revision adds a flag to mlir translate that suppresses any non-error diagnostics. The flag is useful when importing LLVM IR to LLVM dialect, which produces a lot of warnings due to dropped metadata and debug intrinsics. Reviewed By: Dinistro Differential Revision: https://reviews.llvm.org/D150547
* [mlir][sparse] change runners to c_runnersAart Bik2023-05-154-4/+4
| | | | | | Reviewed By: Peiming Differential Revision: https://reviews.llvm.org/D150628
* [mlir][tosa] Fold consecutive negate as no-opKai Sasaki2023-05-163-0/+23
| | | | | | | | Consecutive element-wise negate should be canonicalized as no-op. Reviewed By: eric-k256 Differential Revision: https://reviews.llvm.org/D150518
* Fix MLIR build (typo in VectorOps.cpp)Mehdi Amini2023-05-151-5/+3
|
* [mlir][spirv] Check type legality using converter for vectorsLei Zhang2023-05-152-5/+30
| | | | | | | | This allows `index` vectors to be converted to SPIR-V. Reviewed By: ThomasRaoux Differential Revision: https://reviews.llvm.org/D150616
* Adopt Properties to store operations inherent Attributes in the X86Vector ↵Mehdi Amini2023-05-151-0/+1
| | | | | | | | dialect This is part of an on-going migration to adopt Properties inside MLIR. Differential Revision: https://reviews.llvm.org/D148976
* Adopt Properties to store operations inherent Attributes in the Vector dialectMehdi Amini2023-05-152-4/+7
| | | | | | This is part of an on-going migration to adopt Properties inside MLIR. Differential Revision: https://reviews.llvm.org/D148939
* Adopt Properties to store operations inherent Attributes in the Transform ↵Mehdi Amini2023-05-152-1/+2
| | | | | | | | dialect This is part of an on-going migration to adopt Properties inside MLIR. Differential Revision: https://reviews.llvm.org/D148938
* [TOSA] Add QuantizationDialect to TOSA's dependentDialectsTai Ly2023-05-151-1/+1
| | | | | | | | | | | | | | | | This adds QuantizationDialect to the dependent dialects of TOSA This fixes the intermittent bug when creating uniform quantized type when none was parsed in. LLVM ERROR: can't create type 'mlir::quant::UniformQuantizedType' because storage uniquer isn't initialized: the dialect was likely not loaded, or the type wasn't added with addTypes<...>() in the Dialect::initialize() method. This happens, for example, in convert-tfl-uint8 pass when trying to create uniform quantized type i8 with zero-point=-128 to convert from ui8 type. Signed-off-by: Tai Ly <tai.ly@arm.com> Change-Id: I204248a45fd728d0cec8dc20214cb0b74de81e7b Reviewed By: eric-k256 Differential Revision: https://reviews.llvm.org/D149354
* Fix ConstShapeOp::inferReturnTypes to be resilient to lack of propertiesMehdi Amini2023-05-151-1/+7
| | | | | The Python bindings test aren't using properties yet, this is a bit of a hack to support this here, but hopefully it'll be temporary.
* Add an operator == and != to properties, use it in DuplicateFunctionEliminationMehdi Amini2023-05-154-23/+37
| | | | Differential Revision: https://reviews.llvm.org/D150596
* Cleanup uses of getAttrDictionary() in MLIR to use ↵Mehdi Amini2023-05-1515-51/+70
| | | | | | | | | getDiscardableAttrDictionary() when possible This also speeds up some benchmarks in compiling simple fortan file by 2x! Fixes #62687 Differential Revision: https://reviews.llvm.org/D150540
* [mlir][sparse][gpu] end-to-end integration test of GPU libgen approachAart Bik2023-05-151-0/+98
| | | | | | Reviewed By: Peiming Differential Revision: https://reviews.llvm.org/D150172
* [mlir] Fix a warningKazu Hirata2023-05-151-1/+1
| | | | | | | | This patch fixes: mlir/lib/Dialect/MemRef/Utils/MemRefUtils.cpp:45:2: error: extra ';' outside of a function is incompatible with C++98 [-Werror,-Wc++98-compat-extra-semi]
* [mlir][sparse][gpu] first implementation of the GPU libgen approachAart Bik2023-05-157-18/+421
| | | | | | | | | | | | | The sparse compiler now has two prototype strategies for GPU acceleration: * CUDA codegen: this converts sparsified code to CUDA threads * CUDA libgen: this converts pre-sparsified code to cuSPARSE library calls This revision introduces the first steps required for the second approach. Reviewed By: ThomasRaoux Differential Revision: https://reviews.llvm.org/D150170
* [mlir][memref] Extract isStaticShapeAndContiguousRowMajor as a util function.Oleg Shyshkov2023-05-156-29/+74
| | | | Differential Revision: https://reviews.llvm.org/D150543
* [MLIR][ROCDL] add gpu to rocdl erf supportManupa Karunaratne2023-05-152-0/+17
| | | | | | | | | This commit adds lowering of lib func call to support erf in rocdl. Reviewed By: ThomasRaoux Differential Revision: https://reviews.llvm.org/D150355
* [mlir] allow repeated payload in structured.fuse_into_containingAlex Zinenko2023-05-154-6/+52
| | | | | | | | | | | | | | | | Structured fusion proceeds by iteratively finding the next suitable producer to be fused into the loop. Therefore, it shouldn't matter if the same producer is listed multiple times (e.g., it is used as multiple operands). Adjust the implementation of the transform op to support this case. Also fix the checking code in the interpreter to actually respect the TransformOpInterface indication that repeated payload is allowed, it seems to have been accidentally dropped in one of the refactorings. Reviewed By: nicolasvasilache Differential Revision: https://reviews.llvm.org/D150561
* [mlir][scf][bufferize] Fix bug in WhileOp analysis verificationMatthias Springer2023-05-152-4/+22
| | | | | | Block arguments and yielded values are not equivalent if there are not enough block arguments. This fixes #59442. Differential Revision: https://reviews.llvm.org/D145575
* [mlir][bufferization] Add option to dump alias setsMatthias Springer2023-05-155-1/+44
| | | | | | This is useful for debugging. Differential Revision: https://reviews.llvm.org/D143314