Commit Graph

10747 Commits

Author SHA1 Message Date
lipracer 16ed79d569 [mlir] tosa: build error when building with clang
The change of https://reviews.llvm.org/D121513#3411651
has caused a build error when building with clang:

/mnt/vss/_work/1/llvm-project/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp:599:26: error: extra ';' outside of a function is incompatible with C++98 [-Werror,-Wc++98-compat-extra-semi]
ReduceFolder(ReduceAllOp);

Reviewed By: hpmorgan, Mogball

Differential Revision: https://reviews.llvm.org/D122599
2022-03-28 20:02:15 +00:00
Mogball 979ffe97b9 [mlir] Allow RegionRange to accept ArrayRef<Region *>
Adds another pointer to the union in RegionRange to allow RegionRange to work on ArrayRef<Region *> (i.e. vectors of Region *).

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D122514
2022-03-28 19:39:42 +00:00
Mogball b73f1d2c5d [mlir][cf-sink] Accept a callback for sinking operations
(This was a TODO from the initial patch).

The control-flow sink utility accepts a callback that is used to sink an operation into a region.
The `moveIntoRegion` is called on the same operation and region that return true for `shouldMoveIntoRegion`.
The callback must preserve the dominance of the operation within the region. In the default control-flow
sink implementation, this is moving the operation to the start of the entry block.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D122445
2022-03-28 19:31:23 +00:00
Jacques Pienaar 7c38fd605b [mlir] Flip Vector dialect accessors used to prefixed form.
This has been on _Both for a couple of weeks. Flip usages in core with
intention to flip flag to _Prefixed in follow up. Needed to add a couple
of helper methods in AffineOps and Linalg to facilitate a pure flag flip
in follow up as some of these classes are used in templates and so
sensitive to Vector dialect changes.

Differential Revision: https://reviews.llvm.org/D122151
2022-03-28 11:24:47 -07:00
Mogball e51652f9bf [mlir] Simplify LoopLikeOpInterface
- Adds default implementations of `isDefinedOutsideOfLoop` and `moveOutOfLoop` since 99% of all implementations of these functions were identical
- `moveOutOfLoop` takes one operation and doesn't return anything anymore. 100% of all implementations of this function would always return `success` and uses would either respond with a pass failure or an `llvm_unreachable`.
2022-03-28 18:10:04 +00:00
William S. Moses cd331af06d [MLIR][LLVM] Mark read/write behavior of memcpy/memset/memmove
This commit adds MemWrite (and MemRead, as appropriate) to the arugments of the memset/memcpy/memmove intrinsics within the LLVM dialect

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D122552
2022-03-28 13:57:02 -04:00
Marius Brehler c5c9d6e0d5 [mlir][emitc] Adapt to move of FuncOp
Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D122305
2022-03-28 17:44:47 +02:00
Markus Böck a7865228b3 [mlir][NFC] Fix codestyle issues introduced in D121988
These were noticed in the post commit review of https://reviews.llvm.org/D121988
2022-03-28 16:55:01 +02:00
gysit d26c42af57 [mlir][linalg] Control dimensions to pad.
This revision supports padding only a subset of the iteration dimensions via an additional padding-dimensions parameter. This control allows us to pad an operation in multiple steps. For example, one may want to pad only the output dimensions of a producer matmul fused into a consumer loop nest, before tiling and padding its reduction dimension.

Depends On D122309

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D122560
2022-03-28 14:39:57 +00:00
Dominik Grewe 774818c09c Expose MlirOperationClone in Python bindings.
Expose MlirOperationClone in Python bindings.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D122526
2022-03-28 15:58:22 +02:00
gysit 58d0da885e [mlir][linalg] Use arrays to pass padding options.
Pass the padding options using arrays instead of lambdas. In particular pass the padding value as string and use the argument parser to create the padding value. Arrays are a more natural choice that matches the current use cases and avoids converting arrays to lambdas.

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D122309
2022-03-28 13:49:05 +00:00
Shraiysh Vaishay fcbf00f098 [mlir][OpenMP] Added ReductionClauseInterface
This patch adds the ReductionClauseInterface and also adds reduction
support for `omp.parallel` operation.

Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D122402
2022-03-28 14:24:28 +05:30
xndcn c0ccb69228 [mlir][spirv] Convert func.call to spv.FunctionCall
Differential Revision: https://reviews.llvm.org/D122368
2022-03-26 19:21:23 +08:00
Uday Bondhugula 5576579c86 Update affine.load folding hook to fold global splat constant loads
Enhance affine.load folding hook to fold loads on global splat constant
memrefs.

Differential Revision: https://reviews.llvm.org/D122292
2022-03-26 06:44:03 +05:30
Chia-hung Duan dda003afa6 [mlir] Add InferTensorType without supporting reifyReturnTypeShapes
This is useful for the case that we don't need to implement
reifyReturnTypeShapes.

Reviewed By: jpienaar

Differential Revision: https://reviews.llvm.org/D121403
2022-03-25 19:04:34 +00:00
Christopher Bate 3be7c28917 [mlir][NVVM] Add support for nvvm mma.sync ops
This patch adds MLIR NVVM support for the various NVPTX `mma.sync`
operations. There are a number of possible data type, shape,
and other attribute combinations supported by the operation, so a
custom assebmly format is added and attributes are inferred where
possible.

Reviewed By: ThomasRaoux

Differential Revision: https://reviews.llvm.org/D122410
2022-03-25 17:28:05 +00:00
lipracer 5161835d5a [mlir][tosa] : adding folder and canonicalizer for select
define canonicalizer and folder for tosa::select

Reviewed By: mehdi_amini, Mogball

Differential Revision: https://reviews.llvm.org/D121513
2022-03-25 16:50:29 +00:00
Javier Setoain ccb54d5b42 [mlir][Vector] Add integration tests for ArmSVE
In order to run these integration tests, it is required access to an
SVE-enabled CPU or and emulator with SVE support. In case of using
an emulator, aarch64 versions of lli and the MLIR C Runner Utils Library
are also required.

Differential Revision: https://reviews.llvm.org/D104517
2022-03-25 13:21:27 +00:00
Sergei Lebedev 5177676261 Updated MLIR type stubs to work with pytype
The diff is big, but there are in fact only three kinds of changes

* ir.py had a synax error -- underminated [
* forward references are unnecessary in .pyi files (see 9a76b13127/CONTRIBUTING.md?plain=1#L450-L454)
* methods defined via .def_static() are now decorated with @staticmethod

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D122300
2022-03-25 13:38:49 +01:00
Benjamin Kramer 12bd1ef37c [bazel] Add missing dependency after a75a46db89 2022-03-25 12:02:36 +01:00
Javier Setoain 7783a178f5 [mlir][Sparse] Add option for VLA sparsification
Use "enable-vla-vectorization=vla" to generate a vector length agnostic
loops during vectorization. This option works for vectorization strategy 2.

Differential Revision: https://reviews.llvm.org/D118379
2022-03-25 10:54:49 +00:00
Javier Setoain a75a46db89 [mlir][Vector] Enable create_mask for scalable vectors
The way vector.create_mask is currently lowered is
vector-length-dependent, and therefore incompatible with scalable vector
types. This patch adds an alternative lowering path for create_mask
operations that return a scalable vector mask.

Differential Revision: https://reviews.llvm.org/D118248
2022-03-25 10:48:59 +00:00
Thomas Raoux d77f483640 [mlir][gpu] Relax restriction on mma load/store op
Those ops can support more complex layout as long as the most inner
dimension is contiguous.

Differential Revision: https://reviews.llvm.org/D122452
2022-03-25 04:03:40 +00:00
Groverkss fcbe64ddb8 [MLIR][Presburger] Merge PresburgerLocalSpace and PresburgerSpace
This patch is a cleanup patch that merges PresburgerLocalSpace and
PresburgerSpace. Asserting that there are no locals is shifted to the
users of PresburgerSpace themselves.

The reasoning for this patch is that PresburgerLocalSpace did not contribute
much and only introduced additional complexity as locals could still be present
in PresburgerSpace, just not writable. This could introduce problems if a
PresburgerSpace with locals was copied to PresburgerLocalSpace which expected
no locals in a PresburgerSpace.

Reviewed By: arjunp

Differential Revision: https://reviews.llvm.org/D122353
2022-03-25 05:36:32 +05:30
Thomas Raoux 33d2a780a1 [mlir][linalg] Add pattern to split reduction dimension in a linalg op
This transformation allow to break up a reduction dimension in a
parallel and a reduction dimension. This is followed by a separate
reduction op. This allows to generate tree reduction which is beneficial
on target allowing to take advantage parallelism.

Differential Revision: https://reviews.llvm.org/D122045
2022-03-24 23:22:53 +00:00
Lei Zhang cf9c606a97 [mlir][spirv] Add Apple into the vendor list
Reviewed By: ThomasRaoux, hanchung

Differential Revision: https://reviews.llvm.org/D122414
2022-03-24 16:51:47 -04:00
Shraiysh Vaishay 8722c12c12 [mlir][OpenMP][IRBuilder] Add support for nowait on single construct
This patch adds the nowait parameter to `createSingle` in
OpenMPIRBuilder and handling for IR generation from OpenMP Dialect.

Also added tests for the same.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D122371
2022-03-24 22:51:52 +05:30
gysit b1b57f8104 [mlir][linalg] Support padding LinalgOps in use-def chain.
Previously, only LinalgOps whose operands are defined by an ExtractSliceOp could be padded. The revision supports walking a use-def chain of LinalgOps to find an ExtractSliceOp.

Reviewed By: hanchung

Differential Revision: https://reviews.llvm.org/D122116
2022-03-24 10:44:44 +00:00
gysit 53f7fb0a87 [mlir][linalg] Do not fuse shape-only producers.
This revision introduces a heuristic to stop fusion for shape-only tensors. A shape-only tensor only defines the shape of the consumer computation while the data is not used. Pure producer consumer fusion thus shall not fuse the producer of a shape-only tensor. In particular, since the shape-only tensor will have other uses that actually consume the data.

The revision enables fusion for consumers that have two uses of the same tensor. One as input operand and one as shape-only output operand. In these cases, we want to fuse only the input operand and avoid output fusion via iteration argument.

Reviewed By: hanchung

Differential Revision: https://reviews.llvm.org/D120981
2022-03-24 10:22:41 +00:00
Dávid Bolvanský 431c14248b [NFCI] Fix set-but-unused warning in SPIRVUtilsGen.cpp 2022-03-24 08:53:42 +01:00
gysit b257dba58e [mlir][linalg] Create AffineMinOp map in canoncial form.
Create the AffineMinOp used to compute the padding width in canonical form and update the tests.

Reviewed By: springerm

Differential Revision: https://reviews.llvm.org/D122311
2022-03-24 06:55:59 +00:00
Shraiysh Vaishay 86f156a49b [mlir][OpenMP][NFC] Remove unnecessary attributes
These attributes were added because of oilist required them earlier. It
no longer requires them and so these attributes can be safely removed
from the operations.

Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D122289
2022-03-24 10:13:06 +05:30
Shraiysh Vaishay 3c0d470865 [mlir][OpenMP] omp.single translation to LLVM IR
This patch adds translation from omp.single to LLVM IR.

Depends on D122288

Reviewed By: ftynse, kiranchandramohan

Differential Revision: https://reviews.llvm.org/D122297
2022-03-24 10:07:30 +05:30
Arjun P 30c0a14846 [MLIR][Presburger] Matrix::insertColumns: add doc, fix lint issue, and early exit when possible
Reviewed By: Groverkss

Differential Revision: https://reviews.llvm.org/D122137
2022-03-24 00:42:55 +00:00
Arjun P 4418669f1e [MLIR][Presburger] PWMAFunction::valueAt: support local ids
Add a baseline implementation of support for local ids for `PWMAFunction::valueAt`. This can be made more efficient later if needed by handling locals with known div representations separately.

Reviewed By: Groverkss

Differential Revision: https://reviews.llvm.org/D122144
2022-03-24 00:42:21 +00:00
Arjun P 5630143af3 [MLIR][Presburger] LexSimplex::addEquality: add equalities as fixed columns
In LexSimplex, instead of adding equalities as a pair of inequalities,
add them as a single row, move them into the basis, and keep them there.

There will always be a valid basis involving all non-redundant equalities. Such
equalities will then be ignored in some other operations, such as when looking
for pivot columns. This speeds them up a little bit.

More importantly, this is an important precursor patch to adding support for
symbolic integer lexmin, as this heuristic can sometimes make a big difference there.

Reviewed By: Groverkss

Differential Revision: https://reviews.llvm.org/D122165
2022-03-24 00:41:17 +00:00
Arjun P 08543a5a47 [MLIR][Presburger] Introduce SimplexRollbackScopeExit to rollback on scope exit
This simplifies many places where we just want to do something in a "transient context"
and return some value.

Reviewed By: Groverkss

Differential Revision: https://reviews.llvm.org/D122172
2022-03-24 00:27:47 +00:00
Arjun P 93b9f50b4c [MLIR][Presburger] IntegerRelation: implement partial rollback support
It is often necessary to "rollback" IntegerRelations to an earlier state. Although providing full rollback support is non-trivial, we really only need to support the case where the only changes made are to append ids or append constraints, and then rollback these additions. This patch adds support to rollback in such situations by recording the number of ids and constraints of each kind and providing support to truncate the IntegerRelation to those counts by removing appended ids and constraints. This already simplifies subtraction a little bit and will also be useful in the implementation of symbolic integer lexmin.

Reviewed By: Groverkss

Differential Revision: https://reviews.llvm.org/D122178
2022-03-24 00:27:21 +00:00
Chia-hung Duan 14ecafd0bd [mlir] Make OpBuilder::createOperation to accept raw inputs
This provides a way to create an operation without manipulating
OperationState directly. This is useful for creating unregistered ops.

Reviewed By: rriddle, mehdi_amini

Differential Revision: https://reviews.llvm.org/D120787
2022-03-23 22:13:48 +00:00
Jacques Pienaar 450692d5b4 [mlir] Add simple fuzzer for textual format
Only use this on generic parser for now by not registering any dialect. For flushing out some parser bugs. The textual format is not meant to be load bearing in production runs, but still useful to remove edge cases/failures.

Differential Revision: https://reviews.llvm.org/D122267
2022-03-23 14:33:50 -07:00
Mogball 7c72f55ea8 [mlir] Fix emitting an error at EOF
Emitting at error at EOF will emit the diagnostic past the end of the file. When emitting an error during parsing at EOF, emit it at the previous character.

Reviewed By: jpienaar

Differential Revision: https://reviews.llvm.org/D122295
2022-03-23 20:23:01 +00:00
Nathaniel McVicar 4907cfe2cb [mlir][MemRef] Fix warning on unsigned comparison
Fix warning in clang introduced in D121766.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D122333
2022-03-23 12:47:04 -07:00
wren romano ebc8466481 [mlir][sparse] Adding {pointer,index}OverheadTypeEncoding
Work towards: https://github.com/llvm/llvm-project/issues/51652

The new functions fill the gap between `overheadTypeEncoding` and `get{Pointer,Index}OverheadType`.

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D122056
2022-03-23 12:04:47 -07:00
Matthias Springer 3b74aac29c [mlir][bufferize] Do not run the buffer deallocation pass if no allocs escape block boundaries
This fixes a bufferization issue with ops that are not supported by the buffer deallocation pass when `allow-return-allocs=0`.

Differential Revision: https://reviews.llvm.org/D122304
2022-03-23 21:07:35 +09:00
Shraiysh Vaishay 11ed2d4acd [mlir][OpenMP] Add omp.single
This patch adds omp.single according to Section 2.8.2 of OpenMP 5.0.

Also added tests for the same.

Reviewed By: peixin

Differential Revision: https://reviews.llvm.org/D122288

Co-authored-by: Kiran Kumar T P <kirankumar.tp@amd.com>
2022-03-23 16:45:27 +05:30
Arjun P 87cffeb635 [MLIR][Presburger] support IntegerRelation::convertIdKind
Reviewed By: Groverkss

Differential Revision: https://reviews.llvm.org/D122154
2022-03-23 11:12:08 +00:00
Arjun P ff44760427 [MLIR][Presburger] add Simplex:addDivisionVariable
This is a convenience function for adding new divisions to the Simplex given the numerator and denominator.

This will be needed for symbolic integer lexmin support.

Reviewed By: Groverkss

Differential Revision: https://reviews.llvm.org/D122159
2022-03-23 10:53:32 +00:00
Ingo Müller 3bacd94c31 Fix link to Rationale document from doc on tuple.
This also replaces the absolute link to the same document with a
relative one in the same file.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D121814
2022-03-23 09:53:31 +00:00
Shraiysh Vaishay b244bba582 [mlir][OpenMP] Added assembly format for omp.wsloop and remove parseClauses
This patch
 - adds assembly format for `omp.wsloop` operation
 - removes the `parseClauses` clauses as it is not required anymore

This is expected to be the final patch in a series of patches for replacing
parsers for clauses with `oilist`.

Reviewed By: Mogball

Differential Revision: https://reviews.llvm.org/D121367
2022-03-23 10:02:02 +05:30
jacquesguan f4037650e0 [mlir][NFC] Remove redundant let assignment.
We already have bit hasFolder = 0 in the defination of the class Op, so no need to have another let assignment here.

Differential Revision: https://reviews.llvm.org/D122222
2022-03-23 10:22:27 +08:00