Commit Graph

4763 Commits

Author SHA1 Message Date
Diego Caballero 2e7a084591 [mlir][Affine] Revisit fusion candidates after successful fusion
This patch changes the fusion algorithm so that after fusing two loop nests
we revisit previously visited nodes so that they are considered again for
fusion in the context of the new fused loop nest.

Reviewed By: bondhugula

Differential Revision: https://reviews.llvm.org/D81609
2020-06-11 14:53:08 -07:00
Jacques Pienaar 7f13d51ee3 [mlir] Remove Broadcastable ODS trait
Alias to ResultsBroadcastableShape ODS trait which matches C++ class.
2020-06-11 13:45:09 -07:00
Alexander Belyaev e9ac792748 [mlir] Fix some of the warnings in MLIR code.
Summary:
* extra ';' in the following files:
    mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp
    mlir/lib/Dialect/Shape/IR/Shape.cpp

* base class ‘mlir::ConvertVectorToSCFBase<ConvertVectorToSCFPass>’
  should be explicitly initialized in the copy constructor [-Wextra] in
    mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp

* warning: ‘bool Expression::operator==(const Expression&) const’
  defined but not used [-Wunused-function] in
    mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-gen.cpp

Differential Revision: https://reviews.llvm.org/D81673
2020-06-11 22:18:32 +02:00
jerryyin eedd8fe62e [mlir][rocdl] Fixing breakage of dim operator from 904f91db
Summary:
* Update the unit test dimOp index to be an operand
* Refactored the constant naming

Subscribers: mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, nicolasvasilache, csigg, arpith-jacob, mgester, lucyrfox, liufengdb, stephenneuendorffer, Joonsoo, grosul1, frgossen, Kayjukh, jurahul, msifontes

Tags: #mlir

Differential Revision: https://reviews.llvm.org/D81663
2020-06-11 17:35:22 +00:00
Alexander Belyaev 4e19ba4159 [mlir][shape] Add assemblyFormat for `shape.add`.
Differential Revision: https://reviews.llvm.org/D81644
2020-06-11 18:35:05 +02:00
jerryyin 2abad3433f [mlir][rocdl] Adding vector to ROCDL dialect lowering
* Created the vector to ROCDL lowering pass
  * The lowering pass lowers vector transferOps to rocdl mubufOps
* Added unit test and functional test
2020-06-11 14:28:13 +00:00
Alexander Belyaev 9d1e0dd6b9 [mlir][linalg] Fix the type (indicies->indices). 2020-06-11 13:09:13 +02:00
Alexander Belyaev 0b781db908 [mlir] Add new builders to linalg.reshape.
Differential Revision: https://reviews.llvm.org/D81640
2020-06-11 12:47:35 +02:00
Jakub Lichman 2beacda4f6 [mlir][Linalg][Doc] Fix of misleading example in Property 2
Code example in MLIR Linalg doc fixed because it referenced non-existing variables and some parameters were of wrong types.

Differential Revision: https://reviews.llvm.org/D81633
2020-06-11 10:50:34 +02:00
Mehdi Amini 1cf14860db Revert "[mlir][spirv] Enhance structure type member decoration handling"
This reverts commit 4b7aa6c8c1.

This broke gcc builds.
2020-06-11 00:52:03 +00:00
Rahul Joshi 475935113c [MLIR] Emit debug message if inlining fails
Summary: Emit a debug message if inlining fails.

Differential Revision: https://reviews.llvm.org/D81320
2020-06-10 17:38:41 -07:00
Rahul Joshi 685d7ee614 [MLIR] Add ArrayAttr::empty()
Summary: Add ArrayAttr::empty() to check for an empty ArrayAttr

Differential Revision: https://reviews.llvm.org/D81579
2020-06-10 17:37:24 -07:00
Rahul Joshi a0dd5e876f [MLIR] Print function name when ReturnOp verification fails
Summary:
- Print function name when ReturnOp verification fails
- This helps easily finding the invalid ReturnOp in an IR dump.

Differential Revision: https://reviews.llvm.org/D81513
2020-06-10 17:22:49 -07:00
Rob Suderman 3d56f166bd [mlir][StandardOps] Updated IndexCastOp to support tensor<index> cast
Summary:
We now support index casting for tensor<index> to tensor<int>. This
better supports compatibility with the Shape dialect.

Differential Revision: https://reviews.llvm.org/D81611
2020-06-10 17:19:08 -07:00
River Riddle 51114686d5 [mlir][NFC] Split Parser into several different files.
Summary: At this point Parser has grown to be over 5000 lines and can be very difficult to navigate/update/etc. This commit splits Parser.cpp into several sub files focused on parsing specific types of entities; e.g., Attributes, Types, etc.

Differential Revision: https://reviews.llvm.org/D81299
2020-06-10 17:17:13 -07:00
HazemAbdelhafez 4b7aa6c8c1 [mlir][spirv] Enhance structure type member decoration handling
Modify structure type in SPIR-V dialect to support:
1) Multiple decorations per structure member
2) Key-value based decorations (e.g., MatrixStride)

This commit kept the Offset decoration separate from members'
decorations container for easier implementation and logical clarity.
As such, all references to Structure layoutinfo are now offsetinfo,
and any member layout defining decoration (e.g., RowMajor for Matrix)
will be add to the members' decorations container along with its
value if any.

Differential Revision: https://reviews.llvm.org/D81426
2020-06-10 19:25:03 -04:00
George Mitenkov d93d8fcdec [MLIR][SPIRVToLLVM] Implemented conversion for arithmetic ops and 3 bitwise ops.
Following the previous revision `D81100`, this commit implements a templated class
that would provide conversion patterns for “straightforward” SPIR-V ops into
LLVM dialect. Templating allows to abstract away from concrete implementation
for each specific op. Those are mainly binary operations. Currently supported
and tested ops are:
- Arithmetic ops: `IAdd`, `ISub`, `IMul`, `FAdd`, `FSub`, `FMul`, `FDiv`,  `FNegate`,
  `SDiv`, `SRem` and  `UDiv`
- Bitwise ops: `BitwiseAnd`, `BitwiseOr`, `BitwiseXor`

The implementation relies on `SPIRVToLLVMConversion` class that makes use of
`OpConversionPattern`.

Differential Revision: https://reviews.llvm.org/D81305
2020-06-10 19:10:31 -04:00
Alexander Belyaev 0f8d40f0d6 [mlir][linalg] Add a builder for `linalg.(indexed_)generic`.
Differential Revision: https://reviews.llvm.org/D81610
2020-06-10 23:52:41 +02:00
Mehdi Amini 51a822724d Register printer and context CL options with the toyc example
The tutorial refers to invoking toyc with '-mlir-print-debuginfo' but
it wasn't registered anymore.

Differential Revision: https://reviews.llvm.org/D81604
2020-06-10 19:59:40 +00:00
Mehdi Amini 83d920c72a Fix MLIR test: -dump-input-on-failure is no longer a valid option 2020-06-10 15:58:58 +00:00
Frederik Gossen 904f91db5f [MLIR][Standard] Make the `dim` operation index an operand.
Allow for dynamic indices in the `dim` operation.
Rather than an attribute, the index is now an operand of type `index`.
This allows to apply the operation to dynamically ranked tensors.
The correct lowering of dynamic indices remains to be implemented.

Differential Revision: https://reviews.llvm.org/D81551
2020-06-10 13:54:47 +00:00
Frederik Gossen e4184c84ca [MLIR][Shape] Make dimension an operand of `get_extent`
The operation `get_extent` now accepts the dimension as an operand and is no
longer limited to constant dimensions.
A helper function facilitates the common constant use case.

Differential Revision: https://reviews.llvm.org/D81248
2020-06-10 11:47:18 +00:00
Stephen Neuendorffer d3ead060be [JitRunner] add support for i32 and i64 output
Differential Revision: https://reviews.llvm.org/D80675
2020-06-09 22:25:03 -07:00
Stephen Neuendorffer 698462336a [MLIR] expose applyCmpPredicate
This is useful for manipulating the standard dialect from transformations
outside of the standard dialect.

Differential Revision: https://reviews.llvm.org/D80609
2020-06-09 22:25:03 -07:00
aartbik 1e45b55dcc [mlir] [VectorOps] Handle 'vector.shape_cast' lowering for all cases
Summary:
Even though this operation is intended for 1d/2d conversions currently,
leaving a semantic hole in the lowering prohibits proper testing of this
operation. This CL adds a straightforward reference implementation for the
missing cases.

Reviewers: nicolasvasilache, mehdi_amini, ftynse, reidtatge

Reviewed By: reidtatge

Subscribers: mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, stephenneuendorffer, Joonsoo, grosul1, frgossen, Kayjukh, jurahul, msifontes

Tags: #mlir

Differential Revision: https://reviews.llvm.org/D81503
2020-06-09 16:08:45 -07:00
Mehdi Amini d31c9e5a46 Change filecheck default to dump input on failure
Having the input dumped on failure seems like a better
default: I debugged FileCheck tests for a while without knowing
about this option, which really helps to understand failures.

Remove `-dump-input-on-failure` and the environment variable
FILECHECK_DUMP_INPUT_ON_FAILURE which are now obsolete.

Differential Revision: https://reviews.llvm.org/D81422
2020-06-09 18:57:46 +00:00
Stephan Herhut 2c8afe1298 [mlir][gpu] Add support for f16 when lowering to nvvm intrinsics
Summary:
The NVVM target only provides implementations for tanh etc. on f32 and
f64 operands. To also support f16, we now insert operations to extend to f32
and truncate back to f16 around the intrinsic call.

Differential Revision: https://reviews.llvm.org/D81473
2020-06-09 19:33:45 +02:00
msifontes 1c189d71db [mlir] Add number of operands verification for shape.assuming_all operation
Implemented a verification to ensure that the shape.assuming_all
operation always has at least one operand.
2020-06-09 09:59:04 -07:00
Jacques Pienaar 48c28d58c6 [mlir] Unranked memref type has no rank
Summary:
UnrankedMemRefType doesn't have a rank but previously this was just
checking for unranked tensor. Avoids failure later if one queries the shape
post checking if ranked.

Differential Revision: https://reviews.llvm.org/D81441
2020-06-08 18:08:14 -07:00
George Mitenkov fda5192d4f [MLIR][SPIRVToLLVM] Add skeleton for SPIR-V to LLVM dialect conversion
These commits set up the skeleton for SPIR-V to LLVM dialect conversion.
I created SPIR-V to LLVM pass, registered it in Passes.td, InitAllPasses.h.
Added a pattern for `spv.BitwiseAndOp` and tests for it. Integer, float
and vector types are converted through LLVMTypeConverter.

Differential Revision: https://reviews.llvm.org/D81100
2020-06-08 18:22:42 -04:00
KareemErgawy a6d6b0ac93 [MLIR][Toy] Fix a few typos in the comments/docs.
Fixes a few typos and errors in MLIR's Toy tutorial docs and comments.

Differential Revision: https://reviews.llvm.org/D81406
2020-06-08 18:18:47 -04:00
Alexander Belyaev 80be54c08f [mlir] Lower Shape binary ops (AddOp, MulOp) to Standard.
Differential Revision: https://reviews.llvm.org/D81344
2020-06-08 17:48:01 +02:00
Wen-Heng (Jack) Chung 603b974cf7 [mlir][gpu] Fix logic error in D79508 computing number of private attributions.
Fix logic error in D79508. The old logic would make the first check in
`GPUFuncOp::verifyBody` always pass.
2020-06-08 07:40:34 -05:00
Frederik Gossen 215914151e [MLIR][Shape] Add support for `OpAsmInterface` in `shape.const_size`
The SSA values created with `shape.const_size` are now named depending on the
value.
A constant size of 3, e.g., is now automatically named `%c3`.

Differential Revision: https://reviews.llvm.org/D81249
2020-06-08 10:27:28 +00:00
Alexander Belyaev 250dcf61ae Revert "Revert "[MLIR] Lower shape.num_elements -> shape.reduce.""
This reverts commit a25f5cd70c.

Now the build with `-DBUILD_SHARED_LIBS=ON` is fixed.
2020-06-08 12:19:54 +02:00
Frederik Gossen 970bb4a291 [MLIR] Add `to/from_extent_tensor` lowering to the standard dialect
The operations `to_extent_tensor` and `from_extent_tensor` become no-ops when
lowered to the standard dialect.
This is possible with a lowering from `shape.shape` to `tensor<?xindex>`.

Differential Revision: https://reviews.llvm.org/D81162
2020-06-08 09:38:18 +00:00
Frederik Gossen 867bc41e85 [MLIR] Add type conversion for `shape.shape`
Convert `shape.shape` to `tensor<?xindex>` when lowering the `shape` to the
`std` dialect.

Differential Revision: https://reviews.llvm.org/D81161
2020-06-08 09:34:03 +00:00
Frederik Gossen 24edbdf99b [MLIR] Clean up `shape` to `std` lowering
Apply post-commit suggestions to the new lowering.

Differential Revision: https://reviews.llvm.org/D81160
2020-06-08 08:59:53 +00:00
Tres Popp 68a8336bf2 Revert "Revert "[mlir] Folding and canonicalization of shape.cstr_eq""
This reverts commit 12e31f6e40.
2020-06-08 10:06:55 +02:00
Tres Popp d216f983e6 Revert "Revert "[mlir] Canonicalization and folding of shape.cstr_broadcastable""
This reverts commit 4261b026ad.
2020-06-08 10:06:55 +02:00
Tres Popp 5d77bd733e [mlir] Restructure Shape dialect's CMakeLists.
Now targets are only built with files in the same directory.

Differential Revision: https://reviews.llvm.org/D81328
2020-06-08 10:06:38 +02:00
Ehsan Toosi 4214031d43 [mlir] Introduce allowMemrefFunctionResults for the helper operation converters of buffer placement
This parameter gives the developers the freedom to choose their desired function
signature conversion for preparing their functions for buffer placement. It is
introduced for BufferAssignmentFuncOpConverter, and also for
BufferAssignmentReturnOpConverter, and BufferAssignmentCallOpConverter to adapt
the return and call operations with the selected function signature conversion.
If the parameter is set, buffer placement won't also deallocate the returned
buffers.

Differential Revision: https://reviews.llvm.org/D81137
2020-06-08 09:25:41 +02:00
Mehdi Amini a25f5cd70c Revert "[MLIR] Lower shape.num_elements -> shape.reduce."
This reverts commit e80617df89.

This broke the build with `-DBUILD_SHARED_LIBS=ON`
2020-06-07 19:32:36 +00:00
Alexander Belyaev e80617df89 [MLIR] Lower shape.num_elements -> shape.reduce.
Differential Revision: https://reviews.llvm.org/D81279
2020-06-07 16:39:21 +02:00
Alexander Belyaev 50f68c1e33 [mlir] Add verifier for `shape.yield`.
Differential Revision: https://reviews.llvm.org/D81262
2020-06-07 15:40:11 +02:00
Jacques Pienaar 92cb0ce8f8 [mlir] Change to re-enable cuda-runner tests
mlir-cuda-runner tests were failing post
https://reviews.llvm.org/D80676, small change to get those passing
again. More cleanup may be needed post.
2020-06-06 09:31:51 -07:00
Tres Popp 4261b026ad Revert "[mlir] Canonicalization and folding of shape.cstr_broadcastable"
This reverts commit 6aab709459.

Some users have failing builds with ShapeCanonicalization.td, so revert
for now.
2020-06-06 11:17:44 +02:00
Tres Popp 12e31f6e40 Revert "[mlir] Folding and canonicalization of shape.cstr_eq"
This reverts commit 0a554e607f.

Some users have build failures when building ShapeCanonicalization.td,
so revert changes that created and rely on it.
2020-06-06 11:08:41 +02:00
Tres Popp cf72027b35 [mlir] Move attr-dict to end of Shape dialect ops
Summary: This is to be consistent with most other assemblyFormat examles in MLIR.

Differential Revision: https://reviews.llvm.org/D81245
2020-06-06 10:05:55 +02:00
Wen-Heng (Jack) Chung 47073ccd4e [mlir][mlir-rocm-runner] Detect HIP version and AMD ISA version.
Summary:
Prior to ROCm / HIP 3.5, HSA code object V2 is the default binary format.
Starting from ROCm 3.5, HSA code object V3 becomes default.

Also invoke `rocm_agent_enumerator` to detect proper AMD ISA version on the
system. Use `gfx900` as the fallback value.

Reviewers: jerryyin yaxunl

Subscribers: mgorny, yaxunl, mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, stephenneuendorffer, Joonsoo, grosul1, frgossen, Kayjukh, jurahul, msifontes

Tags: #mlir

Differential Revision: https://reviews.llvm.org/D81309
2020-06-05 22:15:23 -05:00