8229 Commits

Author SHA1 Message Date
Valentin Clement
1e463942f4
[mlir][openacc] Cleanup acc.kernels from old data clause operands
Remove old clause operands from acc.kernels operation since
the new dataOperands is now in place.
private and firstprivate will receive some redesign but are
not part of the new dataOperands.

Depends on D150224

Reviewed By: vzakhari

Differential Revision: https://reviews.llvm.org/D150225
2023-05-10 08:38:03 -07:00
Valentin Clement
3484745a5f
[mlir][openacc] Cleanup acc.serial from old data clause operands
Remove old clause operands from acc.serial operation since
the new dataOperands is now in place.
private and firstprivate will receive some redesign but are
not part of the new dataOperands.

Depends on D150207

Reviewed By: vzakhari

Differential Revision: https://reviews.llvm.org/D150224
2023-05-10 08:34:25 -07:00
Mehdi Amini
890aa28f1c Adopt Properties to store operations inherent Attributes in the Quant dialect
This is part of an on-going migration to adopt Properties inside MLIR.

Differential Revision: https://reviews.llvm.org/D148900
2023-05-10 14:53:38 +01:00
Mehdi Amini
d2b8c8eabc Adopt Properties to store operations inherent Attributes in the PDLInterp dialect
This is part of an on-going migration to adopt Properties inside MLIR.

Differential Revision: https://reviews.llvm.org/D148899
2023-05-10 14:53:38 +01:00
Mehdi Amini
307d0cceb9 Adopt Properties to store operations inherent Attributes in the PDL dialect
This is part of an on-going migration to adopt Properties inside MLIR.

Differential Revision: https://reviews.llvm.org/D148898
2023-05-10 14:53:38 +01:00
Mehdi Amini
643f3775e5 Adopt Properties to store operations inherent Attributes in the OpenMP dialect
This is part of an on-going migration to adopt Properties inside MLIR.

Differential Revision: https://reviews.llvm.org/D148897
2023-05-10 14:53:38 +01:00
Mehdi Amini
23b9523046 Adopt Properties to store operations inherent Attributes in the OpenACC dialect
This is part of an on-going migration to adopt Properties inside MLIR.

Differential Revision: https://reviews.llvm.org/D148896
2023-05-10 14:53:38 +01:00
Mahesh Ravishankar
f12639d0d6 [mlir][Linalg] Avoid collapsing dimensions of linalg op that arent foldable.
The collapsing dimensions transformation is limited to only those
cases where the sequence of dimensions are contiguous in all the
ranges of the indexing maps of the operation. Add this check before
applying the transformation.

Differential Revision: https://reviews.llvm.org/D150176
2023-05-10 05:45:02 +00:00
Mehdi Amini
5b758821fd Adopt Properties to store operations inherent Attributes in the NVGPU dialect
This is part of an on-going migration to adopt Properties inside MLIR.

Differential Revision: https://reviews.llvm.org/D148895
2023-05-10 01:31:00 +01:00
Mehdi Amini
9bda58120f Adopt Properties to store operations inherent Attributes in the MLProgram dialect
This is part of an on-going migration to adopt Properties inside MLIR.

Differential Revision: https://reviews.llvm.org/D148894
2023-05-10 01:31:00 +01:00
Mehdi Amini
3e0ab6a21a Adopt Properties to store operations inherent Attributes in the Memref dialect
This is part of an on-going migration to adopt Properties inside MLIR.

Differential Revision: https://reviews.llvm.org/D148893
2023-05-10 01:31:00 +01:00
Mehdi Amini
2fe23ffdd3 Adopt Properties to store operations inherent Attributes in the Math dialect
This is part of an on-going migration to adopt Properties inside MLIR.

Differential Revision: https://reviews.llvm.org/D148892
2023-05-10 01:31:00 +01:00
Mehdi Amini
feace14fb9 Adopt Properties to store operations inherent Attributes in the IRDL dialect
This is part of an on-going migration to adopt Properties inside MLIR.

Differential Revision: https://reviews.llvm.org/D148891
2023-05-10 01:31:00 +01:00
Mehdi Amini
788b9e9b65 Adopt Properties to store operations inherent Attributes in the Index dialect
This is part of an on-going migration to adopt Properties inside MLIR.

Differential Revision: https://reviews.llvm.org/D148890
2023-05-10 01:30:59 +01:00
Ivan Butygin
4142952352 [mlir][gpu] Reduction ops canonicalizatios
Make group ops uniform if `gpu.launch` is their direct parent.

Differential Revision: https://reviews.llvm.org/D149183
2023-05-10 00:33:42 +02:00
Valentin Clement
5e983942d5
[mlir][openacc] Cleanup acc.parallel from old data clause operands
Remove old clause operands from acc.parallel operation since
the new dataOperands is now in place.
private, firstprivate and reductions will receive some redesign but are
not part of the new dataOperands.

Reviewed By: razvanlupusoru

Differential Revision: https://reviews.llvm.org/D150207
2023-05-09 14:57:50 -07:00
Valentin Clement
46e1b095c9
[mlir][openacc] Cleanup acc.data from old data clause operands
Since the new data operand operations have been added in D148389 and
adopted on acc.data in D149673, the old clause operands are no longer
needed.

The LegalizeDataOpForLLVMTranslation will become obsolete when all
operations will be cleaned. For the time being only the appropriate
part are being removed.

processOperands will also receive some updates once all the operands
will be coming from an acc data operand operation.

Reviewed By: razvanlupusoru

Differential Revision: https://reviews.llvm.org/D150155
2023-05-09 13:21:37 -07:00
Valentin Clement
15a480c05e
[mlir][openacc] Cleanup acc.exit_data from old data clause operands
Since the new data operand operations have been added in D148389 and
adopted on acc.exit_data in D149601, the old clause operands are no longer
needed.

The LegalizeDataOpForLLVMTranslation will become obsolete when all
operations will be cleaned. For the time being only the appropriate
part are being removed.

processOperands will also receive some updates once all the operands
will be coming from an acc data operand operation.

Reviewed By: jeanPerier

Differential Revision: https://reviews.llvm.org/D150145
2023-05-09 11:36:48 -07:00
Valentin Clement
9dec07f44a
[mlir][openacc] Cleanup acc.enter_data from old data clause operands
Since the new data operand operations have been added in D148389 and
adopted on acc.enter_data in D148721, the old clause operands are no longer
needed.

The LegalizeDataOpForLLVMTranslation will become obsolete when all
operations will be cleaned. For the time being only the appropriate
part are being removed.

processOperands will also receive some updates once all the operands
will be coming from an acc data operand operation.

Reviewed By: jeanPerier

Differential Revision: https://reviews.llvm.org/D150132
2023-05-09 09:01:30 -07:00
Théo Degioanni
3ba79a3681 [mlir][mem2reg] Add mem2reg rewrite pattern.
This revision introduces the ability to invoke mem2reg as a rewrite pattern. This also modified the canonical mem2reg pass to use the rewrite pattern approach.

Depends on D149825

Reviewed By: gysit

Differential Revision: https://reviews.llvm.org/D149958
2023-05-09 14:01:45 +00:00
Mehdi Amini
bdac67a9ae Adopt Properties to store operations inherent Attributes in the GPU dialect
This is part of an on-going migration to adopt Properties inside MLIR.

Differential Revision: https://reviews.llvm.org/D148889
2023-05-09 14:58:43 +01:00
Mehdi Amini
3e10d8f02c Adopt Properties to store operations inherent Attributes in the EmitC dialect
This is part of an on-going migration to adopt Properties inside MLIR.

Differential Revision: https://reviews.llvm.org/D148888
2023-05-09 14:58:42 +01:00
Mehdi Amini
ff1516ae30 Adopt Properties to store operations inherent Attributes in the DLTI dialect
This is part of an on-going migration to adopt Properties inside MLIR.

Differential Revision: https://reviews.llvm.org/D148887
2023-05-09 14:58:42 +01:00
Mehdi Amini
8e6581c5e2 Adopt Properties to store operations inherent Attributes in the ControlFlow dialect
This is part of an on-going migration to adopt Properties inside MLIR.

Differential Revision: https://reviews.llvm.org/D148886
2023-05-09 14:58:42 +01:00
Mehdi Amini
bb5cca2449 Adopt Properties to store operations inherent Attributes in the Complex dialect
This is part of an on-going migration to adopt Properties inside MLIR.

Differential Revision: https://reviews.llvm.org/D148885
2023-05-09 14:58:42 +01:00
Mehdi Amini
47a91a3d6b Adopt Properties to store operations inherent Attributes in the Bufferization dialect
This is part of an on-going migration to adopt Properties inside MLIR.

Differential Revision: https://reviews.llvm.org/D148884
2023-05-09 14:58:42 +01:00
Matthias Springer
709098fb38 [mlir][transform] SplitHandleOp: add additional distribution options
Add options to handle cases where there are not enough or too many payload ops mapped to the given handle.

Differential Revision: https://reviews.llvm.org/D149955
2023-05-09 11:38:18 +02:00
Théo Degioanni
92cc30aca7 Reland "[mlir][mem2reg] Expose algorithm internals."
This patch refactors the Mem2Reg infrastructure. It decouples
analysis from promotion, allowing for more control over the execution of
the logic. It also adjusts the interfaces to be less coupled to mem2reg
and more general. This will be useful for an upcoming revision
introducing generic SROA.

This commit reverts f333977eb20a and relands 91cff8a71872.

The original commit was reverted accidentally due to a misinterpretation
of a bazel build bot failure.

Reviewed By: gysit

Differential Revision: https://reviews.llvm.org/D149825
2023-05-09 09:24:49 +00:00
Kazu Hirata
f09b0e35b6 [mlir] Replace None with std::nullopt in comments (NFC)
This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2023-05-08 20:23:31 -07:00
Hanhan Wang
25cc5a71b3 [mlir][vector] Generalize vector.transpose lowering to n-D vectors
The existing vector.transpose lowering patterns only triggers if the
input vector is 2D. The revision extends the pattern to handle n-D
vectors which are effectively 2-D vectors (e.g., vector<1x4x1x8x1).

It refactors a common check about 2-D vectors from X86Vector
lowering to VectorUtils.h so it can be reused by both sides.

Reviewed By: dcaballe

Differential Revision: https://reviews.llvm.org/D149908
2023-05-08 10:48:26 -07:00
Valentin Clement
689afa88ae
[mlir][openacc] Cleanup acc.update from old data clause operands
Since the new data operand operations have been added in D148389 and
adopted on acc.update in D149909, the old clause operands are no longer
needed. This is a first patch to start cleaning the OpenACC operations
with data clause operands.

The `LegalizeDataOpForLLVMTranslation` will become obsolete when all
operations will be cleaned. For the time being only the appropriate
part are being removed.

`processOperands` will also receive some updates once all the operands
will be coming from an acc data operand operation.

Reviewed By: razvanlupusoru, jeanPerier

Differential Revision: https://reviews.llvm.org/D150053
2023-05-08 10:03:28 -07:00
Valentin Clement
aad53e3b26
[mlir][openacc] Add verifier for dataOperands on compute operations
Data operands associated with acc.parallel, acc.serial and
acc.kernels should comes from acc data entry/exit operations
or acc.getdeviceptr.

Reviewed By: razvanlupusoru, jeanPerier

Differential Revision: https://reviews.llvm.org/D149994
2023-05-08 09:36:57 -07:00
max
81233c70cb [MLIR][python bindings] Add PyValue.print_as_operand (Value::printAsOperand)
Useful for easier debugging (no need to regex out all of the stuff around the id).

Differential Revision: https://reviews.llvm.org/D149902
2023-05-08 10:41:35 -05:00
Mehdi Amini
8dacfdf033 Adopt Properties to store operations inherent Attributes in the Async dialect
This is part of an on-going migration to adopt Properties inside MLIR.

Differential Revision: https://reviews.llvm.org/D148883
2023-05-08 08:32:20 -07:00
Mehdi Amini
8b4a34a66f Adopt Properties to store operations inherent Attributes in the ARMSVE dialect
This is part of an on-going migration to adopt Properties inside MLIR.

Differential Revision: https://reviews.llvm.org/D148882
2023-05-08 08:32:19 -07:00
Mehdi Amini
359dd47343 Adopt Properties to store operations inherent Attributes in the ARMNeon dialect
This is part of an on-going migration to adopt Properties inside MLIR.

Differential Revision: https://reviews.llvm.org/D148881
2023-05-08 08:32:19 -07:00
Mehdi Amini
537b27903a Adopt Properties to store operations inherent Attributes in the AMX dialect
This is part of an on-going migration to adopt Properties inside MLIR.

Differential Revision: https://reviews.llvm.org/D148880
2023-05-08 08:32:19 -07:00
Mehdi Amini
7122804409 Adopt Properties to store operations inherent Attributes in the AMDGPU dialect
This is part of an on-going migration to adopt Properties inside MLIR.

Differential Revision: https://reviews.llvm.org/D148879
2023-05-08 08:32:19 -07:00
Mehdi Amini
9f2eea26a9 Adopt Properties to store operations inherent Attributes in the Affine dialect
This is part of an on-going migration to adopt Properties inside MLIR.

Differential Revision: https://reviews.llvm.org/D148878
2023-05-08 08:32:19 -07:00
Tobias Gysi
f333977eb2 Revert "[mlir][mem2reg] Expose algorithm internals."
The commit causes build bot failures due to a missing dependencies:
https://buildkite.com/llvm-project/llvm-main/builds/7036#0187fb40-e4b6-4471-a2a0-2820b71c727b

This reverts commit 91cff8a71872cf49f0c5c9e5510f8065bfefa3c3.
2023-05-08 13:32:41 +00:00
Whitney Tsang
a2ab6a5e2b [mlir][CallOpInterface] Add setCalleeFromCallable method
Currently `CallOpInterface` has a method `getCallableForCallee` to have a consistent way to get the callee from an operation with `CallOpInterface`, but missing a consistent way to set a callee for an operation with `CallOpInterface`.

A set callee method is useful for transformations that operate on `CallOpInterface`, and change the callee, e.g., a pass that specialize function, which clone the callee, and change the `CallOpInterface`'s callee to the cloned version. Without such method, transformation would need to understand the implementation for every operations with `CallOpInterface`, and have a type switch to handle them.

This review adds a method to set callee for operation with `CallOpInterface`.

Reviewed By: gysit, zero9178o

Differential Revision: https://reviews.llvm.org/D149763
2023-05-08 06:07:10 -07:00
Théo Degioanni
91cff8a718 [mlir][mem2reg] Expose algorithm internals.
This patch refactors the Mem2Reg infrastructure. It decouples
analysis from promotion, allowing for more control over the execution of
the logic. It also adjusts the interfaces to be less coupled to mem2reg
and more general. This will be useful for an upcoming revision
introducing generic SROA.

Reviewed By: gysit

Differential Revision: https://reviews.llvm.org/D149825
2023-05-08 11:48:20 +00:00
Jacques Pienaar
d717b3d987 [mlir][bytecode] Fix typo in DenseElementsAttr.
Was incorrectly marked as DenseIntElementsAttr (only used for
SparseElementsAttr).
2023-05-08 04:45:30 -07:00
Mehdi Amini
7151b94ce2 Adopt Properties to store operations inherent Attributes in the LLVM dialect
This is part of an on-going migration to adopt Properties inside MLIR.

Differential Revision: https://reviews.llvm.org/D148300
2023-05-08 04:28:12 -07:00
Mehdi Amini
f6ac7e3c6d Adopt Properties to store operations inherent Attributes in the Linalg dialect
This is part of an on-going migration to adopt Properties inside MLIR.

Differential Revision: https://reviews.llvm.org/D148299
2023-05-05 16:58:20 -07:00
Valentin Clement
437bc5640f
[mlir][openacc] Switch host/device clauses to data operand operations
Introduce acc.update_host and acc.update_device as data
operands operation to be used by the acc.update op.

Reviewed By: razvanlupusoru, jeanPerier

Differential Revision: https://reviews.llvm.org/D149909
2023-05-05 12:01:27 -07:00
Matthias Springer
288529e730 [mlir][transform] Clean up SplitHandlesOp
* Rename to `SplitHandleOp`: it splits a single handle.
* Drop `num_result_handles` attribute: it is redundant and can be inferred from the number of results.
* Improve documentation and minor code cleanups.

Differential Revision: https://reviews.llvm.org/D149937
2023-05-05 22:29:43 +09:00
Alex Zinenko
d906426944 [mlir] make transform.loop.outline also return the call handle
Outlining is particularly interesting when the outlined function is
replaced with something else, e.g., a microkernel. It is good to have a
handle to the call in this case.

Reviewed By: springerm

Differential Revision: https://reviews.llvm.org/D149849
2023-05-05 12:42:05 +00:00
Matthias Springer
d61e68ff0e [mlir][linalg][transform] linalg::tileToForallOpImpl processes only one target
`tileToForallOpImpl` takes only one target instead of a list of all targets.

This is in preparation of D149847.

Differential Revision: https://reviews.llvm.org/D149929
2023-05-05 20:35:10 +09:00
Mathieu Fehr
3ffd13b183 [mlir][irdl] Add IRDL verification constraint classes
This patch adds the necessary constraint classes that are be used
by IRDL to define Operation, Type, and Attribute verifiers.

A constraint is a class inheriting the `irdl::Constraint` class,
which may call other constraints that are indexed by `unsigned`.
A constraint represent an invariant over an Attribute.

The `ConstraintVerifier` class group these constraints together,
and make sure that a constraint can only identify a single
attribute. So, once a constraint is used to check the
satisfiability of an `Attribute`, the `Attribute` will be
memorized for this constraint. This ensure that in IRDL, a
single `!irdl.attribute` value only correspond to a single
`Attribute`.

Depends on D144693

Reviewed By: Mogball

Differential Revision: https://reviews.llvm.org/D145733
2023-05-05 11:17:23 +01:00