Commit Graph

5067 Commits

Author SHA1 Message Date
Wen-Heng (Jack) Chung 7bfcb9120f Use python3 in generate-test-checks.py.
Summary: Upgrade to python3 in generate-test-checks.py .

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/D81701
2020-06-11 19:19:22 -05:00
HazemAbdelhafez 5d74df5b03 [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-11 19:52:13 -04:00
Jacques Pienaar 8472ae1773 [mlir] Add additional header
Fix gcc10 build and closes: https://bugs.llvm.org/show_bug.cgi?id=45680
2020-06-11 16:46:49 -07:00
George Mitenkov fc148a4c88 [MLIR][SPIRVToLLVM] Added conversion for SPIR-V comparison ops
Implemented `FComparePattern` and `IComparePattern` classes
that provide conversion of SPIR-V comparison ops (such as
`spv.FOrdGreaterThanEqual` and others) to LLVM dialect.
Also added tests in `comparison-ops-to-llvm.mlir`.

Differential Revision: https://reviews.llvm.org/D81487
2020-06-11 18:46:17 -04:00
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
Diego Caballero 7d59f49bda [mlir] Fix representation of BF16 constants
This patch is a follow-up on https://reviews.llvm.org/D81127

BF16 constants were represented as 64-bit floating point values due to the lack
of support for BF16 in APFloat. APFloat was recently extended to support
BF16 so this patch is fixing the BF16 constant representation to be 16-bit.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D81218
2020-06-05 17:43:06 -07:00
Nicolas Vasilache b54a4d0f8f [mlir][Linalg] NFC - Make useFullTileBuffersByDefault option take a boolean. 2020-06-05 17:44:29 -04:00
Nicolas Vasilache b6c88549bc [mlir] Fix spurious f64 -> f16 change in CPU runner test 2020-06-05 17:23:21 -04:00
Nicolas Vasilache eb7db879af [mlir][test][CPU] Reduce the size of mlir-cpu-runner-tests
Two tests regularly show up on the long tail when testing MLIR.
This revision reduces their size.
2020-06-05 13:47:29 -04:00
Nicolas Vasilache b56bf30d3c [mlir][Vector] Add folding of memref_cast into vector_transfer ops
Summary:
This revision adds a common folding pattern that starts appearing on
vector_transfer ops.

Differential Revision: https://reviews.llvm.org/D81281
2020-06-05 13:27:00 -04:00
Nicolas Vasilache 56ce65e2b6 [mlir][Linalg] NFC - Cleanup debug, address post-commit review. 2020-06-05 13:02:34 -04:00
Jacques Pienaar b0921f68e1 [mlir] Add verify method to adaptor
This allows verifying op-indepent attributes (e.g., attributes that do not require the op to have been created) before constructing an operation. These include checking whether required attributes are defined or constraints on attributes (such as I32 attribute). This is not perfect (e.g., if one had a disjunctive constraint where one part relied on the op and the other doesn't, then this would not try and extract the op independent from the op dependent).

The next step is to move these out to a trait that could be verified earlier than in the generated method. The first use case is for inferring the return type while constructing the op. At that point you don't have an Operation yet and that ends up in one having to duplicate the same checks, e.g., verify that attribute A is defined before querying A in shape function which requires that duplication. Instead this allows one to invoke a method to verify all the traits and, if this is checked first during verification, then all other traits could use attributes knowing they have been verified.

It is a little bit funny to have these on the adaptor, but I see the adaptor as a place to collect information about the op before the op is constructed (e.g., avoiding stringly typed accessors, verifying what is possible to verify before the op is constructed) while being cheap to use even with constructed op (so layer of indirection between the op constructed/being constructed). And from that point of view it made sense to me.

Differential Revision: https://reviews.llvm.org/D80842
2020-06-05 09:47:37 -07:00
Nicolas Vasilache 38c407bf00 [mlir][SCF] Add single iteration scf.for promotion to the FuncOp level helper.
Previously only the Affine version would be folded.

Differential Revision: https://reviews.llvm.org/D81261
2020-06-05 11:28:21 -04:00
Julian Lettner 99d6e05e71 [lit] Improve naming of test result categories
Improve consistency when printing test results:
Previously we were using different labels for group names (the header
for the list of, e.g., failing tests) and summary count lines.  For
example, "Failing Tests"/"Unexpected Failures".  This commit changes lit
to label things consistently.

Improve wording of labels:
When talking about individual test results, the first word in
"Unexpected Failures", "Expected Passes", and "Individual Timeouts" is
superfluous.  Some labels contain the word "Tests" and some don't.
Let's simplify the names.

Before:
```
Failing Tests (1):
  ...

Expected Passes    : 3
Unexpected Failures: 1
```

After:
```
Failed Tests (1):
  ...

Passed: 3
Failed: 1
```

Reviewed By: ldionne

Differential Revision: https://reviews.llvm.org/D77708
2020-06-05 08:14:42 -07:00
Wen-Heng (Jack) Chung 2fd6403a6d [mlir][gpu] Introduce mlir-rocm-runner.
Summary:
`mlir-rocm-runner` is introduced in this commit to execute GPU modules on ROCm
platform. A small wrapper to encapsulate ROCm's HIP runtime API is also inside
the commit.

Due to behavior of ROCm, raw pointers inside memrefs passed to `gpu.launch`
must be modified on the host side to properly capture the pointer values
addressable on the GPU.

LLVM MC is used to assemble AMD GCN ISA coming out from
`ConvertGPUKernelToBlobPass` to binary form, and LLD is used to produce a shared
ELF object which could be loaded by ROCm HIP runtime.

gfx900 is the default target be used right now, although it could be altered via
an option in `mlir-rocm-runner`. Future revisions may consider using ROCm Agent
Enumerator to detect the right target on the system.

Notice AMDGPU Code Object V2 is used in this revision. Future enhancements may
upgrade to AMDGPU Code Object V3.

Bitcode libraries in ROCm-Device-Libs, which implements math routines exposed in
`rocdl` dialect are not yet linked, and is left as a TODO in the logic.

Reviewers: herhut

Subscribers: mgorny, tpr, dexonsmith, mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, nicolasvasilache, csigg, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, stephenneuendorffer, Joonsoo, grosul1, frgossen, Kayjukh, jurahul, llvm-commits

Tags: #mlir, #llvm

Differential Revision: https://reviews.llvm.org/D80676
2020-06-05 09:46:39 -05:00
HazemAbdelhafez cc2349e3cf [MLIR][SPIRV] Support flat, location, and noperspective decorations
Add support for flat, location, and noperspective decorations in the
serializer and deserializer to be able to process basic shader files
for graphics applications.

Differential Revision: https://reviews.llvm.org/D80837
2020-06-05 08:55:22 -04:00
Nicolas Vasilache 247e185dd5 [mlir][Vector] Move temporary alloc to top of the function alloca when lowering vector_transfers
Recently introduced allocation hoisting is quite conservative on the cases when it triggers.
This revision makes it such that the allocations for vector transfer lowerings are hoisted
to the top of the function.
This should be revisited in the context of parallelism and is a temporary workaround.

Differential Revision: https://reviews.llvm.org/D81253
2020-06-05 08:45:52 -04:00
Nicolas Vasilache 6b0dfd703a [mlir][Linalg] Add missing CMake dependency on SCFTransforms 2020-06-05 07:38:55 -04:00
Nicolas Vasilache 6953cf6502 [mlir][Linalg] Add a hoistRedundantVectorTransfers helper function
This revision adds a helper function to hoist vector.transfer_read /
vector.transfer_write pairs out of immediately enclosing scf::ForOp
iteratively, if the following conditions are true:
   1. The 2 ops access the same memref with the same indices.
   2. All operands are invariant under the enclosing scf::ForOp.
   3. No uses of the memref either dominate the transfer_read or are
   dominated by the transfer_write (i.e. no aliasing between the write and
   the read across the loop)

To improve hoisting opportunities, call the `moveLoopInvariantCode` helper
function on the candidate loop above which to hoist. Hoisting the transfers
results in scf::ForOp yielding the value that originally transited through
memory.

This revision additionally exposes `moveLoopInvariantCode` as a helper in
LoopUtils.h and updates SliceAnalysis to support return scf::For values and
allow hoisting across multiple scf::ForOps.

Differential Revision: https://reviews.llvm.org/D81199
2020-06-05 06:50:24 -04:00
Kadir Cetinkaya 6d15451b17
[mlir] Make PassManager.h self-contained
Forward declaring llvm::errs is not enough, as it is used as a default
parameter with a type that references the base class. So the class
hierarchy must be visible.
2020-06-05 12:02:24 +02:00
Alexander Belyaev 04fb2b6123 [Mlir] Implement printer, parser, verifier and builder for shape.reduce.
Differential Revision: https://reviews.llvm.org/D81186
2020-06-05 11:25:32 +02:00
Tres Popp 4ffe6bd8a7 [mlir] NFC formatting cleanup. 2020-06-05 11:00:20 +02:00
Tres Popp 655e08ceeb [mlir] Canonicalization of shape.assuming
Summary:
This will inline the region to a shape.assuming in the case that the
input witness is found to be statically true.

Differential Revision: https://reviews.llvm.org/D80302
2020-06-05 11:00:20 +02:00
Tres Popp 0a554e607f [mlir] Folding and canonicalization of shape.cstr_eq
In the case of all inputs being constant and equal, cstr_eq will be
replaced with a true_witness.

Differential Revision: https://reviews.llvm.org/D80303
2020-06-05 11:00:20 +02:00
Tres Popp 6aab709459 [mlir] Canonicalization and folding of shape.cstr_broadcastable
This allows replacing of this op with a true witness in the case of both
inputs being const_shapes and being found to be broadcastable.

Differential Revision: https://reviews.llvm.org/D80304
2020-06-05 11:00:19 +02:00
Tres Popp 4a255bbd29 [mlir] Add folding for shape.any
If any input to shape.any is a const_shape, shape.any can be replaced
with that input.

Differential Revision: https://reviews.llvm.org/D80305
2020-06-05 11:00:19 +02:00
Tres Popp 6b3a5bff93 [mlir] Folding of shape.assuming_all
This allows assuming_all to be replaced when all inputs are known to be
statically passing witnesses.

Differential Revision: https://reviews.llvm.org/D80306
2020-06-05 11:00:19 +02:00
Tres Popp 1c3e38d98c [mlir] Add a shape op that returns a constant witness
This will later be used during canonicalization and folding steps to replace
statically known passing constraints.

Differential Revision: https://reviews.llvm.org/D80307
2020-06-05 11:00:19 +02:00
Alexander Belyaev 5a675f0552 [Mlir] Add assembly format for `shape.mul`.
Differential Revision: https://reviews.llvm.org/D81194
2020-06-05 10:55:54 +02:00
Uday Bondhugula 0f6999af88 [MLIR] Update linalg.conv lowering to use affine load in the absence of padding
Update linalg to affine lowering for convop to use affine load for input
whenever there is no padding. It had always been using std.loads because
max in index functions (needed for non-zero padding if not materializing
zeros) couldn't be represented in the non-zero padding cases.

In the future, the non-zero padding case could also be made to use
affine - either by materializing or using affine.execute_region. The
latter approach will not impact the scf/std output obtained after
lowering out affine.

Differential Revision: https://reviews.llvm.org/D81191
2020-06-05 12:28:30 +05:30
River Riddle c0cd1f1c5c [mlir] Refactor BoolAttr to be a special case of IntegerAttr
This simplifies a lot of handling of BoolAttr/IntegerAttr. For example, a lot of places currently have to handle both IntegerAttr and BoolAttr. In other places, a decision is made to pick one which can lead to surprising results for users. For example, DenseElementsAttr currently uses BoolAttr for i1 even if the user initialized it with an Array of i1 IntegerAttrs.

Differential Revision: https://reviews.llvm.org/D81047
2020-06-04 16:41:24 -07:00
Nicolas Vasilache 3463d9835b [mlir][Linalg] Add a hoistViewAllocOps helper function
This revision adds a helper function to hoist alloc/dealloc pairs and
alloca op out of immediately enclosing scf::ForOp if both conditions are true:
   1. all operands are defined outside the loop.
   2. all uses are ViewLikeOp or DeallocOp.

This is now considered Linalg-specific and will be generalized on a per-need basis.

Differential Revision: https://reviews.llvm.org/D81152
2020-06-04 18:59:03 -04:00
Diego Caballero 5c990d6994 [mlir] Add support for bf16 to StandardToLLVM conversion
Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D81127
2020-06-04 14:36:36 -07:00
aartbik c19fae507e [mlir] [VectorOps] Add missing comments to CreateMaskOp lowering
Summary: Add missing comment to CreateMask. Fixed typo in ConstantMask comment.

Reviewers: nicolasvasilache, rriddle, reidtatge, ftynse

Reviewed By: ftynse

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

Tags: #mlir

Differential Revision: https://reviews.llvm.org/D81125
2020-06-04 12:50:47 -07:00
Thomas Raoux 661235e126 [mlir][gpu] Add subgroup Id/Size/Num to GPU dialect
Add SubgroupId, SubgroupSize and NumSubgroups to GPU dialect ops and add the
lowering of those ops to SPIRV.

Differential Revision: https://reviews.llvm.org/D81042
2020-06-04 10:52:40 -07:00
Pavel Labath 48cd9d9dd8 [Support] Use outs() in ToolOutputFile
Summary:
If the output filename was specified as "-", the ToolOutputFile class
would create a brand new raw_ostream object referring to the stdout.
This patch changes it to reuse the llvm::outs() singleton.

At the moment, this change should be "NFC", but it does enable other
enhancements, like the automatic stdout/stderr synchronization as
discussed on D80803.

I've checked the history, and I did not find any indication that this
class *has* to use a brand new stream object instead of outs() --
indeed, it is special-casing "-" in a number of places already, so this
change fits the pattern pretty well. I suspect the main reason for the
current state of affairs is that the class was originally introduced
(r111595, in 2010) as a raw_fd_ostream subclass, which made any other
solution impossible.

Another potential benefit of this patch is that it makes it possible to
move the raw_ostream class out of the business of special-casing "-" for
stdout handling. That state of affairs does not seem appropriate because
"-" is a valid filename (albeit hard to access with a lot of command
line tools) on most systems. Handling "-" in ToolOutputFile seems more
appropriate.

To make this possible, this patch changes the return type of
llvm::outs() and errs() to raw_fd_ostream&. Previously the functions
were constructing objects of that type, but returning a generic
raw_ostream reference. This makes it possible for new ToolOutputFile and
other code to use raw_fd_ostream methods like error() on the outs()
object. This does not seem like a bad thing (since stdout is a file
descriptor which can be redirected to anywhere, it makes sense to ask it
whether the writing was successful or if it supports seeking), and
indeed a lot of code was already depending on this fact via the
ToolOutputFile "back door".

Reviewers: dblaikie, JDevlieghere, MaskRay, jhenderson

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D81078
2020-06-04 14:56:35 +02:00
Hanhan Wang 0b025d2733 [mlir][StandardToSPIRV] Handle i1 case for lowering std.zexti to SPIR-V.
Differential Revision: https://reviews.llvm.org/D80965
2020-06-03 15:01:18 -07:00
Hanhan Wang 27fca57546 [mlir][Linalg] Add support for fusion between indexed_generic ops and tensor_reshape ops
Summary:
The fusion for tensor_reshape is embedding the information to indexing maps,
thus the exising pattenr also works for indexed_generic ops.

Depends On D80347

Differential Revision: https://reviews.llvm.org/D80348
2020-06-03 14:59:47 -07:00
Hanhan Wang cc11ceda16 [mlir][Linalg] Add support for fusion between indexed_generic ops and generic ops on tensors.
Summary:
Different from the fusion between generic ops, indices are involved. In this
context, we need to re-map the indices for producer since the fused op is built
on consumer's perspective. This patch supports all combination of the fusion
between indexed_generic ops and generic ops, which includes tests case:
  1) generic op as producer and indexed_generic op as consumer.
  2) indexed_generic op as producer and generic op as consumer.
  3) indexed_generic op as producer and indexed_generic op as consumer.

Differential Revision: https://reviews.llvm.org/D80347
2020-06-03 14:58:43 -07:00
aartbik 6391da98f4 [mlir] [VectorOps] Use 'vector.flat_transpose' for 2-D 'vector.tranpose'
Summary:
Progressive lowering of vector.transpose into an operation that
is closer to an intrinsic, and thus the hardware ISA. Currently
under the common vector transform testing flag, as we prepare
deploying this transformation in the LLVM lowering pipeline.

Reviewers: nicolasvasilache, reidtatge, andydavis1, ftynse

Reviewed By: nicolasvasilache, ftynse

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

Tags: #llvm, #mlir

Differential Revision: https://reviews.llvm.org/D80772
2020-06-03 14:55:50 -07:00
Jacques Pienaar 5b454b98d6 [mlir] Remove unneeded inference trait/fns
Therse are all handled with the simple return type inference in ODS.
Also update some summaries to match what is recommended in ODS doc.
2020-06-03 13:09:07 -07:00
Frederik Gossen 3713314bfa [MLIR] Shape to standard dialect lowering
Add a new pass to lower operations from the `shape` to the `std` dialect.
The conversion applies only to the `size_to_index` and `index_to_size`
operations and affected types.
Other patterns will be added as needed.

Differential Revision: https://reviews.llvm.org/D81091
2020-06-03 16:17:03 +00:00
Alex Zinenko 6163fa7926 [mlir] DialectConversion: remove vtable from TypeConverter
The original design of TypeConverter expected specific converters to derive the
class and override virtual functions for conversions and materializations. This
did not scale well to multi-dialect conversions, so the design was changed to
register a list of converter and materializer functions, removing the need for
virtual functions. The only remaining virtual function, `convertSignatureArg`
is never overridden in-tree. Make it non-virtual, drop the virtual destructor
and thus remove vtable from TypeConverter.

If there exist TypeConverter users that need custom `convertSignatureArg`
behavior, it should be implemented using the callback registration mechanism
similar to that of conversions and materializations.

Differential Revision: https://reviews.llvm.org/D80993
2020-06-03 15:31:02 +02:00
Nicolas Vasilache e349fb70a2 [mlir][Linalg] NFC - Make markers use Identifier instead of StringRef
Summary: This removes string ownership worries by putting everything into the context and allows more constructing identifiers programmatically.

Reviewers: ftynse

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

Tags: #mlir

Differential Revision: https://reviews.llvm.org/D81027
2020-06-03 05:52:32 -04:00
Mehdi Amini 48c800cc1b Fix build: TableGen uses `is<T>` instead of `isa<T>` as predicate 2020-06-03 04:06:19 +00:00
Mehdi Amini a09bb6d77b Replace dyn_cast<>() with isa<>() when the result isn't used (NFC)
Fixed warning reported by some GCC version.
2020-06-03 03:09:45 +00:00
Thomas Raoux 81dd3a4718 [mlir][spirv] Fix coop matrix getExtension
Stack variable was being used beyond its lifetime.

Differential Revision: https://reviews.llvm.org/D80948
2020-06-02 16:32:31 -07:00
Thomas Raoux bbe79e27bd [mlir][spirv] Fix encoding of cooperative matrix type to match SPIRV spec
Scope, rows and columns need to be encoded in a separate constant operation.

Differential Revision: https://reviews.llvm.org/D80852
2020-06-02 16:28:56 -07:00
Diego Caballero 8a418e5f8e [mlir][Affine] Enable fusion of loops with vector loads/stores
This patch enables affine loop fusion for loops with affine vector loads
and stores. For that, we only had to use affine memory op interfaces in
LoopFusionUtils.cpp and Utils.cpp so that vector loads and stores are
also taken into account.

Reviewed By: andydavis1, ftynse

Differential Revision: https://reviews.llvm.org/D80971
2020-06-03 01:26:22 +03:00
Nicolas Vasilache 7de4587805 [mlir] NFC - Add AffineMinMaxOpBase getDim/SymbolOperands 2020-06-02 18:04:45 -04:00
HazemAbdelhafez 915e55c910 [mlir][spirv] Add support for matrix type
This commit adds basic matrix type support to the SPIR-V dialect
including type definition, IR assembly, parsing, printing, and
(de)serialization.

Differential Revision: https://reviews.llvm.org/D80594
2020-06-02 16:30:58 -04:00
Jacques Pienaar 635cde6e8c [mlir] Provide defaults to make enabling dumping simpler
Differential Revision: https://reviews.llvm.org/D80818
2020-06-02 10:47:07 -07:00
Alex Zinenko 5c5dafc534 [mlir] support materialization for 1-1 type conversions
Dialect conversion infrastructure supports 1->N type conversions by requiring
individual conversions to provide facilities to generate operations
retrofitting N values into 1 of the original type when N > 1. This
functionality can also be used to materialize explicit "cast"-like operations,
but it did not support 1->1 type conversions until now. Modify TypeConverter to
support materialization of cast operations for 1-1 conversions.

This also makes materialization specification more extensible following the
same pattern as type conversions. Instead of overloading a virtual function,
users or subclasses of TypeConversion can now register type-specific
materialization callbacks that will be called in order for the given type.

Differential Revision: https://reviews.llvm.org/D79729
2020-06-02 13:48:33 +02:00
Alex Zinenko eb8edd8526 [mlir] SCFToGPUPass: fix macros referring to LOOPS to use SCF instead
One header guard was overlooked when renaming LoopOps to SCF, rename it.
Also drop two unused macros, one of which referred to LoopOp (not "Ops",
hence the overlook).
2020-06-02 13:03:13 +02:00
Alex Zinenko b596ecdd57 [mlir] Toy tutorial: avoid erasing and then re-creating loop terminators
The lower-to-affine-loops pass in chapters 5-7 of the Toy tutorial has
been creating affine loops, erasing their terminator and creating it
anew using a PatternRewriter instance to work around the fact that
implicit terminators were created without notifying the rewriter. Now
that has been fixed in 3ccf4a5bd1, remove the code erasing and
re-creating the terminators and rely on the default ones.
2020-06-02 12:54:03 +02:00
Alex Zinenko 195d8571b9 [mlir] post-commit review fixes
This fixes several post-commit nits from D79688 and D80135, namely
typos, debug output and control flow inversion.
2020-06-02 12:08:17 +02:00
Ehsan Toosi 3f6a35e3ff [mlir] Introduce CallOp converter for buffer placement
Add BufferAssignmentCallOpConverter as a pattern rewriter for Buffer
Placement. It matches the signature of the caller operation with the callee
after rewriting the callee with FunctionAndBlockSignatureConverter.

Differential Revision: https://reviews.llvm.org/D80785
2020-06-02 11:35:24 +02:00
MaheshRavishankar 2bcd1927dd [mlir][SCFToGPU] Remove conversions from scf.for to gpu.launch.
Keeping in the affine.for to gpu.launch conversions, which should
probably be the affine.parallel to gpu.launch conversion as well.

Differential Revision: https://reviews.llvm.org/D80747
2020-06-01 23:06:20 -07:00
Chris Lattner 0cf5ef176b Change some extraneous /// comments to // comments inside methods. NFC. 2020-05-31 11:43:54 -07:00
Mehdi Amini 21fee0921d Use .empty() instead of .size() == 0 (NFC)
Cleanup / Fix a clang-tidy warning
2020-05-30 03:36:22 +00:00
Thomas Raoux c652c306a6 [mlir][spirv] Clean up coop matrix assembly declaration.
Address code review feedback and use declarative assembly format.

Differential Revision: https://reviews.llvm.org/D80687
2020-05-29 16:37:35 -07:00
Nicolas Vasilache 7fc225f8c4 [mlir] Fix Windows build
Summary:
MSVC does not seem to like certain forward declarations.

https://reviews.llvm.org/D80728 introduces an error where
seemingly unrelated .cpp files that include the .h
(but do not otherwise use the class that depends on the forward declaration).

Instead of forward declaration, include the full vector ops definition.

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

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D80841
2020-05-29 18:55:21 -04:00
Nicolas Vasilache 91beb5176b [mlir] NFC - Add debug information for Linalg transformations.
Address post-commit review of https://reviews.llvm.org/D79518
2020-05-29 18:35:22 -04:00
Diego Caballero e75325cfc3 [mlir][Affine] Minor clean-up of D79829
Addressing D79829 post-commit comments. Minor changes.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D80814
2020-05-29 14:39:18 -07:00
Nicolas Vasilache 9534192c3b [mlir][Linalg] Make contraction vectorization use vector transfers
This revision replaces the load + vector.type_cast by appropriate vector transfer
operations. These play more nicely with other vector abstractions and canonicalization
patterns and lower to load/store with or without masks when appropriate.

Differential Revision: https://reviews.llvm.org/D80809
2020-05-29 15:03:46 -04:00
Anchu Rajendran dbb5979d15 [MLIR][OpenMP] Defined master operation in OpenMP Dialect
Summary:
Implemented the basic changes for defining master operation in OpenMP.
It uses the generic parser and printer.

Reviewed By: kiranchandramohan, ftynse

Differential Revision: https://reviews.llvm.org/D80689
2020-05-29 22:46:02 +05:30
Nicolas Vasilache 1ee114322c [mlir][Linalg][Vector] Add forwarding patterns between linalg.copy and vector.transfer
This revision adds custom rewrites for patterns that arise during linalg structured
ops vectorization. These patterns allow the composition of linalg promotion,
vectorization and removal of redundant copies.

The patterns are voluntarily limited and restrictive atm.
More robust behavior will be implemented once more powerful side effect modeling and analyses are available on view/subview.

On the transfer_read side, the following pattern is rewritten:
```
   %alloc = ...
   [optional] %view = std.view %alloc ...
   %subView = subview %allocOrView ...
   [optional] linalg.fill(%allocOrView, %cst) ...
   ...
   linalg.copy(%in, %subView) ...
   vector.transfer_read %allocOrView[...], %cst ...
```
into
```
   [unchanged] %alloc = ...
   [unchanged] [optional] %view = std.view %alloc ...
   [unchanged] [unchanged] %subView = subview %allocOrView ...
   ...
   vector.transfer_read %in[...], %cst ...
```

On the transfer_write side, the following pattern is rewriten:
```
   %alloc = ...
   [optional] %view = std.view %alloc ...
   %subView = subview %allocOrView...
   ...
   vector.transfer_write %..., %allocOrView[...]
   linalg.copy(%subView, %out)
```

Differential Revision: https://reviews.llvm.org/D80728
2020-05-29 08:08:34 -04:00
Nicolas Vasilache aa93659c9f [mlir][SCF] Add utility to clone an scf.ForOp while appending new yield values.
This utility factors out the machinery required to add iterArgs and yield values to an scf.ForOp.

Differential Revision: https://reviews.llvm.org/D80656
2020-05-29 07:28:17 -04:00
Benjamin Kramer b9bb3ad3ed Unbreak the build of mlir-cuda-runner 2020-05-29 12:18:48 +02:00
Ehsan Toosi 7a3a253585 [MLIR][BufferPlacement] Support functions that return Memref typed results
Buffer placement can now operates on functions that return buffers. These
buffers escape from the deallocation phase of buffer placement.

Differential Revision: https://reviews.llvm.org/D80696
2020-05-29 11:03:22 +02:00
Marius Brehler b0b2507717 [mlir] Add test to check if standalone dialect is registered
Summary: Add a test to check if the standalone dialect is registered within standalone-opt. Similar to the mlir-opt commandline.mlir test.

Reviewers: Kayjukh, stephenneuendorffer

Reviewed By: Kayjukh

Subscribers: mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, Joonsoo, grosul1, frgossen, jurahul, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D80764
2020-05-29 00:34:34 +02:00
Nicolas Vasilache 5f9e0466f2 [mlir][Vector] Fix vector.transfer alignment calculation
https://reviews.llvm.org/D79246 introduces alignment propagation for vector transfer operations. Unfortunately, the alignment calculation is incorrect and can result in crashes.

This revision fixes the calculation by using the natural alignment of the memref elemental type, instead of the resulting vector type.

If more alignment is desired, it can be done in 2 ways:
1. use a proper vector.type_cast to transform a memref<axbxcxdxf32> into a memref<axbxvector<cxdxf32>> giving a natural alignment of vector<cxdxf32>
2. add an alignment attribute to vector transfer operations and propagate it.

With this change the alignment in the relevant tests goes down from 128 to 4.

Lastly, a few minor cleanups are performed and the custom `isMinorIdentityMap` is deprecated.

Differential Revision: https://reviews.llvm.org/D80734
2020-05-28 17:58:51 -04:00
Christopher Tetreault a9c7b49862 [SVE] Eliminate calls to default-false VectorType::get() from mlir
Reviewers: efriedma, ftynse, c-rhodes, david-arm, rriddle

Reviewed By: ftynse

Subscribers: tschuett, rkruppe, psnobl, mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, stephenneuendorffer, Joonsoo, grosul1, frgossen, Kayjukh, jurahul, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D80340
2020-05-28 14:42:51 -07:00
Marius Brehler 3bff62d45f [mlir] Extend standalone example by standalone-translate
Extend the standalone by standalone-translate, based on mlir-translate.

Differential Revision: https://reviews.llvm.org/D80737
2020-05-28 14:07:55 -07:00
Stephen Neuendorffer 8b3155829a [MLIR] Fix build when NVPTX is not enabled
In this case, neither target is selected, but there is still a dependence
on the MC library (through the TargetOptions.h include)
2020-05-28 14:07:55 -07:00
MaheshRavishankar 2b0c8546ac [mlir][Linalg] Add pass to remove unit-extent dims from tensor
operands of Generic ops.

Unit-extent dimensions are typically used for achieving broadcasting
behavior. The pattern added (along with canonicalization patterns
added previously) removes the use of unit-extent dimensions, and
instead uses a more canonical representation of the computation.  This
new pattern is not added as a canonicalization for now since it
entails adding additional reshape operations. A pass is added to
exercise these patterns, along with an API entry to populate a
patterns list with these patterns.

Differential Revision: https://reviews.llvm.org/D79766
2020-05-28 11:06:47 -07:00
Alex Zinenko 72ede60b75 [mlir][GPU] Link relevant LLVM components in GPUCommon instead of test
D80142 restructured MLIR-to-GPU-binary conversion to support multiple
targets. It also modified cmake files to link relevant LLVM components
in test/lib, which broke shared-library builds, and likely made the
conversions unusable outside mlir-opt (or other tools that link in test
library targets). Link these components to GPUCommon instead.

Differential Revision: https://reviews.llvm.org/D80739
2020-05-28 20:01:54 +02:00
Jacques Pienaar 2321ab9c69 [mlir] Fix mismatched-tags warning 2020-05-28 09:06:47 -07:00
Jacques Pienaar fefe4366c3 [mlir] Use ValueRange instead of ArrayRef<Value>
This allows constructing operand adaptor from existing op (useful for commonalizing verification as I want to do in a follow up).

I also add ability to use member initializers for the generated adaptor constructors for convenience.

Differential Revision: https://reviews.llvm.org/D80667
2020-05-28 09:05:24 -07:00
Jean-Michel Gorius db52a49010 [mlir] Make translation libraries available through MLIRConfig.cmake 2020-05-28 17:39:07 +02:00
Frederik Gossen f1ab7550bc [MLIR] Fix operand type in `from_extent_tensor` in the shape dialect
The operand of `from_extent_tensor` is now of the same index type as the result
type of the inverse operation `to_extent_tensor`.

Differential Revision: https://reviews.llvm.org/D80283
2020-05-28 14:12:47 +00:00
Wen-Heng (Jack) Chung 061fb8eb2d [mlir][gpu][mlir-cuda-runner] Refactor ConvertKernelFuncToCubin to be generic.
Make ConvertKernelFuncToCubin pass to be generic:

- Rename to ConvertKernelFuncToBlob.
- Allow specifying triple, target chip, target features.
- Initializing LLVM backend is supplied by a callback function.
- Lowering process from MLIR module to LLVM module is via another callback.
- Change mlir-cuda-runner to adopt the revised pass.
- Add new tests for lowering to ROCm HSA code object (HSACO).
- Tests for CUDA and ROCm are kept in separate directories.

Differential Revision: https://reviews.llvm.org/D80142
2020-05-28 09:08:28 -05:00
Frederik Gossen fdaa391e3d [MLIR] Add `num_elements` to the shape dialect
The operation `num_elements` determines the number of elements for a given
shape.
That is the product of its dimensions.

Differential Revision: https://reviews.llvm.org/D80281
2020-05-28 14:05:58 +00:00
Frederik Gossen 6594d54571 [MLIR] Add `index_to_size` and `size_to_index` to the shape dialect
Add the two conversion operations `index_to_size` and `size_to_index` to the
shape dialect.
This facilitates the conversion of index types between the shape and the
standard dialect.

Differential Revision: https://reviews.llvm.org/D80280
2020-05-28 13:57:20 +00:00
Alexander Belyaev c3098e4f40 [MLIR] Add TensorFromElementsOp to Standard ops.
Differential Revision: https://reviews.llvm.org/D80705
2020-05-28 15:48:10 +02:00
Frederik Gossen dd484baffd [MLIR] Tidy up documentation for `Shape_JoinOp`, `Shape_ReduceOp`, and
`Shape_ConstSizeOp`

Fix places that refer to `shape.type` instead of `shape.shape`.

Differential Revision: https://reviews.llvm.org/D80278
2020-05-28 13:42:19 +00:00
Frederik Gossen e73bb4fba7 [MLIR] Move `ConcatOp` to its lexicographic position
Purely cosmetic change.
The operation implementations in `Shape.cpp` are now lexicographic order.

Differential Revision: https://reviews.llvm.org/D80277
2020-05-28 13:37:22 +00:00
Mehdi Amini 213c6cdf2e Harden MLIR detection of misconfiguration when missing dialect registration
This changes will catch error where C++ op are used without being
registered, either through creation with the OpBuilder or when trying to
cast to the C++ op.

Differential Revision: https://reviews.llvm.org/D80651
2020-05-28 08:14:49 +00:00
MaheshRavishankar 0a072b8a0d [mlir][Linalg] Add missing library linkage for shared library builds.
Differential Revision: https://reviews.llvm.org/D80664
2020-05-27 14:29:35 -07:00
Sean Silva 25132b36a8 [mlir][shape] Use IndexElementsAttr in Shape dialect.
Summary:
Index is the proper type for storing shapes when constant folding, so
this fixes the previous code (which was using i64).

Differential Revision: https://reviews.llvm.org/D80600
2020-05-27 13:39:49 -07:00
Sean Silva 9546d8b108 [mlir][core] Add IndexElementsAttr helpers.
Summary:
In a follow-up, I'll update the Shape dialect to use this instead of
I64ElementsAttr.

Differential Revision: https://reviews.llvm.org/D80601
2020-05-27 13:39:48 -07:00
Sean Silva b277382311 Remove error-prone mlir::ExecutionEngine::invoke overload.
I just spent a bunch of time debugging a mysterious bug that ended being due to my SmallVector getting passed to the Args&... overload instead of the MutableArrayRef overload, with disastrous results.

I appreciate the intent of this API, but for a function that does a bunch of unsafe casts, adding in potential overload confusion is just too much C++ footgun. If we end up needing this functionality, having something like a separate `packArgs(Args&...) -> SmallVector` overload would be preferable.

Turns out this API is unused and untested (even out of tree as far as I can tell, modulo the optional passing of no args to the other invoke as I fixed in this patch), so it's an easy fix -- just delete it and touch up the other overload.

Differential Revision: https://reviews.llvm.org/D80607
2020-05-27 13:26:03 -07:00
Nicolas Vasilache 79aa9bfdb8 [mlir] Fix RunnerUtils template specialization
Undoing a spurious change that broke SFINAE for some out of core use
cases.
2020-05-27 16:14:43 -04:00
MaheshRavishankar c6fa2efd48 [mlir][Linalg] Fix build failure from D80188
Differential Revision: https://reviews.llvm.org/D80657
2020-05-27 13:06:43 -07:00
aartbik c295a65da4 [mlir] [VectorOps] Add 'vector.flat_transpose' operation
Summary:
Provides a representation of the linearized LLVM instrinsic.
With tests and lowering implementation to LLVM IR dialect.
Prepares better lowering for 2-D vector.transpose.

Reviewers: nicolasvasilache, ftynse, reidtatge, bkramer, dcaballe

Reviewed By: ftynse, dcaballe

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

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D80419
2020-05-27 11:09:48 -07:00
MaheshRavishankar 4d6f44f5f0 [mlir][spirv] Lower allocation/deallocations of workgroup memory.
This allocation of a workgroup memory is lowered to a
spv.globalVariable. Only static size allocation with element type
being int or float is handled. The lowering does account for the
element type that are not supported in the lowered spv.module based on
the extensions/capabilities and adjusts the number of elements to get
the same byte length.

Differential Revision: https://reviews.llvm.org/D80411
2020-05-27 09:53:16 -07:00
David Truby 5ba874e472 [MLIR] [OpenMP] Add basic OpenMP parallel operation
Summary:
This includes a basic implementation for the OpenMP parallel
operation without a custom pretty-printer and parser.
The if, num_threads, private, shared, first_private, last_private,
proc_bind and default clauses are included in this implementation.

Currently the reduction clause is omitted as it is more complex and
requires analysis to see if we can share implementation with the loop
dialect. The allocate clause is also omitted.

A discussion about the design of this operation can be found here:
https://llvm.discourse.group/t/openmp-parallel-operation-design-issues/686

The current OpenMP Specification can be found here:
https://www.openmp.org/wp-content/uploads/OpenMP-API-Specification-5.0.pdf

Co-authored-by: Kiran Chandramohan <kiran.chandramohan@arm.com>

Reviewers: jdoerfert

Subscribers: mgorny, yaxunl, kristof.beyls, guansong, mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, Joonsoo, grosul1, frgossen, Kayjukh, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D79410
2020-05-27 17:16:44 +01:00
Jacques Pienaar 31f40f603d [mlir] Add simple generator for return types
Take advantage of equality constrains to generate the type inference interface.
This is used for equality and trivially built types. The type inference method
is only generated when no type inference trait is specified already.

This reorders verification that changes some test error messages.

Differential Revision: https://reviews.llvm.org/D80484
2020-05-27 08:45:55 -07:00
Alex Zinenko cadb7ccf2c [mlir] SCF: provide function_ref builders for IfOp
Now that OpBuilder is available in `build` functions, it becomes possible to
populate the "then" and "else" regions directly when building the "if"
operation. This is desirable in more structured forms of builders, especially
in when conditionals are mixed with loops. Provide new `build` APIs taking
callbacks for body constructors, similarly to scf::ForOp, and replace more
clunky edsc::BlockBuilder uses with these. The original APIs remain available
and go through the new implementation.

Differential Revision: https://reviews.llvm.org/D80527
2020-05-27 16:12:58 +02:00
MaheshRavishankar 0ed2d4c7cb [mlir][linalg] Allow promotion to use callbacks for
alloc/dealloc/copies.

Add options to LinalgPromotion to use callbacks for implementating the
allocation, deallocation of buffers used for the promoted subviews,
and to copy data into and from the original subviews to the allocated
buffers.
Also some misc. cleanup of the code.

Differential Revision: https://reviews.llvm.org/D80365
2020-05-26 21:33:57 -07:00
MaheshRavishankar 5759e47316 [mlir][Linalg] Avoid using scf.parallel for non-parallel loops in Linalg ops.
Modifying the loop nest builder for generating scf.parallel loops to
not generate scf.parallel loops for non-parallel iterator types in
Linalg operations. The existing implementation incorrectly generated
scf.parallel for all tiled loops. It is rectified by refactoring logic
used while lowering to loops that accounted for this.

Differential Revision: https://reviews.llvm.org/D80188
2020-05-26 21:33:57 -07:00
Sean Silva cf42b70439 [mlir][shape] Add `shape.get_extent`.
Summary:
This op extracts an extent from a shape.

This also is the first op which constant folds to shape.const_size,
which revealed that shape.const_size needs a folder (ConstantLike ops
seem to always need folders for the constant folding infra to work).

Differential Revision: https://reviews.llvm.org/D80394
2020-05-26 17:03:40 -07:00
Nicolas Vasilache c990bdf7f8 [mlir] Hotfix - Add inline to avoid multiple symbols on trivial functions 2020-05-26 16:24:56 -04:00
Nicolas Vasilache e900320759 [mlir] Hotfix - Drop spurious constexpr that breaks build 2020-05-26 16:21:31 -04:00
Nicolas Vasilache ba10daa820 [mlir][Vector] Add more vector.contract -> outerproduct lowerings and fix vector.contract type inference.
This revision expands the types of vector contractions that can be lowered to vector.outerproduct.
All 8 permutation cases are support.
The idiomatic manipulation of AffineMap written declaratively makes this straightforward.

In the process a bug with the vector.contract verifier was uncovered.
The vector shape verification part of the contract op is rewritten to use AffineMap composition.
One bug in the vector `ops.mlir` test is fixed and a new case not yet captured is added
to the vector`invalid.mlir` test.

Differential Revision: https://reviews.llvm.org/D80393
2020-05-26 15:40:55 -04:00
Christian Sigg 222e0e58a8 [MLIR] Helper class referencing MemRefType to unify runner implementations.
Summary:
Add DynamicMemRefType which can reference one of the statically ranked StridedMemRefType or a UnrankedMemRefType so that runner utils only need to be implemented once.

There is definitely room for more clean up and unification, but I will keep that for follow-ups.

Reviewers: nicolasvasilache

Reviewed By: nicolasvasilache

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

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D80513
2020-05-26 16:32:36 +02:00
Nicolas Vasilache 9578a54f50 [mlir][Vector] Add vector contraction to outerproduct lowering
This revision adds the additional lowering and exposes the patterns at a finer granularity for better programmatic reuse. The unit test makes use of the finer grained pattern for simpler checks.

As the ContractionOpLowering is exposed programmatically, cleanup opportunities appear and static class methods are turned into free functions with static visibility.

Differential Revision: https://reviews.llvm.org/D80375
2020-05-26 09:31:26 -04:00
Tharindu Rusira a3b5ccddcc Update DialectConversion.md
line 164: typo? baz.add should be bar.add.
`bar.add` -> `foo.add`
2020-05-26 15:24:54 +02:00
Benjamin Kramer a9b5edc5e2 Make mlir::Value's bool conversion operator explicit
This still allows `if (value)` while requiring an explicit cast when not
in a boolean context. This means things like `std::set<Value>` will no
longer compile.

Differential Revision: https://reviews.llvm.org/D80497
2020-05-25 18:22:00 +02:00
George Mitenkov 7293dd5b40 Added pow intrinsic to LLVMIR dialect
Added pow intrinsic to LLVMIR dialect. Added a roundrip test for it.

Differential Revision: https://reviews.llvm.org/D80248
2020-05-25 07:57:33 -04:00
Jacques Pienaar 4b8632e174 [mlir] Expand operand adapter to take attributes
* Enables using with more variadic sized operands;
* Generate convenience accessors for attributes;
  - The accessor are named the same as their name in ODS and returns attribute
    type (not convenience type) and no derived attributes.

This is first step to changing adapter to support verifying argument
constraints before the op is even created. This does not change the name of
adaptor nor does it require it except for ops with variadic operands to keep this change smaller.

Considered creating separate adapter but decided against that given operands also require attributes in general (and definitely for verification of operands and attributes).

Differential Revision: https://reviews.llvm.org/D80420
2020-05-24 21:06:47 -07:00
Sean Silva be88ba09d5 [NFC] Make assertion more informative.
This assert just caught me, and this improved message would have saved
me some time.
2020-05-21 13:36:21 -07:00
Thomas Raoux 0712eac766 [mlir][spirv] Enable composite instructions for cooperative matrix type.
Enable inset/extract/construct composite ops as well as access chain for
cooperative matrix. ConstantComposite requires more change and will be done in
a separate patch. Also fix the getNumElements function for coopMatrix per
feedback from Jeff Bolz. The number of element is implementation dependent so
it cannot be known at compile time.

Differential Revision: https://reviews.llvm.org/D80321
2020-05-21 12:19:55 -07:00
Thomas Raoux 15389cdc5b [mlir][spirv] Add remaining cooperative matrix instructions
Adds support for cooperative matrix support for arithmetic and cast
instructions. It also adds cooperative matrix store, muladd and matrixlength
instructions which are part of the extension.

Differential Revision: https://reviews.llvm.org/D80181
2020-05-21 11:55:33 -07:00
jerryyin 9c53ac08de [mlir][rocdl] Exposing buffer load/store intrinsic
Summary:
* Updated ROCDLOps tablegen
* Added parsing and printing function for new intrinsic
* Added unit tests

Reviewers: ftynse

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

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D80233
2020-05-21 14:14:35 +00:00
Wen-Heng (Jack) Chung 2cbbc266ec [mlir][gpu] Refactor ConvertGpuLaunchFuncToCudaCalls pass.
Due to similar APIs between CUDA and ROCm (HIP),
ConvertGpuLaunchFuncToCudaCalls pass could be used on both platforms with some
refactoring.

In this commit:

- Migrate ConvertLaunchFuncToCudaCalls from GPUToCUDA to GPUCommon, and rename.
- Rename runtime wrapper APIs be platform-neutral.
- Let GPU binary annotation attribute be specifiable as a PassOption.
- Naming changes within the implementation and tests.

Subsequent patches would introduce ROCm-specific tests and runtime wrapper
APIs.

Differential Revision: https://reviews.llvm.org/D80167
2020-05-21 08:53:47 -05:00
Nicolas Vasilache 941005f51a [mlir] NFC - Add a builder to vector.transpose
Summary: Also expose some more vector ops to EDSCs.

Differential Revision: https://reviews.llvm.org/D80333
2020-05-21 05:18:58 -04:00
Mehdi Amini 5c3ebd7725 Revert "[mlir][gpu] Refactor ConvertGpuLaunchFuncToCudaCalls pass."
This reverts commit cdb6f05e2d.

The build is broken with:

  You have called ADD_LIBRARY for library obj.MLIRGPUtoCUDATransforms without any source files. This typically indicates a problem with your CMakeLists.txt file
2020-05-21 03:44:35 +00:00
Nicolas Vasilache 3393cc4ceb [mlir] NFC - Appease GCC 5 again.. 2020-05-20 17:58:18 -04:00
Wen-Heng (Jack) Chung ad398164ba [mlir][gpu] Refactor functions for workgroup and private buffer attributions.
Summary:

Consolidate interfaces adding workgroup and private buffer attributions in GPU
dialect.

Note all private buffer attributions must follow workgroup buffer attributions.

Reviewers: herhut

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

Tags: #llvm, #mlir

Differential Revision: https://reviews.llvm.org/D79508
2020-05-20 16:20:27 -05:00
Wen-Heng (Jack) Chung cdb6f05e2d [mlir][gpu] Refactor ConvertGpuLaunchFuncToCudaCalls pass.
Due to similar APIs between CUDA and ROCm (HIP),
ConvertGpuLaunchFuncToCudaCalls pass could be used on both platforms with some
refactoring.

In this commit:

- Migrate ConvertLaunchFuncToCudaCalls from GPUToCUDA to GPUCommon, and rename.
- Rename runtime wrapper APIs be platform-neutral.
- Let GPU binary annotation attribute be specifiable as a PassOption.
- Naming changes within the implementation and tests.

Subsequent patches would introduce ROCm-specific tests and runtime wrapper
APIs.

Differential Revision: https://reviews.llvm.org/D80167
2020-05-20 16:11:48 -05:00
Nicolas Vasilache ebf14d9b6d [mlir] NFC - Appease GCC 5 again.. 2020-05-20 16:47:45 -04:00
MaheshRavishankar 0e88eb5c51 [mlir][spirv] Adapt subview legalization to the updated op semantics.
The subview semantics changes recently to allow for more natural
representation of constant offsets and strides. The legalization of
subview op for lowering to SPIR-V needs to account for this.
Also change the linearization to use the strides from the affine map
of a memref.

Differential Revision: https://reviews.llvm.org/D80270
2020-05-20 12:00:21 -07:00
MaheshRavishankar 071358e082 [mlir][Linalg] Add producer-consumer fusion when producer is a ConstantOp
and Consumer is a GenericOp.

Differential Revision: https://reviews.llvm.org/D79838
2020-05-20 09:16:19 -07:00
Nicolas Vasilache 7c3c5b11b1 [mlir][Vector] Add option to fully unroll for VectorTransfer to SCF lowering
Summary:
Previously, the only support partial lowering from vector transfers to SCF was
going through loops. This requires a dedicated allocation and extra memory
roundtrips because LLVM aggregates cannot be indexed dynamically (for more
details see the [deep-dive](https://mlir.llvm.org/docs/Dialects/Vector/#deeperdive)).

This revision allows specifying full unrolling which removes this additional roundtrip.
This should be used carefully though because full unrolling will spill, negating the
benefits of removing the interim alloc in the first place.

Proper heuristics are left for a later time.

Differential Revision: https://reviews.llvm.org/D80100
2020-05-20 11:02:13 -04:00
Alex Zinenko 3ccf4a5bd1 [mlir] ensureRegionTerminator: take OpBuilder
The SingleBlockImplicitTerminator op trait provides a function
`ensureRegionTerminator` that injects an appropriate terminator into the block
if necessary, which is used during operation constructing and parsing.
Currently, this function directly modifies the IR using low-level APIs on
Operation and Block. If this function is called from a conversion pattern,
these manipulations are not reflected in the ConversionPatternRewriter and thus
cannot be undone or, worse, lead to tricky memory errors and malformed IR.
Change `ensureRegionTerminator` to take an instance of `OpBuilder` instead of
`Builder`, and use it to construct the block and the terminator when required.
Maintain overloads taking an instance of `Builder` and creating a simple
`OpBuilder` to use in parsers, which don't have an `OpBuilder` and cannot
interact with the dialect conversion mechanism. This change was one of the
reasons to make `<OpTy>::build` accept an `OpBuilder`.

Differential Revision: https://reviews.llvm.org/D80138
2020-05-20 16:14:46 +02:00
Alex Zinenko a7d88a9038 [mlir] SCFToStandard: support any ops in and around the control flow ops
Originally, the SCFToStandard conversion only declared Ops from the Standard
dialect as legal after conversion. This is undesirable as it would fail the
conversion if the SCF ops contained ops from any other dialect. Furthermore,
this would be problematic for progressive lowering of `scf.parallel` to
`scf.for` after `ensureRegionTerminator` is made aware of the pattern rewriting
infrastructure because it creates temporary `scf.yield` operations declared
illegal. Change the legalization target to declare any op other than `scf.for`,
`scf.if` and `scf.parallel` legal.

Differential Revision: https://reviews.llvm.org/D80137
2020-05-20 16:12:05 +02:00
Alex Zinenko 57cbeaa8b5 [mlir] Erase or clear blocks through ConversionPatternRewriter when applicable
Multiple places in the code base were erasing Blocks or operations in them
using in-place modifications (`Block::erase` or `Block::clear`) unknown to
ConversionPatternRewriter. These operations could not be undone if the pattern
failed and could lead to inconsistent in-memory state of the IR with dangling
pointers. Use `ConversionPatternRewriter::eraseOp` and `::eraseBlock` instead.

Differential Revision: https://reviews.llvm.org/D80136
2020-05-20 16:12:05 +02:00
Alex Zinenko df48026b4c [mlir] DialectConversion: support erasing blocks
PatternRewriter has support for erasing a Block from its parent region, but
this feature has not been implemented for ConversionPatternRewriter that needs
to keep track of and be able to undo block actions. Introduce support for
undoing block erasure in the ConversionPatternRewriter by marking all the ops
it contains for erasure and by detaching the block from its parent region. The
detached block is stored in the action description and is not actually deleted
until the rewrites are applied.

Differential Revision: https://reviews.llvm.org/D80135
2020-05-20 16:12:05 +02:00
Alex Zinenko 5d5df06aac [mlir] DialectConversion: avoid double-free when rolling back op creation
Dialect conversion infrastructure may roll back op creation by erasing the
operations in the reverse order of their creation. While this guarantees uses
of values will be deleted before their definitions, this does not guarantee
that a parent operation will not be deleted before its child. (This may happen
in case of block inlining or if child operations, such as terminators, are
created in the parent's `build` function before the parent itself.) Handle the
parent/child relationship between ops by removing all child ops from the blocks
before erasing the parent. The child ops remain live, detached from a block,
and will be safely destroyed in their turn, which may come later than that of
the parent.

Differential Revision: https://reviews.llvm.org/D80134
2020-05-20 16:12:05 +02:00
Alex Zinenko a655144f57 [mlir] Toy tutorial: insert terminators at the end of the loop during rewrite
When creating temporary `scf.for` loops in `toy.print` lowering, the block
insertion point was erronously set up to the beginning of the block rather than
to its end, contradicting the comment just above the insertion point change.
The code was nevertheless operational because `scf.for` was setting up its
`scf.yield` terminator in an opaque to the pattern rewriting infrastructure
way. Now that it is about to change, the problem would have been exposed and
lead to conversion failures.

Differential Revision: https://reviews.llvm.org/D80133
2020-05-20 16:12:05 +02:00
Nicolas Vasilache 19e5b2bccb [mlir][Linalg] NFC - Simplify GenericNestLoop builder
Summary: This revision trims unnecessary complexity.

Differential Revision: https://reviews.llvm.org/D80290
2020-05-20 09:44:15 -04:00
Nicolas Vasilache 004a3d4f56 [mlir][Linalg] Refactor linalg tiling
Summary:
This revision refactors the Linalg tiling pass to be written as pattern applications and retires the use of the folder in Linalg tiling.
In the early days, tiling was written as a pass that would create (partially) folded and canonicalized operations on the fly for better composability.
As this evolves towards composition of patterns, the pass-specific folder is counter-productive and is retired.
The tiling options struct evolves to take a tile size creation function which allows materializing tile sizes on the fly (in particular constant tile sizes). This plays better with folding and DCE.

With the folder going away in Tiling, the check on whether subviews are the same in linalg fusion needs to be more robust. This revision also implements such a check.

In the current form, there are still some canonicalizations missing due to  AffineMin/Max ops fed by scf::ForOp. These will be improved at a later time.

Differential Revision: https://reviews.llvm.org/D80267
2020-05-20 09:39:56 -04:00
Alex Zinenko eab4a199d1 [mlir] NFC: rename tests related to SCF dialect from Loops to SCF
The dialect and conversions from/to it were renamed in previous commits.

Differential Revision: https://reviews.llvm.org/D80216
2020-05-20 15:08:23 +02:00
Tres Popp 02035580d3 [mlir] Add custom assembly formats to shape.witness ops.
The assembly formats are essentially the generic forms without
quotations and type information.

Differential Revision: https://reviews.llvm.org/D80180
2020-05-20 13:25:33 +02:00
Tres Popp fb6986ef69 [mlir] Custom printing/parsing for Shape::AssumingOp
Summary:
Additionally, this adds traits and builder methods to AssumingYieldOp
and names the input witness to the AssumingOp.

Differential Revision: https://reviews.llvm.org/D80187
2020-05-20 10:39:26 +02:00
Tres Popp 44226c1fea [mlir] Mark witness related Shape dialect ops as NoSideEffect.
Differential Revision: https://reviews.llvm.org/D80179
2020-05-20 10:26:35 +02:00
Haruki Imai 9f2ce5b915 [mlir][SystemZ] Fix incompatible datalayout in SystemZ
MLIR tests in "mlir/test/mlir-cpu-runner" fails in SystemZ (z14) because
of incompatible datalayout error. This patch fixes it by setting host
CPU name in createTargetMachine()

Differential Revision: https://reviews.llvm.org/D80130
2020-05-20 03:46:26 +00:00
Chintan Kaur 78453e3705 Mark AffineMap::replaceDimsAndSymbols as const (NFC)
This is consistent to the other methods of the class, as well as
AffineExpr::replaceDimsAndSymbols.

Differential Revision: https://reviews.llvm.org/D80266
2020-05-20 03:11:41 +00:00
Nicolas Vasilache da95a0d8cc [mlir] NFC - Appease gcc 5
This should fix the error ```
VectorToSCF.cpp:238:62: error: specialization of 'template<class
ConcreteOp> mlir::LogicalResult
{anonymous}::NDTransferOpHelper<ConcreteOp>::doReplace()' in different
namespace
```
2020-05-19 22:47:51 -04:00
Thomas Raoux b359bbaa8b [mlir][spirv] First step to support spirv cooperative matrix extension.
Add a new type to SPIRV dialect for cooperative matrix and add new op for
cooperative matrix load. This is missing most instructions to support
cooperative matrix extension but this is a stop-gap patch to avoid creating big
review.

Differential Revision: https://reviews.llvm.org/D80043
2020-05-19 19:29:41 -07:00
Thomas Raoux 92577e6a0f [mlir][vulkan-runner] Minor fix in timestamp flag for vulkan runner.
The first timestamp query should use VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT.

Differential Revision: https://reviews.llvm.org/D80183
2020-05-19 18:56:48 -07:00
Diego Caballero a45fb1942f [mlir][Affine] Introduce affine memory interfaces
This patch introduces interfaces for read and write ops with affine
restrictions. I used `read`/`write` intead of `load`/`store` for the
interfaces so that they can also be implemented by dma ops.
For now, they are only implemented by affine.load, affine.store,
affine.vector_load and affine.vector_store.

For testing purposes, this patch also migrates affine loop fusion and
required analysis to use the new interfaces. No other changes are made
beyond that.

Co-authored-by: Alex Zinenko <zinenko@google.com>

Reviewed By: bondhugula, ftynse

Differential Revision: https://reviews.llvm.org/D79829
2020-05-19 17:32:50 -07:00
Kuangyuan Chen fb8204b210 [mlir][ods] Fix ops with both attribute-sized operands and results
Enclose verifier code for AttrSizedOperandSegments and AttrSizedResultSegments
in a nested code block to avoid symbol collision.

Differential Revision: https://reviews.llvm.org/D80250
2020-05-19 20:29:54 -04:00
Stephen Neuendorffer 0368c1de9c [MLIR][cmake][NFC] Check for incorrect usage of LLVM components in LINK_LIBS
Using LLVM components in LINK_LIBS means that the mechanisms for
replacing component dependencies with libLLVM.so break.  Try to catch
this incorrect usage up front, instead of waiting until later when we
get difficult to understand runtime errors from incorrectly linked
libraries.

Differential Revision: https://reviews.llvm.org/D80103
2020-05-19 14:50:54 -07:00
Stephen Neuendorffer b54635e0ec [MLIR] LLVMMLIRTableGen -> MLIRTableGen
Like all MLIR libraries, this should start with 'MLIR'

Differential Revision: https://reviews.llvm.org/D80102
2020-05-19 14:49:32 -07:00
MaheshRavishankar d5b1643c74 [mlir][SPIRV] Fix blocks nested too deeply error.
Issue arises due to a giant if/else if/else/... construct. Changing
them to just ifs.

Differential Revision: https://reviews.llvm.org/D80245
2020-05-19 14:29:56 -07:00
Sean Silva 21b0eff773 [mlir][shape] Add `shape.from_extents`.
Summary:
This is a basic op needed for creating shapes from SSA values
representing the extents.

Differential Revision: https://reviews.llvm.org/D79833
2020-05-19 14:26:08 -07:00
Benjamin Kramer 350dadaa8a Give helpers internal linkage. NFC. 2020-05-19 22:16:37 +02:00
Hanhan Wang 520a570268 [mlir][StandardToSPIRV] Fix signedness issue in bitwidth emulation.
Summary:
Previously, after applying the mask, a negative number would convert to a
positive number because the sign flag was forgotten. This patch adds two more
shift operations to do the sign extension. This assumes that we're using two's
complement.

This patch applies sign extension unconditionally when loading a unspported integer width, and it relies the pattern to do the casting because the signedness semantic is carried by operator itself.

Differential Revision: https://reviews.llvm.org/D79753
2020-05-19 11:00:01 -07:00
Ehsan Toosi 3468300511 [MLIR] Update the FunctionAndBlockSignatureConverter and NonVoidToVoidReturnOpConverter of Buffer Assignment
Making these two converters more generic. FunctionAndBlockSignatureConverter now
moves only memref results (after type conversion) to the function argument and
keeps other legal function results unchanged. NonVoidToVoidReturnOpConverter is
renamed to NoBufferOperandsReturnOpConverter. It removes only the buffer
operands from the operands of the converted ReturnOp and inserts CopyOps to copy
each buffer to the target function argument.

Differential Revision: https://reviews.llvm.org/D79329
2020-05-19 17:04:59 +02:00
Alex Zinenko d1560f3956 [mlir] scf::ForOp: provide builders with callbacks for loop body
Thanks to a recent change that made `::build` functions take an instance of
`OpBuilder`, it is now possible to build operations within a region attached to
the operation about to be created. Exercise this on `scf::ForOp` by taking a
callback that populates the loop body while the loop is being created.

Additionally, provide helper functions to build perfect nests of `ForOp`s,
with support for iteration arguments. These functions provide the same
functionality as EDSC LoopNestBuilder with simpler implementation, without
relying on edsc::ScopedContext, and using `OpBuilder` in an unambiguous way.
Compatibility functions for EDSC are provided, but may be removed in the
future.

Differential Revision: https://reviews.llvm.org/D79688
2020-05-19 16:26:29 +02:00
George e984b7f2a2 Added a TanOp to SPIR-V dialect GLSL ops
Implemented tangent op from SPIR-V's GLSL extended instruction set.
Added a round-trip and serialization/deserialization tests for the op.

Differential Revision: https://reviews.llvm.org/D80152
2020-05-19 09:15:29 -04:00
Christian Sigg 62adfed30a Unrank mcuMemHostRegister tensor argument.
Reviewers: herhut

Reviewed By: herhut

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

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D80118
2020-05-19 13:58:54 +02:00
Frederik Gossen 5afd86b0de [MLIR] Add helper functions for common integer types
Add helper functions for 32-bit and 64-bit integer types.

Differential Revision: https://reviews.llvm.org/D80111
2020-05-19 11:42:41 +00:00
Kiran Kumar T P fa8fc9ffcc [MLIR, OpenMP] Support for flush operation, and translating the same to LLVM IR
Summary:
This patch adds support for flush operation in OpenMP dialect and translation of this construct to LLVM IR.
The OpenMP IRBuilder is used for this translation.
The patch includes code changes and testcase modifications.

Reviewed By: ftynse, kiranchandramohan

Differential Revision: https://reviews.llvm.org/D79937
2020-05-19 17:01:25 +05:30
Lei Zhang 715b7d8aa5 [mlir][vulkan-runner] Add back accidentially removed header include
Differential Revision: https://reviews.llvm.org/D80149
2020-05-18 15:19:24 -04:00
George 3c4ef74555 Fixed a typo in the comment for allocateBuffer()
Differential Revision: https://reviews.llvm.org/D80087
2020-05-18 14:41:57 -04:00
Alexandre Rames 23dc948d36 [MLIR] Use `MLIR_INCLUDE_TESTS` to conditionally compile tests.
This is equivalent to what is done for other projects (e.g. clang).

Differential Revision: https://reviews.llvm.org/D80022
2020-05-18 18:47:37 +02:00
Tobias Gysi a4cb9bec1c [mlir] Support optional attributes in assembly formats
Summary: This revision adds support for assembly formats with optional attributes. It elides optional attributes that are part of the syntax from the attribute dictionary.

Reviewers: ftynse, Kayjukh

Reviewed By: ftynse, Kayjukh

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

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D80113
2020-05-18 18:34:35 +02:00
Pierre Oechsel d1866f8947 [MLIR] [Linalg] Add option to use the partial view after promotion.
For now the promoted buffer is indexed using the `full view`. The full view might be
slightly bigger than the partial view (which is accounting for boundaries).
Unfortunately this does not compose easily with other transformations when multiple buffers
with shapes related to each other are involved.
Take `linalg.matmul A B C` (with A of size MxK, B of size KxN and C of size MxN) and suppose we are:
- Tiling over M by 100
- Promoting A only

This is producing a `linalg.matmul promoted_A B subview_C` where `promoted_A` is a promoted buffer
of `A` of size (100xK) and `subview_C` is a subview of size mxK where m could be smaller than 100 due
to boundaries thus leading to a possible incorrect behavior.

We propose to:
- Add a new parameter to the tiling promotion allowing to enable the use of the full tile buffer.
- By default all promoted buffers will be indexed by the partial view.

Note that this could be considered as a breaking change in comparison to the way the tiling promotion
was working.

Differential Revision: https://reviews.llvm.org/D79927
2020-05-18 18:28:18 +02:00
Nicolas Vasilache 1870e787af [mlir][Vector] Add an optional "masked" boolean array attribute to vector transfer operations
Summary:
Vector transfer ops semantic is extended to allow specifying a per-dimension `masked`
attribute. When the attribute is false on a particular dimension, lowering to LLVM emits
unmasked load and store operations.

Differential Revision: https://reviews.llvm.org/D80098
2020-05-18 11:52:08 -04:00
Nicolas Vasilache 36cdc17f8c [mlir][Vector] Make minor identity permutation map optional in transfer op printing and parsing
Summary:
This revision makes the use of vector transfer operatons more idiomatic by
allowing to omit and inferring the permutation_map.

Differential Revision: https://reviews.llvm.org/D80092
2020-05-18 11:41:27 -04:00
Nicolas Vasilache 03092f2fa7 [mlir] Add BoolArrayAttr in Tablegen + Builder support
Differential Revision: https://reviews.llvm.org/D80090
2020-05-18 09:42:12 -04:00
Nicolas Vasilache 79f059c4ac [mlir] NFC - Fix OperationSupport.cpp::findNamedAttr
Summary:
When NamedAttrList::get is called against a StringRef and the
entry is not present, the Identifier::operator== crashes.
Interestingly there seems to be no use of the NamedAttrList::get(StringRef) in
the codebase so far. A subsequent commit will introduce such a use.

Differential Revision: https://reviews.llvm.org/D80089
2020-05-18 09:36:00 -04:00
Stephen Neuendorffer d6b3b8a1a3 [MLIR][cmake] Fix unittest/Tablegen by special casing LLVMMLIRTableGen
unittest/Tablegen generates an executable that depends on MLIRIR and
LLVMMLIRTableGen.  Avoid specifying linkage dependence on LLVM
libraries here because then everyone has to depend on those libraries.

Differential Revision: https://reviews.llvm.org/D80093
2020-05-17 17:47:22 -07:00
Mehdi Amini 051452bdb1 Remove spurious semicolon after function definition (NFC)
This fixes some GCC pedantic warnings.
2020-05-17 23:15:17 +00:00
Stephen Neuendorffer 37ce8d6ade [MLIR] Fix linkage for libMLIR.so
Generally:
1) don't use target_link_libraries() and add_mlir_library() on the same target, use LINK_LIBS PUBLIC instead.
2) don't use LINK_LIBS to specify LLVM libraries.  Use LINK_COMPONENTS instead
3) no need to link against LLVMSupport.  We pull it in by default.

Differential Revision: https://reviews.llvm.org/D80076
2020-05-17 13:46:52 -07:00
Stephen Neuendorffer f88c7fe46b [MLIR][cmake][NFC] Update linkage checker for mlir-opt
New CMakeLists.txt for MLIRStandardOpsTransforms was incorrect, but wasn't
caught by the check.

Differential Revision: https://reviews.llvm.org/D80075
2020-05-17 13:46:52 -07:00
Nicolas Vasilache 1d6eb09d22 [mlir] NFC - VectorTransforms use OpBuilder where relevant
Summary: This will allow using unrolling outside of only rewrite patterns.

Differential Revision: https://reviews.llvm.org/D80083
2020-05-17 10:17:12 -04:00
Stephen Neuendorffer efa70843aa [MLIR][cmake] use LINK_LIBS PUBLIC for MLIRStandardOpsTransforms
Without this LLVM_LINK_LLVM_DYLIB is broken

Differential Revision: https://reviews.llvm.org/D80074
2020-05-16 22:45:14 -07:00
Eli Friedman 4f04db4b54 AllocaInst should store Align instead of MaybeAlign.
Along the lines of D77454 and D79968.  Unlike loads and stores, the
default alignment is getPrefTypeAlign, to match the existing handling in
various places, including SelectionDAG and InstCombine.

Differential Revision: https://reviews.llvm.org/D80044
2020-05-16 14:53:16 -07:00
Denis Khalikov 0dc91bfd11 [mlir][spirv] Handle debuginfo for control flow ops.
Summary:
Handle debuginfo for control flow operations: spv.Selection,
spv.Loop, spv.BranchOp, spv.BranchConditional.

Differential Revision: https://reviews.llvm.org/D79931
2020-05-16 15:36:14 +03:00
Stephen Neuendorffer ec44e08940 [MLIR] Move JitRunner to live with ExecutionEngine
The JitRunner library is logically very close to the execution engine,
and shares similar dependencies.

find -name "*.cpp" -exec sed -i "s/Support\/JitRunner/ExecutionEngine\/JitRunner/" "{}" \;

Differential Revision: https://reviews.llvm.org/D79899
2020-05-15 14:37:10 -07:00
Stephen Neuendorffer 444720c250 [MLIR][cmake] refactor lib/Interfaces/CMakeLists.txt
Reduce the boilerplate here

Differential Revision: https://reviews.llvm.org/D79896
2020-05-15 14:37:09 -07:00
Stephen Neuendorffer eb623ae832 [MLIR] Continue renaming of "SideEffects"
MLIRSideEffects -> MLIRSideEffectInterfaces
SideEffects.h -> SideEffectInterfaces.h
SideEffects.cpp -> SideEffectInterface.cpp

Note that I haven't renamed TableGen/SideEffects.h or TableGen/SideEffects.cpp

find -name "*.h" -exec sed -i "s/SideEffects.h/SideEffectInterfaces.h/" "{}" \;
find -name "CMakeLists.txt" -exec sed -i "s/MLIRSideEffects/MLIRSideEffectInterfaces/" "{}" \;

Differential Revision: https://reviews.llvm.org/D79890
2020-05-15 14:37:09 -07:00
Stephen Neuendorffer 802b427f20 [MLIR] Update intrinsic test, because ptrmask changed.
See adda9c0a4f.

Differential Revision: https://reviews.llvm.org/D80036
2020-05-15 14:35:39 -07:00
Stephen Neuendorffer 1cff8e8de7 [MLIR] LinalgToStandard: use LINK_LIBS rather than target_link_libraries.
Also, missing MLIRTransforms as a dependency.  This breaks BUILD_SHARED_LIBS=on

Differential Revision: https://reviews.llvm.org/D80035
2020-05-15 14:25:28 -07:00
aartbik b1c688dbae [mlir] [VectorOps] Implement vector.create_mask lowering to LLVM IR
Summary:
First, compact implementation of lowering to LLVM IR. A bit more
challenging than the constant mask due to the dynamic indices, of course.
I like to hear if there are more efficient ways of doing this in LLVM,
but this for now at least gives us a functional reference implementation.

Reviewers: nicolasvasilache, ftynse, bkramer, reidtatge, andydavis1, mehdi_amini

Reviewed By: nicolasvasilache

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

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D79954
2020-05-15 11:02:30 -07:00
Nicolas Vasilache 8b78c50e82 [mlir] Fix incorrect indexing of subview in DimOp folding.
DimOp folding is using bare accesses to underlying SubViewOp operands.
This is generally incorrect and is fixed in this revision.

Differential Revision: https://reviews.llvm.org/D80017
2020-05-15 13:50:40 -04:00
Nikita Popov f89f7da999 [IR] Convert null-pointer-is-valid into an enum attribute
The "null-pointer-is-valid" attribute needs to be checked by many
pointer-related combines. To make the check more efficient, convert
it from a string into an enum attribute.

In the future, this attribute may be replaced with data layout
properties.

Differential Revision: https://reviews.llvm.org/D78862
2020-05-15 19:41:07 +02:00
Stephen Neuendorffer 9de4ee3815 [MLIR] Allow unreachable blocks to violate dominance property.
It is possible for optimizations to create SSA code which violates
the dominance property in unreachable blocks.  Equivalently, dominance
computed using normal mechanisms is undefined in unreachable blocks.

See discussion here: https://llvm.discourse.group/t/rfc-allowing-dialects-to-relax-the-ssa-dominance-condition/833/51

This patch only checks the dominance condition inside blocks which are
reachable from the the entry block of their region.  Note that the
dominance conditions of regions contained in an unreachable block are
still checked.

Differential Revision: https://reviews.llvm.org/D79922
2020-05-15 10:31:57 -07:00
Tres Popp a26883e5aa [MLIR] Add shape.witness type and ops
Summary: These represent shape based preconditions on execution of code.

Differential Revision: https://reviews.llvm.org/D79717
2020-05-15 14:33:54 +02:00
Alex Zinenko 4ead2cf76c [mlir] Rename conversions involving ex-Loop dialect to mention SCF
The following Conversions are affected: LoopToStandard -> SCFToStandard,
LoopsToGPU -> SCFToGPU, VectorToLoops -> VectorToSCF. Full file paths are
affected. Additionally, drop the 'Convert' prefix from filenames living under
lib/Conversion where applicable.

API names and CLI options for pass testing are also renamed when applicable. In
particular, LoopsToGPU contains several passes that apply to different kinds of
loops (`for` or `parallel`), for which the original names are preserved.

Differential Revision: https://reviews.llvm.org/D79940
2020-05-15 10:45:11 +02:00
Alex Zinenko 7fc5f28068 [mlir] LinalgToStandard: add build dependency on MLIRPass
This is supposed to resolve the build problem with shared libraries.
2020-05-15 10:20:04 +02:00
MaheshRavishankar 0b3e478b10 [mlir][GPUToSPIRV] Use default ABI only when none of the arguments
have abi attributes.

To ensure there is no conflict, use the default ABI only when none of
the arguments have the spv.interface_var_abi attribute. This also
implies that if one of the arguments has a spv.interface_var_abi
attribute, all of them should have it as well.

Differential Revision: https://reviews.llvm.org/D77232
2020-05-14 21:48:51 -07:00
Nicolas Vasilache f1b972041a [mlir][Linalg] Start a LinalgToStandard pass and move conversion to library calls.
This revision starts decoupling the include the kitchen sink behavior of Linalg to LLVM lowering by inserting a -convert-linalg-to-std pass.

The lowering of linalg ops to function calls was previously lowering to memref descriptors by having both linalg -> std and std -> LLVM patterns in the same rewrite.

When separating this step, a new issue occurred: the layout is automatically type-erased by this process. This revision therefore introduces memref casts to perform these type erasures explicitly. To connect everything end-to-end, the LLVM lowering of MemRefCastOp is relaxed because it is artificially more restricted than the op semantics. The op semantics already guarantee that source and target MemRefTypes are cast-compatible. An invalid lowering test now becomes valid and is removed.

Differential Revision: https://reviews.llvm.org/D79468
2020-05-15 00:24:03 -04:00
Eugene Zhulenev 3a11ca7bed [MLIR] Add symbol map to mlir ExecutionEngine
Add additional symbol mapping to be able to provide custom symbols to jitted code at runtime.

Differential Revision: https://reviews.llvm.org/D79812
2020-05-14 22:30:03 +02:00
Diego Caballero bc5565f9ea [mlir][Affine] Introduce affine.vector_load and affine.vector_store
This patch adds `affine.vector_load` and `affine.vector_store` ops to
the Affine dialect and lowers them to `vector.transfer_read` and
`vector.transfer_write`, respectively, in the Vector dialect.

Reviewed By: bondhugula, nicolasvasilache

Differential Revision: https://reviews.llvm.org/D79658
2020-05-14 13:17:58 -07:00
Eli Friedman 4532a50899 Infer alignment of unmarked loads in IR/bitcode parsing.
For IR generated by a compiler, this is really simple: you just take the
datalayout from the beginning of the file, and apply it to all the IR
later in the file. For optimization testcases that don't care about the
datalayout, this is also really simple: we just use the default
datalayout.

The complexity here comes from the fact that some LLVM tools allow
overriding the datalayout: some tools have an explicit flag for this,
some tools will infer a datalayout based on the code generation target.
Supporting this properly required plumbing through a bunch of new
machinery: we want to allow overriding the datalayout after the
datalayout is parsed from the file, but before we use any information
from it. Therefore, IR/bitcode parsing now has a callback to allow tools
to compute the datalayout at the appropriate time.

Not sure if I covered all the LLVM tools that want to use the callback.
(clang? lli? Misc IR manipulation tools like llvm-link?). But this is at
least enough for all the LLVM regression tests, and IR without a
datalayout is not something frontends should generate.

This change had some sort of weird effects for certain CodeGen
regression tests: if the datalayout is overridden with a datalayout with
a different program or stack address space, we now parse IR based on the
overridden datalayout, instead of the one written in the file (or the
default one, if none is specified). This broke a few AVR tests, and one
AMDGPU test.

Outside the CodeGen tests I mentioned, the test changes are all just
fixing CHECK lines and moving around datalayout lines in weird places.

Differential Revision: https://reviews.llvm.org/D78403
2020-05-14 13:03:50 -07:00
Marius Brehler 426afd79da [mlir] Adopt changes in mlir-opt to standalone example
MLIRContext was moved with commit 6bce7d8

Differential Revision: https://reviews.llvm.org/D79946
2020-05-14 17:50:55 +00:00
Stephan Herhut 9ffaba86e5 [mlir] Fix the example for std.rank
Summary:
The assembly format for std.rank expects the operand type and not the
result type after the colon.

Differential Revision: https://reviews.llvm.org/D79857
2020-05-14 10:45:07 +02:00
Stephen Neuendorffer d3530e95f1 [MLIR][cmake] don't glob for sources.
Generally speaking, this is bad practice.  It also causes the build to
break if there are editor temporary files.

Differential Revision: https://reviews.llvm.org/D79906
2020-05-13 23:21:01 -07:00
Sean Silva 0aa97ad5c8 [mlir] Change generate-test-checks.py to `%[[V:.*]]` style
Summary:
This style seems to be the preferred style lately as it plays better
with op syntaxes that include `[` and `]`.

Input:
```
module {
  func @f(%arg0 : i32) -> i32 {
    %0 = addi %arg0, %arg0 : i32
    %1 = muli %arg0, %0 : i32
    return %1 : i32
  }
}
```

New output:

```
// NOTE: Assertions have been autogenerated by utils/generate-test-checks.py
// CHECK:       module {

// CHECK-LABEL:   func @f(
// CHECK-SAME:            %[[VAL_0:.*]] : i32) -> i32 {
// CHECK:           %[[VAL_1:.*]] = addi %[[VAL_0]], %[[VAL_0]] : i32
// CHECK:           %[[VAL_2:.*]] = muli %[[VAL_0]], %[[VAL_1]] : i32
// CHECK:           return %[[VAL_2]] : i32
// CHECK:         }
// CHECK:       }
```

Old output:
```
// NOTE: Assertions have been autogenerated by utils/generate-test-checks.py
// CHECK:       module {

// CHECK-LABEL:   func @f(
// CHECK-SAME:            [[VAL_0:%.*]] : i32) -> i32 {
// CHECK:           [[VAL_1:%.*]] = addi [[VAL_0]], [[VAL_0]] : i32
// CHECK:           [[VAL_2:%.*]] = muli [[VAL_0]], [[VAL_1]] : i32
// CHECK:           return [[VAL_2]] : i32
// CHECK:         }
// CHECK:       }
```

Differential Revision: https://reviews.llvm.org/D79836
2020-05-13 14:50:14 -07:00
Lei Zhang a4441fcd12 [mlir][vulkan-runner] Avoid dependency on LLVM libraries
The Vulkan runtime wrapper will be compiled to a shared library
that are loaded by the JIT runner. Depending on LLVM libraries
means that LLVM symbols will be compiled into the shared library.
That can cause problems if we are using it with other shared
libraries depending on LLVM, notably Mesa, the open-source graphics
driver framework. The Vulkan API wrappers invoked by the JIT runner
links to the system libvulkan.so. If it's Mesa providing the
implementation, Mesa will normally try to load the system libLLVM.so
for its shader compilation. That causes issues because the JIT runner
already loaded the Vulkan runtime wrapper which has LLVM sybmols
compiled in. So system linker will instruct Mesa to use those symbols
instead.

Differential Revision: https://reviews.llvm.org/D79860
2020-05-13 13:42:34 -04:00
Stephen Neuendorffer d02fce2d14 [MLIR] Discourage people from copying the toy examples
The CMake structure of the toy example is non-standard.  encourage people to
copy the standalone example instead.

Differential Revision: https://reviews.llvm.org/D79889
2020-05-13 10:37:06 -07:00
Stephen Neuendorffer ce3bbeb915 [MLIR] refactor cmake specification of tablegen'd interfaces.
Introduce add_mlir_interface to avoid lots of boilerplate

Differential Revision: https://reviews.llvm.org/D79841
2020-05-13 10:37:06 -07:00
Alex Zinenko 60f443bb3b [mlir] Change dialect namespace loop->scf
All ops of the SCF dialect now use the `scf.` prefix instead of `loop.`. This
is a part of dialect renaming.

Differential Revision: https://reviews.llvm.org/D79844
2020-05-13 19:20:21 +02:00
MaheshRavishankar 902777ded5 [mlir][Linalg] Fix missing template keyword.
Differential Revision: https://reviews.llvm.org/D79884
2020-05-13 10:08:26 -07:00
Pierre Oechsel a5d80818fa [mlir] [VectorOps] Add missing EDSC intrinsics.
Differential Revision: https://reviews.llvm.org/D79858
2020-05-13 10:11:30 -04:00
Nicolas Vasilache e0b99a5de4 [mlir] Add SubViewOp::getOrCreateRanges and fix folding pattern
The existing implementation of SubViewOp::getRanges relies on all
offsets/sizes/strides to be dynamic values and does not work in
combination with canonicalization. This revision adds a
SubViewOp::getOrCreateRanges to create the missing constants in the
canonicalized case.

This allows reactivating the fused pass with staged pattern
applications.

However another issue surfaces that the SubViewOp verifier is now too
strict to allow folding. The existing folding pattern is turned into a
canonicalization pattern which rewrites memref_cast + subview into
subview + memref_cast.

The transform-patterns-matmul-to-vector can then be reactivated.

Differential Revision: https://reviews.llvm.org/D79759
2020-05-13 10:11:30 -04:00
Ehsan Toosi 1b140a87a5 [MLIR] Nested regions test for Buffer Assginment
Due to the extension of Liveness, Buffer Assignment can now work on nested regions. This PR provides a test case to show that existing functionally of BA works properly.

Differential Revision: https://reviews.llvm.org/D79332
2020-05-13 14:53:21 +02:00
Marcel Koester 881c3bb6a7 [mlir] Adapted standard Alloc and Alloca ops to use new side-effect resources.
The current standard Alloca node is not annotated with the
MemEffect<Alloc> trait. This CL updates the Alloc and Alloca
memory-effect annotations using the latest Resource objects. Alloca
nodes will use a newly defined AutomaticAllocationScopeResource to
distinguish between Alloc and Alloca memory effects.

Differential Revision: https://reviews.llvm.org/D79620
2020-05-13 13:46:39 +02:00
MaheshRavishankar 49e6c19100 [mlir][StandardToLLVM] Add SinOp to LLVM dialect and lowering of std.sin to this op.
Differential Revision: https://reviews.llvm.org/D79505
2020-05-12 23:15:25 -07:00
MaheshRavishankar 5440d0a12d [mlir][Linalg] Add folders and canonicalizers for
linalg.reshape/linalg.tensor_reshape operations.

Differential Revision: https://reviews.llvm.org/D79765
2020-05-12 23:03:26 -07:00
MaheshRavishankar d2a9569850 [mlir][Linalg] Allow reshapes to collapse to a zero-rank tensor.
This is only valid if the source tensors (result tensor) is static
shaped with all unit-extents when the reshape is collapsing
(expanding) dimensions.

Differential Revision: https://reviews.llvm.org/D79764
2020-05-12 23:03:25 -07:00
aartbik fb2c4d50f1 [mlir] [VectorOps] Implement vector.constant_mask lowering to LLVM IR
Summary:
Makes this operation runnable on CPU by generating MLIR instructions
that are eventually folded into an LLVM IR constant for the mask.

Reviewers: nicolasvasilache, ftynse, reidtatge, bkramer, andydavis1

Reviewed By: nicolasvasilache, ftynse, andydavis1

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

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D79815
2020-05-12 19:44:23 -07:00
Nicolas Vasilache 63c0e72b2f [mlir] Revisit std.subview handling of static information.
The main objective of this revision is to change the way static information is represented, propagated and canonicalized in the SubViewOp.

In the current implementation the issue is that canonicalization may strictly lose information because static offsets are combined in irrecoverable ways into the result type, in order to fit the strided memref representation.

The core semantics of the op do not change but the parser and printer do: the op always requires `rank` offsets, sizes and strides. These quantities can now be either SSA values or static integer attributes.

The result type is automatically deduced from the static information and more powerful canonicalizations (as powerful as the representation with sentinel `?` values allows). Previously static information was inferred on a best-effort basis from looking at the source and destination type.

Relevant tests are rewritten to use the idiomatic `offset: x, strides : [...]`-form. Bugs are corrected along the way that were not trivially visible in flattened strided memref form.

Lowering to LLVM is updated, simplified and now supports all cases.
A mixed static-dynamic mode test that wouldn't previously lower is added.

It is an open question, and a longer discussion, whether a better result type representation would be a nicer alternative. For now, the subview op carries the required semantic.

Differential Revision: https://reviews.llvm.org/D79662
2020-05-12 20:04:44 -04:00
Sean Silva 452e2fc409 Revert of Revert of [mlir][shape] Tidy up shape.shape_of
Summary:

- Mark it NoSideEffect
- Add custom parser/printer

This reverts the temporary revert in
https://reviews.llvm.org/rG84a9c725742d26df04808a3c7349dbd98684c6cb
That was a false alarm. A downstream test actually needed to be updated.
2020-05-12 15:51:24 -07:00
Alex Zinenko 473bdaf2e8 [mlir] Move Conversion/StandardToStandard to Dialect/StandardOps/Transforms/FuncConversions
Conversion/ folders were originally intended to store patterns for
DialectA->DialectB conversions that depend on both dialects and do not
conceptually belong to either of the dialects. As such, DialectA->DialectA
conversion does not make sense under Conversion/ and should rather live with
the dialect it operates on.

Differential Revision: https://reviews.llvm.org/D79569
2020-05-13 00:33:25 +02:00
Stephen Neuendorffer 7a17f3ccd1 [MLIR] Fix dependencies for Analysis libraries
cmake does not truly support dependencies on automatically generated files
which are not in the same directory as the targets which depend on them.
It works with ninja, but doesn't work with make

This patch adds an explicit dependence so that all dialects are built
before the analysis libraries.

Differential Revision: https://reviews.llvm.org/D79805
2020-05-12 13:41:16 -07:00
Stephen Neuendorffer 661b234cbc [MLIR] Rename SideEffects.td -> SideEffectInterfaces.td
This normalize the name of the tablegen file with the name of the generated
files (SideEffectInterfaces.h.inc) and the other Interface tablegen files,
which all end in Interface(s).td

Differential Revision: https://reviews.llvm.org/D79517
2020-05-12 12:21:42 -07:00
Sam McCall 691e826995 Revert "[mlir] Revisit std.subview handling of static information."
This reverts commit 80d133b24f.

Per Stephan Herhut: The canonicalizer pattern that was added creates
forms of the subview op that cannot be lowered.

This is shown by failing Tensorflow XLA tests such as:
  tensorflow/compiler/xla/service/mlir_gpu/tests:abs.hlo.test
Will provide more details offline, they rely on logs from private CI.
2020-05-12 15:18:50 +02:00
Eric Christopher 84a9c72574 Temporarily Revert "[mlir][shape] Tidy up shape.shape_of" as it's breaking a few tests.
This reverts commit b604544886.

Followed up offline with a testcase.
2020-05-11 23:05:18 -07:00
aartbik 40f56c8cf1 [mlir] [VectorOps] Replace zero-scalar + splat into direct zero vector constant
Summary:
The scalar zero + splat yields more intermediate code than the direct
dense zero constant, and ultimately is lowered to exactly the same
LLVM IR operations, so no point wasting the intermediate code.

Reviewers: nicolasvasilache, andydavis1, reidtatge

Reviewed By: nicolasvasilache

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

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D79758
2020-05-11 20:20:37 -07:00
Rahul Joshi 5633813bf3 [MLIR] Fix several misc issues in in Toy tutorial
Summary:
- Fix comments in several places
- Eliminate extra ' in AST dump and adjust tests accordingly

Differential Revision: https://reviews.llvm.org/D78399
2020-05-11 16:56:47 -07:00
Hanhan Wang 756d6959d7 [mlir][StandardToSPIRV] Add support for lowering index_cast to SPIR-V.
Differential Revision: https://reviews.llvm.org/D79644
2020-05-11 15:41:25 -07:00
Nicolas Vasilache 80d133b24f [mlir] Revisit std.subview handling of static information.
Summary:
The main objective of this revision is to change the way static information is represented, propagated and canonicalized in the SubViewOp.

In the current implementation the issue is that canonicalization may strictly lose information because static offsets are combined in irrecoverable ways into the result type, in order to fit the strided memref representation.

The core semantics of the op do not change but the parser and printer do: the op always requires `rank` offsets, sizes and strides. These quantities can now be either SSA values or static integer attributes.

The result type is automatically deduced from the static information and more powerful canonicalizations (as powerful as the representation with sentinel `?` values allows). Previously static information was inferred on a best-effort basis from looking at the source and destination type.

Relevant tests are rewritten to use the idiomatic `offset: x, strides : [...]`-form. Bugs are corrected along the way that were not trivially visible in flattened strided memref form.

It is an open question, and a longer discussion, whether a better result type representation would be a nicer alternative. For now, the subview op carries the required semantic.

Reviewers: ftynse, mravishankar, antiagainst, rriddle!, andydavis1, timshen, asaadaldien, stellaraccident

Reviewed By: mravishankar

Subscribers: aartbik, bondhugula, mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, arpith-jacob, mgester, lucyrfox, liufengdb, stephenneuendorffer, Joonsoo, bader, grosul1, frgossen, Kayjukh, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D79662
2020-05-11 17:44:24 -04:00
Reid Tatge 334a4159ec [mlir][Vector] NFC - Rename vector.strided_slice into vector.extract_strided_slice
Differential Revision: https://reviews.llvm.org/D79734
2020-05-11 14:21:10 -07:00
Nicolas Vasilache d12d05a731 [mlir][Linalg] Introduce a helper function for staged pattern application
Summary:
This revision introduces a helper function to allow applying rewrite patterns, interleaved with more global transformations, in a staged fashion:
1. the first stage consists of an OwningRewritePatternList. The RewritePattern in this list are applied once and in order.
2. the second stage consists of a single OwningRewritePattern that is applied greedily until convergence.
3. the third stage consists of applying a lambda, generally used for non-local transformation effects.

This allows creating custom fused transformations where patterns can be ordered and applied at a finer granularity than a sequence of traditional compiler passes.

A test that exercises these behaviors is added.

Differential Revision: https://reviews.llvm.org/D79518
2020-05-11 16:46:30 -04:00
Sean Silva b604544886 [mlir][shape] Tidy up shape.shape_of
Summary:
- Mark it NoSideEffect
- Add custom parser/printer

Differential Revision: https://reviews.llvm.org/D79684
2020-05-11 12:55:31 -07:00
Sean Silva 98eead8186 [mlir][Value] Add v.getDefiningOp<OpTy>()
Summary:
This makes a common pattern of
`dyn_cast_or_null<OpTy>(v.getDefiningOp())` more concise.

Differential Revision: https://reviews.llvm.org/D79681
2020-05-11 12:55:27 -07:00
Nicolas Vasilache 6ed61a26c2 [mlir] Simplify and better document std.view semantics
This [discussion](https://llvm.discourse.group/t/viewop-isnt-expressive-enough/991/2) raised some concerns with ViewOp.

In particular, the handling of offsets is incorrect and does not match the op description.
Note that with an elemental type change, offsets cannot be part of the type in general because sizeof(srcType) != sizeof(dstType).

Howerver, offset is a poorly chosen term for this purpose and is renamed to byte_shift.

Additionally, for all intended purposes, trying to support non-identity layouts for this op does not bring expressive power but rather increases code complexity.

This revision simplifies the existing semantics and implementation.
This simplification effort is voluntarily restrictive and acts as a stepping stone towards supporting richer semantics: treat the non-common cases as YAGNI for now and reevaluate based on concrete use cases once a round of simplification occurred.

Differential revision: https://reviews.llvm.org/D79541
2020-05-11 12:29:23 -04:00
Nicolas Vasilache 8dbbb22383 [mlir][Linalg] NFC - Refactor and simplify Promotion
Summary: This revision introduces LinalgPromotionOptions to more easily control the application of promotion patterns. It also simplifies the different entry points into Promotion in preparation for some behavior change in subsequent revisions.

Differential Revision: https://reviews.llvm.org/D79489
2020-05-11 10:44:45 -04:00
rtayl 58cb88733f [mlir][rocdl] Add xdlops intrinsics to rocdl dialect
Summary: This adds xdlops (mfma) to the rocdl dialect and also tests the translation to llvm ir.

Reviewers: ftynse

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

Tags: #llvm #mlir

Differential Revision: https://reviews.llvm.org/D79642
2020-05-11 10:08:58 -04:00
Alex Zinenko 25d6995079 [mlir] More support for detached regions in affine symbol checkers
Add documentation to `isToLevelValue` explaining its behavior for
detached regions, and fix the overloaded version that accepts `Region`.
2020-05-11 15:29:47 +02:00
Alex Zinenko c25b20c0f6 [mlir] NFC: Rename LoopOps dialect to SCF (Structured Control Flow)
This dialect contains various structured control flow operaitons, not only
loops, reflect this in the name. Drop the Ops suffix for consistency with other
dialects.

Note that this only moves the files and changes the C++ namespace from 'loop'
to 'scf'. The visible IR prefix remains the same and will be updated
separately. The conversions will also be updated separately.

Differential Revision: https://reviews.llvm.org/D79578
2020-05-11 15:04:27 +02:00
Hanhan Wang 3f07cab312 [mlir][StandardToLLVM] Add support for lowering FPToSIOp to LLVM.
Summary: Depends On D79374

Differential Revision: https://reviews.llvm.org/D79455
2020-05-11 01:29:24 -07:00
Hanhan Wang ac691c4fe7 [mlir][StandardToSPIRV] Add support for lowering FPToSIOp to SPIR-V.
Summary: Depends On D79373

Differential Revision: https://reviews.llvm.org/D79374
2020-05-11 01:27:54 -07:00
Hanhan Wang b80da04b44 [mlir] Add FPToSIOp to Standard dialect.
Summary:
Cast from a value interpreted as floating-point to the corresponding signed
integer value. Similar to an element-wise `static_cast` in C++, performs an
element-wise conversion operation.

Differential Revision: https://reviews.llvm.org/D79373
2020-05-11 01:26:02 -07:00
Alex Zinenko 11c4fc6c48 [mlir] Affine dim and symbol checkers: support detached regions
Functions checking whether an SSA value is a valid dimension or symbol for
affine operations can be called on values defined in a detached region (a
region that is not yet attached to an operation), for example, during parsing
or operation construction. These functions will attempt to uncondtionally
dereference a pointer to the parent operation of a region, which may be null
(as fixed by the previous commit, uninitialized before that). Since one cannot
know to which operation a region will be attached, conservatively this
operation would not be a valid affine scope and act accordingly, instead of
crashing.
2020-05-10 14:23:35 +02:00
Alex Zinenko c71101d9ef [mlir] Initialize the Region::container field to nullptr by default
Region has a default constructor that is called when a region is constructed
while an operation is being created, and therefore before the region can be
attached to this operation. The `container` field is uninitialized, which makes
it impossible to check programmatically if a Region is attached to an operation
or not, leading to sly memory errors when this field is read. Initialize it to
nullptr by default and thus make sure one can check if a region is attached to
an operation or not.
2020-05-10 14:23:35 +02:00
Eugene Zhulenev 3c5dd5863c [MLIR] Register JIT event listeners with RTDyldObjectLinkingLayer
Use a new API to register JIT event listeners.

Differential Revision: https://reviews.llvm.org/D78435
2020-05-09 11:17:22 +02:00
Geoffrey Martin-Noble 2280cb880d Add Operation::moveAfter
This revision introduces an Operation::moveAfter mirroring
Operation::moveBefore to move an operation after another
existing operation or an iterator in a specified block.

Resolves https://bugs.llvm.org/show_bug.cgi?id=45799

Differential Revision: https://reviews.llvm.org/D79640
2020-05-08 22:34:21 +00:00
Denis Khalikov b5973d20b3 [mlir][spirv] Handle debuginfo for variables.
Summary:
Handle debuginfo for spv.Variable and spv.globalVariable during
(de)serialization.

Differential Revision: https://reviews.llvm.org/D79566
2020-05-08 18:10:18 +03:00
Frederik Gossen 5d5f61fc89 [MLIR] Add complex addition and substraction to the standard dialect
Complex addition and substraction are the first two binary operations on complex
numbers.
Remaining operations will follow the same pattern.

Differential Revision: https://reviews.llvm.org/D79479
2020-05-08 09:54:18 +00:00
Marcel Koester 568787f81e [mlir] Updated SideEffect interface definitions to use tablegen Resource objects.
The SideEffect interface definitions currently use string expressions to
reference custom resource objects. This CL introduces Resource objects in
tablegen definitions to simplify linking of resource reference to resource
objects.

Differential Revision: https://reviews.llvm.org/D78917
2020-05-08 09:55:08 +02:00
Jacques Pienaar 5eae715a31 [mlir] Add NamedAttrList
This is a wrapper around vector of NamedAttributes that keeps track of whether sorted and does some minimal effort to remain sorted (doing more, e.g., appending attributes in sorted order, could be done in follow up). It contains whether sorted and if a DictionaryAttr is queried, it caches the returned DictionaryAttr along with whether sorted.

Change MutableDictionaryAttr to always return a non-null Attribute even when empty (reserve null cases for errors). To this end change the getter to take a context as input so that the empty DictionaryAttr could be queried. Also create one instance of the empty dictionary attribute that could be reused without needing to lock context etc.

Update infer type op interface to use DictionaryAttr and use NamedAttrList to avoid incurring multiple conversion costs.

Fix bug in sorting helper function.

Differential Revision: https://reviews.llvm.org/D79463
2020-05-07 12:33:36 -07:00
Lei Zhang 5db5002e65 [mlir] Remove unnecessary DEPENDS for MLIRMlirOptMain
https://github.com/llvm/llvm-project/commit/c296d2dc53d5c11c
fixes the dependency issue by turning LINK_LIBS to PUBLIC.
These explicit DEPENDS are not needed anymore.

Differential Revision: https://reviews.llvm.org/D79574
2020-05-07 13:59:05 -04:00
Lei Zhang c2414c2039 [mlir][vulkan-runner] Remove duplicated/uncessary link libraries
vulkan-runtime-wrappers does not need MLIRSPIRVSerialization,
which is used by the ConvertGpuLaunchFuncToVulkanLaunchFunc pass
under the hood.

Differential Revision: https://reviews.llvm.org/D79577
2020-05-07 13:57:26 -04:00
Alex Zinenko e41805fdab [mlir] Drop forward-declaration of loop::TerminatorOp.
This Op has been deleted in favor of loop::YieldOp, but the forward
declaration remain in the header.
2020-05-07 18:28:31 +02:00
Lei Zhang 16027bbc3b [mlir][spirv] Serialize all operands together if possible
SPIR-V ops can mix operands and attributes in the definition. These
operands and attributes are serialized in the exact order of the definition
to match SPIR-V binary format requirements. It can cause excessive
generated code bloat because we are emitting code to handle each
operand/attribute separately. So here we probe first to check whether all
the operands are ahead of attributes. Then we can serialize all operands
together.

This removes ~1000 lines of code from the generated inc file.

Differential Revision: https://reviews.llvm.org/D79446
2020-05-07 09:32:03 -04:00
Lei Zhang a2634748cd [mlir][spirv] Remove template functions for getting op's opcode
These template functions are used in the serializer, where we can
actually directly query the opcode from the op's definition and
use that in the auto-generated serialization logic.

This removes a set of templates accounting for 319 lines from
the auto-generated inc file.

Differential Revision: https://reviews.llvm.org/D79444
2020-05-07 09:32:03 -04:00
Alexander Belyaev a6b2877f4c [MLIR] Make ParallelLoopFusion pass scan through all nested regions.
Differential Revision: https://reviews.llvm.org/D79558
2020-05-07 13:47:30 +02:00
Alex Zinenko 54c927b988 [mlir] Add a test exercising partial constant folding of affine min/max
This functionality was introduced in a87db48e6f
but only only tested indirectly though Linalg tests. Add direct tests.
2020-05-07 12:42:03 +02:00
Alex Zinenko 4809580463 [mlir] Add a test for OperationFolder
Adds a test exercising the rewriting pattern in the test dialect that calls
OperationFolder.create.
2020-05-07 12:39:24 +02:00
Alex Zinenko a87db48e6f [mlir] Support partial folding of affine.min/max
Originally, these operations were folded only if all expressions in their
affine maps could be folded to a constant expression that can be then subject
to numeric min/max computation. This introduces a more advanced version that
partially folds the affine map by lifting individual constant expression in it
even if some of the expressions remain variable. The folding can update the
operation in place to use a simpler map. Note that this is not as powerful as
canonicalization, in particular this does not remove dimensions or symbols that
became useless. This allows for better composition of Linalg tiling and
promotion transformation, where the latter can handle some canonical forms of
affine.min that the folding can now produce.

Differential Revision: https://reviews.llvm.org/D79502
2020-05-07 12:30:04 +02:00
Wen-Heng (Jack) Chung f649aca9f3 [mlir][rocdl] Fix typo. NFC.
ROCLD -> ROCDL.

Differential Revision: https://reviews.llvm.org/D79441
2020-05-07 11:55:47 +02:00
Alex Zinenko a99f62c40a [mlir] VectorToLLVM: propagate up from replaceTransferOp
In the Vector to LLVM conversion, the `replaceTransferOp` function calls
into a type converter that may fail and suppresses the status. Change
the function to return the failure status instead, Since it is called
from a pattern, the failure can be readily propagated to the rest of
infrastructure.
2020-05-07 11:53:48 +02:00
Wen-Heng (Jack) Chung a23f190213 [mlir][vector] set alignment when lowering transfer_read and transfer_write.
When emitting masked load / store, set alignment from data layout.

Differential Revision: https://reviews.llvm.org/D79246
2020-05-07 11:44:25 +02:00
Uday Bondhugula 2affcd664e [MLIR] Fix affine fusion bug/efficiency issue / enable more fusion
The list of destination load ops while evaluating producer-consumer
fusion wasn't being maintained as a set, and as such, duplicate load ops
were being added to it. Although this is harmless correctness-wise, it's
a killer efficiency-wise and it prevents interesting/useful fusions
(including for eg. reshapes into a matmul). The reason the latter
fusions would be missed is that a slice union would be unnecessarily
needed due to the duplicate load ops on a memref added to the 'dst
loads' list. Since slice union is unimplemented for the local var case,
a single destination load op that leads to local vars (like a floordiv /
mod producing fusion), a common case, would not get fused due to an
unnecessary union being tried with itself.  (The union would actually be
the same thing but we would bail out.)

Besides the above, this would also significantly speed up fusion as all
the unnecessary slice computations / unions, checks, etc. due to the
duplicates go away.

Differential Revision: https://reviews.llvm.org/D79547
2020-05-07 10:51:34 +05:30
Uday Bondhugula 57d361bd2f [MLIR][NFC] Rename op trait PolyhedralScope -> AffineScope
Rename op trait PolyhedralScope -> AffineScope for consistency.

Differential Revision: https://reviews.llvm.org/D79503
2020-05-07 00:19:56 +05:30
Alex Zinenko 26f93d9f37 [mlir] OperationFolder: fix crash in creation of single-result-ops with in-place folds
When the folding is performed in place, the `::fold` function does not populate
its `results` argument to indicate that. (In the folding hook for single-result
operations, the result of the original operation is expected to be returned,
but it is then ignored by the wrapper.) `OperationFolder::create` would
erronously rely on the _operation_ having zero results instead of on the
_folding_ producing zero new results to populate the list of results with those
of the original operation. This would lead to a crash for single-result ops
with in-place folds where the first result is accessed uncondtionally because
the list of results was not properly populated. Use the list of values produced
by the folding instead.

Differential Revision: https://reviews.llvm.org/D79497
2020-05-06 20:40:32 +02:00
Sean Silva e382b3770e Fix ShapeBase.td
Summary:
- Add license header.
- Remove TODO about extracting ShapeBase.td

Differential Revision: https://reviews.llvm.org/D79506
2020-05-06 10:43:16 -07:00
Renato Golin 5010b5b7e6 Check type for forward reference definition
The types of forward references are checked that they match with other
uses, but they do not check they match with the definition.

    func @forward_reference_type_check() -> (i8) {
      br ^bb2

    ^bb1:
      return %1 : i8

    ^bb2:
      %1 = "bar"() : () -> (f32)
      br ^bb1
    }

Would be parsed and the use site of '%1' would be silently changed to
'f32'.

This commit adds a test for this case, and a check during parsing for
the types to match.

Patch by Matthew Parkinson <mattpark@microsoft.com>

Closes D79317.
2020-05-06 14:34:18 +01:00
Nicolas Vasilache 94438c86ad [mlir] Add a MemRefCastOp canonicalization pattern.
Summary:
This revision adds a conservative canonicalization pattern for MemRefCastOp that are typically inserted during ViewOp and SubViewOp canonicalization.
Ideally such canonicalizations would propagate the type to consumers but this is not a local behavior. As a consequence MemRefCastOp are introduced to keep type compatibility but need to be cleaned up later, in the case where more dynamic behavior than necessary is introduced.

Differential Revision: https://reviews.llvm.org/D79438
2020-05-06 09:10:05 -04:00
Uday Bondhugula ca09dab303 [MLIR][NFC] Fix/update debug messages for analysis utils and affine fusion
Drop trailing period in debug messages. Add an extra line for fusion
debug info.

Differential Revision: https://reviews.llvm.org/D79471
2020-05-06 12:27:59 +05:30
Reid Kleckner 932f0276ea [Support] Move LLD's parallel algorithm wrappers to support
Essentially takes the lld/Common/Threads.h wrappers and moves them to
the llvm/Support/Paralle.h algorithm header.

The changes are:
- Remove policy parameter, since all clients use `par`.
- Rename the methods to `parallelSort` etc to match LLVM style, since
  they are no longer C++17 pstl compatible.
- Move algorithms from llvm::parallel:: to llvm::, since they have
  "parallel" in the name and are no longer overloads of the regular
  algorithms.
- Add range overloads
- Use the sequential algorithm directly when 1 thread is requested
  (skips task grouping)
- Fix the index type of parallelForEachN to size_t. Nobody in LLVM was
  using any other parameter, and it made overload resolution hard for
  for_each_n(par, 0, foo.size(), ...) because 0 is int, not size_t.

Remove Threads.h and update LLD for that.

This is a prerequisite for parallel public symbol processing in the PDB
library, which is in LLVM.

Reviewed By: MaskRay, aganea

Differential Revision: https://reviews.llvm.org/D79390
2020-05-05 15:21:05 -07:00
Sean Silva b40d073e53 [mlir][shape] Extract ShapeBase.td 2020-05-05 13:39:19 -07:00
River Riddle 4e9a7c8f5c [mlir][DenseStringElementsAttr] Fix AttributeElementIterator in the case of a splat. 2020-05-05 12:42:37 -07:00
River Riddle 24ad385884 [mlir][DenseElementsAttr] Add support for opaque APFloat/APInt complex values.
This revision allows for creating DenseElementsAttrs and accessing elements using std::complex<APInt>/std::complex<APFloat>. This allows for opaquely accessing and transforming complex values. This is used by the printer/parser to provide pretty printing for complex values. The form for complex values matches that of std::complex, i.e.:

```
// `(` element `,` element `)`
dense<(10,10)> : tensor<complex<i64>>
```

Differential Revision: https://reviews.llvm.org/D79296
2020-05-05 12:42:37 -07:00
River Riddle da2a6f4e3b [mlir][DenseElementsAttr] Add support for ComplexType elements
This revision adds support for storing ComplexType elements inside of a DenseElementsAttr. We store complex objects as an array of two elements, matching the  definition of std::complex. There is no current attribute storage for ComplexType, but DenseElementsAttr provides API for access/creation using std::complex<>. Given that the internal implementation of DenseElementsAttr is already fairly opaque, the only real complexity here is in the printing/parsing. This revision keeps it simple for now and always uses hex when printing complex elements. A followup will add prettier syntax for this.

Differential Revision: https://reviews.llvm.org/D79281
2020-05-05 12:42:37 -07:00
Stephen Neuendorffer c296d2dc53 [MLIR] mlir-opt needs PUBLIC dependence
We see intermittent build errors on the windows buildbot because
mlir-opt is including Linalg headers which haven't been built yet.
This dependence should be resolved by declaring a PUBLIC dependence
on the Linalg library when building MLIROptMain.
2020-05-05 12:39:28 -07:00
Lei Zhang 6f790f784e [mlir] Specify CMAKE_CXX_STANDARD to standalone dialect
This addresses a compilation failure on GCC 5:

error: #error This file requires compiler and library support for the
ISO C++ 2011 standard. This support must be enabled with the -std=c++11
or -std=gnu++11 compiler options.
 #error This file requires compiler and library support

Differential Revision: https://reviews.llvm.org/D79439
2020-05-05 15:26:55 -04:00
Alex Zinenko 9d273c0ef0 [mlir] Harden verifiers for DMA ops
DMA operation classes in the Standard dialect (`DmaStartOp` and `DmaWaitOp`)
provide helper functions that make numerous assumptions about the number and
order of operands, and about their types. However, these assumptions were not
checked in the verifier, leading to assertion failures or crashes when helper
functions were used on ill-formed ops. Some of the assuptions were checked in
the custom parser (and thus could not check assumption violations in ops
constructed programmatically, e.g., during rewrites) and others were not
checked at all. Introduce the verifiers for all these assumptions and drop
unnecessary checks in the parser that are now covered by the verifier.

Addresses PR45560.

Differential Revision: https://reviews.llvm.org/D79408
2020-05-05 20:40:41 +02:00
Andy Davis 93d1108801 [MLIR][LoopOps] Adds the loop unroll transformation for loop::ForOp.
Summary:
Adds the loop unroll transformation for loop::ForOp.
Adds support for promoting the body of single-iteration loop::ForOps into its containing block.
Adds check tests for loop::ForOps with dynamic and static lower/upper bounds and step.
Care was taken to share code (where possible) with the AffineForOp unroll transformation to ease maintenance and potential future transition to a LoopLike construct on which loop transformations for different loop types can implemented.

Reviewers: ftynse, nicolasvasilache

Reviewed By: ftynse

Subscribers: bondhugula, mgorny, zzheng, mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, Joonsoo, grosul1, frgossen, Kayjukh, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D79184
2020-05-05 10:42:36 -07:00
Lei Zhang 6fb7e9a195 [mlir] Add missing dependency to MLIRMlirOptMain
Differential Revision: https://reviews.llvm.org/D79429
2020-05-05 13:32:00 -04:00
Stephen Neuendorffer 175a3df9c7 [MLIR] Add a tests for out of tree dialect example.
This attempts to ensure that out of tree usage remains stable.

Differential Revision: https://reviews.llvm.org/D78656
2020-05-05 09:22:49 -07:00
Stephen Neuendorffer e78ef9385c [MLIR] GPUToCUDA conversion: MC is only needed if NVPTX is enabled.
This patch conditionally links with MC
2020-05-05 08:55:17 -07:00
Ehsan Toosi 6ccaf73887 [MLIR][LINALG] Convert Linalg on Tensors to Buffers
This is a basic pass to convert Linalg.GenericOp which works on tensors to use
buffers instead.

Differential Revision: https://reviews.llvm.org/D78996
2020-05-05 15:48:07 +02:00
Jean-Michel Gorius 98b8b36d00 [mlir][standalone] NFC: Update CMakeLists.txt to reflect best practices
Update to follow the changes introduced in 5469f43 and documented in 93f7e52.
2020-05-05 13:37:37 +02:00
Alexander Belyaev 72700fea2b [MLIR] Link MLIRStandardOpsTransforms with MLIRTransforms.
Summary: This fixes shared lib build.

Differential Revision: https://reviews.llvm.org/D79403
2020-05-05 13:18:15 +02:00
Alex Zinenko 898f74c35d [mlir] NFC: update ::build signature in the tutorial document
This was missing from the original commit that changed the interface of
`::build` methods to take `OpBuilder &` instead of `Builder *.
2020-05-05 11:22:14 +02:00
Alexander Belyaev b79751e83d [MLIR] Add conversion from AtomicRMWOp -> GenericAtomicRMWOp.
Adding this pattern reduces code duplication. There is no need to have a
custom implementation for lowering to llvm.cmpxchg.

Differential Revision: https://reviews.llvm.org/D78753
2020-05-05 10:32:13 +02:00
Stephen Neuendorffer 93f7e525f5 [MLIR] Update documentation of cmake best practices 2020-05-04 20:47:58 -07:00
Stephen Neuendorffer 5469f434bb [MLIR] Reapply: Adjust libMLIR building to more closely follow libClang
This reverts commit ab1ca6e60f.
2020-05-04 20:47:57 -07:00
Stephen Neuendorffer 146192ade4 [MLIR] Normalize usage of intrinsics_gen
Portions of MLIR which depend on LLVMIR generally need to depend on
intrinsics_gen, to ensure that tablegen'd header files from LLVM are built
first.  Without this, we get errors, typically about llvm/IR/Attributes.inc
not being found.

Note that previously the Linalg Dialect depended on intrinsics_gen, but it
doesn't need to, since it doesn't use LLVMIR.

Differential Revision: https://reviews.llvm.org/D79389
2020-05-04 20:47:57 -07:00
River Riddle 469c02d058 [mlir] Add support for merging identical blocks during canonicalization
This revision adds support for merging identical blocks, or those with the same operations that branch to the same successors. Operands that mismatch between the different blocks are replaced with new block arguments added to the merged block.

Differential Revision: https://reviews.llvm.org/D79134
2020-05-04 19:56:46 -07:00
Geoffrey Martin-Noble 13090ec7dd [mlir] Remove tabs from predecessor comments
This change removes tabs from the comments printed by the asmprinter after basic
block declarations in favor of two spaces. This is currently the only place in
the printed IR that uses tabs.

Differential Revision: https://reviews.llvm.org/D79377
2020-05-05 02:15:23 +00:00
Nicolas Vasilache 036772acfd [mlir][EDSC] Fix off-by-one BlockBuilder insertion point.
Summary:
In the particular case of an insertion in a block without a terminator, the BlockBuilder insertion point should be block->end().

Adding a unit test to exercise this.

Differential Revision: https://reviews.llvm.org/D79363
2020-05-04 21:07:48 -04:00
River Riddle 1e4faf23ff [mlir][IR] Add a Region::getOps method that returns a range of immediately nested operations
This allows for walking the operations nested directly within a region, without traversing nested regions.

Differential Revision: https://reviews.llvm.org/D79056
2020-05-04 17:46:25 -07:00
River Riddle 6bce7d8d67 [mlir][mlir-opt] Disable multithreading when parsing the input module.
This removes the unnecessary/costly context synchronization when parsing, as the context is guaranteed to not be used by any other threads.
2020-05-04 17:29:56 -07:00
Hanhan Wang 5d10613b6e [mlir][StandardToSPIRV] Emulate bitwidths not supported for store op.
Summary:
As D78974, this patch implements the emulation for store op. The emulation is
done with atomic operations. E.g., if the storing value is i8, rewrite the
StoreOp to:

 1) load a 32-bit integer
 2) clear 8 bits in the loading value
 3) store 32-bit value back
 4) load a 32-bit integer
 5) modify 8 bits in the loading value
 6) store 32-bit value back

The step 1 to step 3 are done by AtomicAnd as one atomic step, and the step 4
to step 6 are done by AtomicOr as another atomic step.

Differential Revision: https://reviews.llvm.org/D79272
2020-05-04 15:18:44 -07:00
Haruki Imai 3a7be241f2 [mlir] Support big endian in DenseElementsAttr
This std::copy_n copies 8 byte data (APInt raw data) by 1 byte from the
beginning of char array. This is no problem in little endian, but the
data is not copied correctly in big endian because the data should be
copied from the end of the char array.

- Example of 4 byte data (such as float32)

Little endian (First 4 bytes):
Address | 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08
Data    | 0xcd 0xcc 0x8c 0x3f 0x00 0x00 0x00 0x00

Big endian (Last 4 bytes):
Address | 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08
Data    | 0x00 0x00 0x00 0x00 0x3f 0x8c 0xcc 0xcd

In general, when it copies N(N<8) byte data in big endian, the start
address should be incremented by (8 - N) bytes.
The original code has no problem when it includes 8 byte data(such as
 double) even in big endian.

Differential Revision: https://reviews.llvm.org/D78076
2020-05-04 22:17:05 +00:00
Stephen Neuendorffer ab1ca6e60f Revert "[MLIR] Adjust libMLIR building to more closely follow libClang"
This reverts commit 4f0f436749.

This seems to show some compile dependence problems, and also breaks flang.
2020-05-04 12:40:12 -07:00
Valentin Churavy 4f0f436749 [MLIR] Adjust libMLIR building to more closely follow libClang
- Exports MLIR targets to be used out-of-tree.
- mimicks `add_clang_library` and `add_flang_library`.
- Fixes libMLIR.so

After https://reviews.llvm.org/D77515 libMLIR.so was no longer containing
any object files. We originally had a cludge there that made it work with
the static initalizers and when switchting away from that to the way the
clang shlib does it, I noticed that MLIR doesn't create a `obj.{name}` target,
and doesn't export it's targets to `lib/cmake/mlir`.

This is due to MLIR using `add_llvm_library` under the hood, which adds
the target to `llvmexports`.

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

[MLIR] Fix libMLIR.so and LLVM_LINK_LLVM_DYLIB

Primarily, this patch moves all mlir references to LLVM libraries into
either LLVM_LINK_COMPONENTS or LINK_COMPONENTS.  This enables magic in
the llvm cmake files to automatically replace reference to LLVM components
with references to libLLVM.so when necessary.  Among other things, this
completes fixing libMLIR.so, which has been broken for some configurations
since D77515.

Unlike previously, the pattern is now that mlir libraries should almost
always use add_mlir_library.  Previously, some libraries still used
add_llvm_library.  However, this confuses the export of targets for use
out of tree because libraries specified with add_llvm_library are exported
by LLVM.  Instead users which don't need/can't be linked into libMLIR.so
can specify EXCLUDE_FROM_LIBMLIR

A common error mode is linking with LLVM libraries outside of LINK_COMPONENTS.
This almost always results in symbol confusion or multiply defined options
in LLVM when the same object file is included as a static library and
as part of libLLVM.so.  To catch these errors more directly, there's now
mlir_check_all_link_libraries.

To simplify usage of add_mlir_library, we assume that all mlir
libraries depend on LLVMSupport, so it's not necessary to separately specify
it.

tested with:
BUILD_SHARED_LIBS=on,
BUILD_SHARED_LIBS=off + LLVM_BUILD_LLVM_DYLIB,
BUILD_SHARED_LIBS=off + LLVM_BUILD_LLVM_DYLIB + LLVM_LINK_LLVM_DYLIB.

By: Stephen Neuendorffer <stephen.neuendorffer@xilinx.com>
Differential Revision: https://reviews.llvm.org/D79067

[MLIR] Move from using target_link_libraries to LINK_LIBS

This allows us to correctly generate dependencies for derived targets,
such as targets which are created for object libraries.

By: Stephen Neuendorffer <stephen.neuendorffer@xilinx.com>
Differential Revision: https://reviews.llvm.org/D79243

Three commits have been squashed to avoid intermediate build breakage.
2020-05-04 11:40:46 -07:00
Nicolas Vasilache 307cfdf533 [mlir][Linalg] Mostly NFC - Refactor Linalg patterns and transformations.
Linalg transformations are currently exposed as DRRs.
Unfortunately RewriterGen does not play well with the line of work on named linalg ops which require variadic operands and results.
Additionally, DRR is arguably not the right abstraction to expose compositions of such patterns that don't rely on SSA use-def semantics.

This revision abandons DRRs and exposes manually written C++ patterns.

Refactorings and cleanups are performed to uniformize APIs.
This refactoring will allow replacing the currently manually specified Linalg named ops.

A collateral victim of this refactoring is the `tileAndFuse` DRR, and the one associated test, which will be revived at a later time.

Lastly, the following 2 tests do not add value and are altered:
- a dot_perm tile + interchange test does not test anything new and is removed
- a dot tile + lower to loops does not need 2-D tiling and is trimmed.
2020-05-04 11:17:37 -04:00
Frederik Gossen 031265ad8a [MLIR] Add complex numbers to standard dialect
Add `CreateComplexOp`, `ReOp`, and `ImOp` to the standard dialect.
This is the first step to support complex numbers.

Differential Revision: https://reviews.llvm.org/D79159
2020-05-04 14:04:28 +00:00
Marcel Koester 67b466deda [mlir] Removed tight coupling of BufferPlacement pass to Alloc and Dealloc.
The current BufferPlacement implementation tries to find Alloc and Dealloc
operations in order to move them. However, this is a tight coupling to
standard-dialect ops which has been removed in this CL.

Differential Revision: https://reviews.llvm.org/D78993
2020-05-04 14:23:15 +02:00
Wen-Heng (Jack) Chung bc23c1d85e [mlir][rocdl] add rocdl.barier op.
- Add rocdl.barrier op.
- Lower gpu.barier to rocdl.barrier in -convert-gpu-to-rocdl.

Differential Revision: https://reviews.llvm.org/D79126
2020-05-04 10:35:01 +02:00
Wen-Heng (Jack) Chung a581c6f8cd [mlir][vector] add tests for type_cast taking non-zero addrspace
Add tests for vector.type_cast that takes memrefs on non-zero
addrspaces.

Differential Revision: https://reviews.llvm.org/D79099
2020-05-04 10:31:12 +02:00
River Riddle cb9ae0025c [mlir] Add a new context flag for disabling/enabling multi-threading
This is useful for several reasons:
* In some situations the user can guarantee that thread-safety isn't necessary and don't want to pay the cost of synchronization, e.g., when parsing a very large module.

* For things like logging threading is not desirable as the output is not guaranteed to be in stable order.

This flag also subsumes the pass manager flag for multi-threading.

Differential Revision: https://reviews.llvm.org/D79266
2020-05-02 12:32:25 -07:00
Stephen Neuendorffer 8fa4d4a43c [MLIR] Ensure that out-of-tree users have an mlir-generic-headers target
Prior change introduces this target, but we need it for out-of-tree users
too
2020-05-01 22:19:58 -07:00
Stephen Neuendorffer 7add6b6b73 [MLIR] add dependencies for all tablegen targets on 'mlir-headers'
In cmake, dependencies on generated files require some sophistication in the build system.  At build time, files are parsed to determine which headers they depend on and these dependencies are injected into the build system.  This works well with ninja, but has some constraints with the makefile generator.  According to the cmake documentation, this only works reliably within the same directory.

This patch expands the usage of mlir-headers to include all generated headers and adds an mlir-generic-headers target which triggers generation of dialect-independent headers.  These targets are used to express dependencies on generated headers.  This is mostly handled in AddMLIR.cmake and only a few CMakeLists.txt files need to change.

Differential Revision: https://reviews.llvm.org/D79242
2020-05-01 20:08:52 -07:00
Stephen Neuendorffer 57818885be [MLIR] Move Verifier and Dominance Analysis from /Analysis to /IR
These libraries are distinct from other things in Analysis in that they
operate only on core IR concepts.  This also simplifies dependencies
so that Dialect -> Analysis -> Parser -> IR.  Previously, the parser depended
on portions of the the Analysis directory as well, which sometimes
caused issues with the way the cmake makefile generator discovers
dependencies on generated files during compilation.

Differential Revision: https://reviews.llvm.org/D79240
2020-05-01 20:01:46 -07:00
River Riddle f49b2344a3 [mlir][NFC] Cleanup StandardTypes and reorder the type classes 2020-05-01 19:28:42 -07:00
River Riddle 0d5caa8940 [mlir][DenseStringElementsAttr] Add support for the Attribute based get* methods.
This was missed in the original revision. This allows for using the opaque Attribute accessors when the elements are strings.
2020-05-01 16:34:35 -07:00
River Riddle 2265009fbe [mlir][GPUOpsLowering] Add missing include for FormatVariadic 2020-05-01 15:58:20 -07:00
Stephen Neuendorffer 2e628d008c [MLIR][docs] Update tutorial language around Op and Operation* and 'opaque'
Differential Revision: https://reviews.llvm.org/D79146
2020-05-01 11:26:38 -07:00
Wen-Heng (Jack) Chung d805ab7d03 [mlir][rocdl] fix shared lib build. NFC.
Summary: - Add missing dependency to MLIRVectorToLLVM to get shared libs built.

Differential Revision: https://reviews.llvm.org/D79225
2020-05-01 09:51:01 -07:00
Benjamin Kramer f9223d47e4 Remove unused variable. NFC. 2020-05-01 14:29:58 +02:00