Nicolas Vasilache [Fri, 18 Oct 2019 21:09:42 +0000 (14:09 -0700)]
Lower vector transfer ops to loop.for operations.
This allows mixing linalg operations with vector transfer operations (with additional modifications to affine ops) and is a step towards solving tensorflow/mlir#189.
PiperOrigin-RevId:
275543361
Nicolas Vasilache [Fri, 18 Oct 2019 20:48:26 +0000 (13:48 -0700)]
Implement lowering of VectorTypeCastOp to LLVM
A VectorTypeCastOp can only be used to lower between statically sized contiguous memrefs of scalar and matching vector type. The sizes and strides are thus fully static and easy to determine.
A relevant test is added.
This is a step towards solving tensorflow/mlir#189.
PiperOrigin-RevId:
275538981
reinerp [Fri, 18 Oct 2019 17:28:02 +0000 (10:28 -0700)]
Slightly rephrase a difficult-to-parse sentence.
PiperOrigin-RevId:
275499524
Lei Zhang [Fri, 18 Oct 2019 15:19:54 +0000 (08:19 -0700)]
[DRR] Use eraseOp() to replace no-result ops
PiperOrigin-RevId:
275475229
Nicolas Vasilache [Fri, 18 Oct 2019 13:44:41 +0000 (06:44 -0700)]
Automated rollback of commit
575405f4d6762830c1c4520569de4e4ed3c8eed5
PiperOrigin-RevId:
275461067
Nicolas Vasilache [Fri, 18 Oct 2019 12:22:12 +0000 (05:22 -0700)]
Fix OSS target name GPUtoNVVMTransforms -> MLIRGPUtoNVVMTransforms
This unbreaks the `cmake -G Ninja ../llvm -DLLVM_BUILD_EXAMPLES=ON -DLLVM_TARGETS_TO_BUILD="host"`
in my local OSS build
PiperOrigin-RevId:
275452330
Stephan Herhut [Fri, 18 Oct 2019 11:44:15 +0000 (04:44 -0700)]
Use StrEnumAttr for gpu.allreduce op instead of StringAttr to better encode constraints.
PiperOrigin-RevId:
275448372
Geoffrey Martin-Noble [Fri, 18 Oct 2019 09:40:06 +0000 (02:40 -0700)]
Add documentation on restrictions to dialect conversion rewrites
PiperOrigin-RevId:
275435593
Christian Sigg [Fri, 18 Oct 2019 07:30:14 +0000 (00:30 -0700)]
Add gpu.barrier op to synchronize invocations of a local workgroup.
Adding gen table for rewrite patterns from GPU to NVVM dialect.
Copy missing op documentation from GPUOps.td to GPU.md.
PiperOrigin-RevId:
275419588
River Riddle [Fri, 18 Oct 2019 03:08:01 +0000 (20:08 -0700)]
NFC: Remove trivial builder get methods.
These don't add any value, and some are even more restrictive than the respective static 'get' method.
PiperOrigin-RevId:
275391240
River Riddle [Fri, 18 Oct 2019 00:11:06 +0000 (17:11 -0700)]
Automated rollback of commit
b65c8bb5d6ab418bb3fcd0302aee19d3615d90f1
PiperOrigin-RevId:
275370861
Geoffrey Martin-Noble [Thu, 17 Oct 2019 22:18:31 +0000 (15:18 -0700)]
Introduce a wrapper around ConversionPattern that operates on the derived class
Analogous to OpRewritePattern, this makes writing conversion patterns more convenient.
PiperOrigin-RevId:
275349854
Nicolas Vasilache [Thu, 17 Oct 2019 22:18:07 +0000 (15:18 -0700)]
Add EDSC support for loop.for operations
This CL adds support for loop.for operations in EDSC and adds a test.
This will be used in a followup commit to implement lowering of vector_transfer ops so that it works more generally and is not subject to affine constraints.
PiperOrigin-RevId:
275349796
River Riddle [Thu, 17 Oct 2019 21:27:08 +0000 (14:27 -0700)]
NFC: Delete the Linalg tutorial.
This part of the tutorial is now covered by a new flow in Toy. This also removes a point of confusion as there is also a proper Linalg dialect.
PiperOrigin-RevId:
275338933
River Riddle [Thu, 17 Oct 2019 21:21:44 +0000 (14:21 -0700)]
Add Ch.6 of the Toy tutorial.
This chapters introduces the notion of a full conversion, and adds support for lowering down to the LLVM dialect, LLVM IR, and thus code generation.
PiperOrigin-RevId:
275337786
Nicolas Vasilache [Thu, 17 Oct 2019 20:40:48 +0000 (13:40 -0700)]
Decouple Linalg promotion from Linalg tiling - NFC
This CL creates a new Linalg promotion pass that operates on SubViewOp and decouples it from Linalg tiling. This is mostly moving code around.
PiperOrigin-RevId:
275329213
Denis Khalikov [Thu, 17 Oct 2019 19:25:14 +0000 (12:25 -0700)]
[spirv] Add a canonicalization pattern for spv.selection.
Add a canonicalization pattern for spv.selection operation.
Convert spv.selection operation to spv.Select based on
simple pattern.
Closes tensorflow/mlir#183
COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/183 from denis0x0D:sandbox/canon_select
43d04d923272dd60b9da39f70bdbc51a5168db62
PiperOrigin-RevId:
275312748
Lei Zhang [Thu, 17 Oct 2019 19:23:47 +0000 (12:23 -0700)]
Allow '_' when pretty printing dialect symbols
'_' is used frequently enough as the separator of words in symbols.
We should allow it in dialect symbols when considering pretty printing.
Also updated LangRef.md regarding pretty form.
PiperOrigin-RevId:
275312494
Nicolas Vasilache [Thu, 17 Oct 2019 19:13:25 +0000 (12:13 -0700)]
Rename LoopNestBuilder to AffineLoopNestBuilder - NFC
PiperOrigin-RevId:
275310747
Mehdi Amini [Thu, 17 Oct 2019 16:58:58 +0000 (09:58 -0700)]
Use a SmallVector instead of an ArrayRef to materialize a temporary local array
This pattern is error prone and unfortunately none of the sanitizer is catching
it at the moment.
Fixes tensorflow/mlir#192
Closes tensorflow/mlir#193
COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/193 from joker-eph:fix_array_ref
8092252e64c426c6a8a790b7638f847bea4818b1
PiperOrigin-RevId:
275280201
Lei Zhang [Thu, 17 Oct 2019 16:01:56 +0000 (09:01 -0700)]
[DRR] Allow capturing and referencing no-result ops
Previously when we bind a symbol to an op in DRR, it means to capture
the op's result(s) and later references will be expanded to result(s).
This means for ops without result, we are replacing the symbol with
nothing. This CL treats non-result op capturing and referencing as a
special case to mean the op itself.
PiperOrigin-RevId:
275269702
Lei Zhang [Thu, 17 Oct 2019 15:39:13 +0000 (08:39 -0700)]
Fix RewriterGen to support using NativeCodeCall as auxiliary pattern
NativeCodeCall is handled differently than normal op creation in RewriterGen
(because its flexibility). It will only be materialized to output stream if
it is used. But when using it for auxiliary patterns, we still want the side
effect even if it is not replacing matched root op's results.
PiperOrigin-RevId:
275265467
Lei Zhang [Thu, 17 Oct 2019 14:25:50 +0000 (07:25 -0700)]
Add LLVM_DEBUG in RewritersGen.cpp and Pattern.cpp
It's usually hard to understand what went wrong if mlir-tblgen
crashes on some input. This CL adds a few useful LLVM_DEBUG
statements so that we can use mlir-tblegn -debug to figure
out the culprit for a crash.
PiperOrigin-RevId:
275253532
River Riddle [Thu, 17 Oct 2019 05:25:23 +0000 (22:25 -0700)]
Fix invalid transpose in example and add proper verification.
The transpose in the example had the same result type as its input, which is incorrect.
PiperOrigin-RevId:
275186568
Lei Zhang [Thu, 17 Oct 2019 00:36:58 +0000 (17:36 -0700)]
[spirv] Implement inliner interface
We just need to implement a few interface hooks to DialectInlinerInterface
and CallOpInterface to gain the benefits of an inliner. :)
Right now only supports some trivial cases:
* Inlining single block with spv.Return/spv.ReturnValue
* Inlining multi block with spv.Return
* Inlining spv.selection/spv.loop without return ops
More advanced cases will require block argument and Phi support.
PiperOrigin-RevId:
275151132
River Riddle [Thu, 17 Oct 2019 00:33:34 +0000 (17:33 -0700)]
Add Ch.5 of the toy tutorial.
This chapter adds a partial lowering of toy operations, all but PrintOp, to a combination of the Affine and Std dialects. This chapter focuses on introducing the conversion framework, the benefits of partial lowering, and how easily dialects may co-exist in the IR.
PiperOrigin-RevId:
275150649
River Riddle [Thu, 17 Oct 2019 00:32:30 +0000 (17:32 -0700)]
Add support for inlining toy call operations.
The GenericCallOp needed to have the CallOpInterface to be picked up by the inliner. This also adds a CastOp to perform shape casts that are generated during inlining. The casts generated by the inliner will be folded away after shape inference.
PiperOrigin-RevId:
275150438
reinerp [Thu, 17 Oct 2019 00:14:56 +0000 (17:14 -0700)]
Fix typo in tutorial.
PiperOrigin-RevId:
275147795
Rob Suderman [Wed, 16 Oct 2019 23:58:42 +0000 (16:58 -0700)]
Add ComplexType to TableGen with Tensor support
Create a ComplexType for table gen references. Include an AnyComplex type
to check whether the resulting tensor can be complex. Expand tensors to
allow complex types.
PiperOrigin-RevId:
275144804
River Riddle [Wed, 16 Oct 2019 19:33:55 +0000 (12:33 -0700)]
Code cleanups on Ch.4
This change performs general cleanups of the implementation of ch.4 and fixes some bugs. For example, the operations currently don't inherit from the shape inference interface.
PiperOrigin-RevId:
275089914
Sana Damani [Wed, 16 Oct 2019 19:08:55 +0000 (12:08 -0700)]
Update Chapter 4 of the Toy tutorial
This Chapter now introduces and makes use of the Interface concept
in MLIR to demonstrate ShapeInference.
END_PUBLIC
Closes tensorflow/mlir#191
PiperOrigin-RevId:
275085151
Jacques Pienaar [Wed, 16 Oct 2019 19:07:56 +0000 (12:07 -0700)]
Update comments in ast.toy
PiperOrigin-RevId:
275084969
Geoffrey Martin-Noble [Wed, 16 Oct 2019 18:57:50 +0000 (11:57 -0700)]
NFC: Update VectorOrTensor -> Shaped
This was missed when the type was renamed.
PiperOrigin-RevId:
275082588
Mahesh Ravishankar [Wed, 16 Oct 2019 18:52:33 +0000 (11:52 -0700)]
Makes spv.module generated by GPU->SPIRV conversion spec compliant
Makes the spv.module generated by the GPU to SPIR-V conversion SPIR-V
spec compliant (validated using spirv-val from Vulkan tools).
1) Separate out the VulkanLayoutUtils from
DecorateSPIRVCompositeTypeLayoutPass to make it reusable within the
Type converter in SPIR-V lowering infrastructure. This is used to
compute the layout of the !spv.struct used in global variable type
description.
2) Set the capabilities of the spv.module to Shader (needed for use of
Logical Memory Model, and the extensions to
SPV_KHR_storage_buffer_storage_class for use of Storage Buffer)
PiperOrigin-RevId:
275081486
Christian Sigg [Wed, 16 Oct 2019 17:43:12 +0000 (10:43 -0700)]
Support custom accumulator provided as region to gpu.all_reduce.
In addition to specifying the type of accumulation through the 'op' attribute, the accumulation can now also be specified as arbitrary code region.
Adds a gpu.yield op to specify the result of the accumulation.
Also support more types (integers) and accumulations (mul).
PiperOrigin-RevId:
275065447
Mahesh Ravishankar [Wed, 16 Oct 2019 17:20:31 +0000 (10:20 -0700)]
Allow for remapping argument to a Value in SignatureConversion.
The current SignatureConversion framework (part of DialectConversion)
allows remapping input arguments to a function from 1->0, 1->1 or
1->many arguments during conversion. Another case is where the
argument itself is dropped, but it's use are remapped to another
Value*.
An example of this is: The Vulkan/SPIR-V spec requires entry functions
to be of type void(void). The GPU -> SPIR-V conversion implemented
this without having the DialectConversion framework track the
remapping that lead to some undefined behavior. The changes here
addresses that.
PiperOrigin-RevId:
275059656
River Riddle [Wed, 16 Oct 2019 16:50:28 +0000 (09:50 -0700)]
Add support for PatternRewriter::eraseOp.
This hook is useful when an operation is known to be dead, and no replacement values make sense.
PiperOrigin-RevId:
275052756
Mehdi Amini [Wed, 16 Oct 2019 15:36:51 +0000 (08:36 -0700)]
Fix CMake configuration after introduction of LICM and LoopLikeInterface
b843cc5d5a introduced a new op LICM transformation and a LoopLike interface,
but missed the CMake aspects of it. This should fix the build.
PiperOrigin-RevId:
275038533
Nicolas Vasilache [Wed, 16 Oct 2019 14:14:06 +0000 (07:14 -0700)]
Fix typo in VectorOps.td
PiperOrigin-RevId:
275025323
Stephan Herhut [Wed, 16 Oct 2019 11:28:13 +0000 (04:28 -0700)]
Implement simple loop-invariant-code-motion based on dialect interfaces.
PiperOrigin-RevId:
275004258
River Riddle [Wed, 16 Oct 2019 07:35:07 +0000 (00:35 -0700)]
NFC: Remove NoSideEffect traits from all ops except for ConstantOp.
These traits are added in chapter 3 when we begin discussion optimization on the toy operations.
PiperOrigin-RevId:
274974010
River Riddle [Wed, 16 Oct 2019 07:33:43 +0000 (00:33 -0700)]
NFC: Various code cleanups for Ch3.
This change refactors the toyc driver to be much cleaner and easier to extend. It also cleans up a few comments in the combiner.
PiperOrigin-RevId:
274973808
Hanhan Wang [Wed, 16 Oct 2019 01:42:10 +0000 (18:42 -0700)]
Add support for OpBitwiseOr, OpBitwiseXor, and OpBitwiseAnd in SPIR-V dialect.
PiperOrigin-RevId:
274935374
MLIR Team [Tue, 15 Oct 2019 22:44:56 +0000 (15:44 -0700)]
Fix typo
PiperOrigin-RevId:
274905193
MLIR Team [Tue, 15 Oct 2019 22:34:13 +0000 (15:34 -0700)]
Fix typos
PiperOrigin-RevId:
274902838
River Riddle [Tue, 15 Oct 2019 22:09:45 +0000 (15:09 -0700)]
NFC: Split out ToyOpsIncGen into a separate CMakeLists.txt.
This fixes an issue with make where it fails to properly handle the dependency ordering.
PiperOrigin-RevId:
274897702
MLIR Team [Tue, 15 Oct 2019 21:56:22 +0000 (14:56 -0700)]
Fix typo
PiperOrigin-RevId:
274894550
Lei Zhang [Tue, 15 Oct 2019 21:53:01 +0000 (14:53 -0700)]
[spirv] Add support for SpecId decoration on spv.specConstant
The SpecId decoration is the handle for providing external specialization.
Similar to descriptor set and binding on global variables, we directly
bake it into assembly parsing and printing.
PiperOrigin-RevId:
274893879
MLIR Team [Tue, 15 Oct 2019 21:48:21 +0000 (14:48 -0700)]
Fix minor typos
PiperOrigin-RevId:
274892763
Jacques Pienaar [Tue, 15 Oct 2019 19:50:51 +0000 (12:50 -0700)]
Fix typos in InferTypeOpInterface.
PiperOrigin-RevId:
274866986
Sana Damani [Tue, 15 Oct 2019 18:40:12 +0000 (11:40 -0700)]
Update Chapter 3 to demonstrate pattern match and rewrite optimizations
This is using Table-driven Declarative Rewrite Rules (DRR), the previous
version of the tutorial only showed the C++ patterns.
Closes tensorflow/mlir#187
PiperOrigin-RevId:
274852321
Jacques Pienaar [Tue, 15 Oct 2019 18:22:53 +0000 (11:22 -0700)]
Fix typos in LangRef and OpDefinitions
PiperOrigin-RevId:
274848361
Nicolas Vasilache [Tue, 15 Oct 2019 18:03:54 +0000 (11:03 -0700)]
Consistent use of int in mlir_runner_utils.cpp
This should fix the OSS build by only using int in template types.
PiperOrigin-RevId:
274843584
Nicolas Vasilache [Tue, 15 Oct 2019 13:52:24 +0000 (06:52 -0700)]
Add conversion for splat of vectors of 2+D
This CL adds a missing lowering for splat of multi-dimensional vectors.
Additional support is also added to the runtime utils library to allow printing memrefs with such vectors.
PiperOrigin-RevId:
274794723
Alex Zinenko [Tue, 15 Oct 2019 13:50:56 +0000 (06:50 -0700)]
Expose mlir::parseType to bindings
Python bindings currently currently provide a makeScalarType function that
constructs one of the predefined types. It was implemented in the bindings
directly to circumvent the absence of standalone type parsing function. Now
that mlir::parseType has been made available, rely on the core parsing
procedure to construct types from strings in the bindings.
This changes includes a library reshuffling that splits out "CoreAPIs"
implementing the binding helper APIs into a separate library and makes that
dependent on the Parser library.
PiperOrigin-RevId:
274794516
Alex Zinenko [Tue, 15 Oct 2019 13:50:34 +0000 (06:50 -0700)]
AsmPrinter: avoid unused-variable warning
The value defined in a loop was not being used and the function producing it
re-evaluated instead. Use the value to avoid both the warning and the
re-evaluation.
PiperOrigin-RevId:
274794459
River Riddle [Tue, 15 Oct 2019 04:12:50 +0000 (21:12 -0700)]
Merge Ch3 of the Toy tutorial into chapter 2.
This effectively rewrites Ch.2 to introduce dialects, operations, and registration instead of deferring to Ch.3. This allows for introducing the best practices up front(using ODS, registering operations, etc.), and limits the opaque API to the chapter document instead of the code.
PiperOrigin-RevId:
274724289
River Riddle [Mon, 14 Oct 2019 23:21:17 +0000 (16:21 -0700)]
NFC: Replace usages of Value::getKind with explicit isa/casts.
It is more idiomatic to use the llvm::cast infrastructure for checking the type of a value.
PiperOrigin-RevId:
274684945
River Riddle [Mon, 14 Oct 2019 16:50:54 +0000 (09:50 -0700)]
Allowing replacing non-root operations in DialectConversion.
When dealing with regions, or other patterns that need to generate temporary operations, it is useful to be able to replace other operations than the root op being matched. Before this PR, these operations would still be considered for legalization meaning that the conversion would either fail, erroneously need to mark these ops as legal, or add unnecessary patterns.
PiperOrigin-RevId:
274598513
Mehdi Amini [Mon, 14 Oct 2019 15:18:23 +0000 (08:18 -0700)]
Use single quotes to wrap '@HOST_LDFLAGS@' in LIT config file
ldflags can contain double-quoted paths, so must use single quotes here.
PiperOrigin-RevId:
274581983
Nicolas Vasilache [Mon, 14 Oct 2019 14:58:54 +0000 (07:58 -0700)]
Fix linalg.subview behavior in (partially) static cases.
When the implementation of the strided memref [RFC](https://groups.google.com/a/tensorflow.org/forum/#!msg/mlir/MaL8m2nXuio/1scRqZa6AQAJ) landed, linalg started using this type instead of the now retired !linalg.view.
As static and partially static cases appear, the stride information needs to be maintained properly. In particular, the result type of the subview op was generally incorrect.
This CL fixes the issue by computing a return type that:
1. always has dynamic sizes, which is generally the only correct way to construct a subview in the absence of data padding and/or code versioning.
2. has the same strides as the base strided memref.
Point 1. above can be further refined but will needs further analysis and canonicalization to optimize the particular case where:
1. The base memref has static size along a given dimension.
2. The subview size can be statically derived (e.g. after canonicalization).
3. *And* the subview size is an even divisor of the base memref.
This 3rd constraint is well-known in the case of tiled layouts that don't assume implicit padding: the boundary tile may be only partial and has size given by `problem_size % tile_size`.
Tests are updated as appropriate.
PiperOrigin-RevId:
274578624
Nicolas Vasilache [Mon, 14 Oct 2019 14:48:29 +0000 (07:48 -0700)]
Add lowering of VectorOps dialect to LLVM to the Linalg LLVM lowering pass
This fixes an omission that prevents Linalg to lower generic ops regions operating on ops in the VectorOps dialect.
To achieve this we simply need to `populateVectorToLLVMConversionPatterns` in the conversion.
Relevant tests are added.
PiperOrigin-RevId:
274577325
Eric Schweitz [Sat, 12 Oct 2019 01:35:02 +0000 (18:35 -0700)]
Add LLVM IR dialect hooks for FP128 and X86_FP80 types
Closes tensorflow/mlir#184
COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/184 from schweitzpgi:more-float-types
ca27d00510a86ffc9c79c65fb3a0193b5ea097a0
PiperOrigin-RevId:
274288813
Alex Zinenko [Fri, 11 Oct 2019 13:22:40 +0000 (06:22 -0700)]
Emit LLVM IR equivalent of sizeof when lowering alloc operations
Originally, the lowering of `alloc` operations has been computing the number of
bytes to allocate when lowering based on the properties of MLIR type. This does
not take into account type legalization that happens when compiling LLVM IR
down to target assembly. This legalization can widen the type, potentially
leading to out-of-bounds accesses to `alloc`ed data due to mismatches between
address computation that takes the widening into account and allocation that
does not. Use the LLVM IR's equivalent of `sizeof` to compute the number of
bytes to be allocated:
%0 = getelementptr %type* null, %indexType 0
%1 = ptrtoint %type* %0 to %indexType
adapted from
http://nondot.org/sabre/LLVMNotes/SizeOf-OffsetOf-VariableSizedStructs.txt
PiperOrigin-RevId:
274159900
Alex Zinenko [Fri, 11 Oct 2019 13:13:25 +0000 (06:13 -0700)]
LLVM Dialect: introduce llvm.mlir.null operation
Similarly to `llvm.mlir.undef`, this auxiliary operation creates an SSA value
that corresponds to `null` in LLVM IR. This operation is necessary to model
sizeof(<...>) behavior when allocating memory.
PiperOrigin-RevId:
274158760
Uday Bondhugula [Fri, 11 Oct 2019 13:08:24 +0000 (06:08 -0700)]
Drop obsolete code from std to llvm memref lowering
- dropping what looks like outdated code post some of the previous
updates
Signed-off-by: Uday Bondhugula <uday@polymagelabs.com>
Closes tensorflow/mlir#179
COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/179 from bondhugula:llfix
2a72ea441fe1b3924802273ffbe9870afeb90f91
PiperOrigin-RevId:
274158273
Alexander Belyaev [Fri, 11 Oct 2019 12:38:10 +0000 (05:38 -0700)]
Rename LLVM::exp and LLVM::fmuladd to LLVM::ExpOP and LLVM::FMulAddOp.
PiperOrigin-RevId:
274154655
Alexander Belyaev [Fri, 11 Oct 2019 12:13:18 +0000 (05:13 -0700)]
Add unary ops and ExpOp to Standard Dialect.
PiperOrigin-RevId:
274152154
Alex Zinenko [Fri, 11 Oct 2019 08:35:58 +0000 (01:35 -0700)]
LLVM conversion: harden a test to check for LLVM funcs rather than any funcs
This test was not updated in the original commit that switched to using LLVM
functions since it wasn't broken by that change. FileCheck was able to match
the `func` part of `llvm.func` to the expected pattern and continue as usual.
Make sure the `llvm.` dialect prefix is included in the expected output.
PiperOrigin-RevId:
274127281
River Riddle [Fri, 11 Oct 2019 04:57:24 +0000 (21:57 -0700)]
NFC: Print the generic op form after pass failure.
On failure, the IR is likely to be in an invalid state, meaning the custom printer for some operations may now crash. Using the generic op form prevents this from happening.
PiperOrigin-RevId:
274104146
River Riddle [Fri, 11 Oct 2019 02:19:11 +0000 (19:19 -0700)]
Add support for generating reproducers on pass crash and failure.
This cl adds support for generating a .mlir file containing a reproducer for crashes and failures that happen during pass execution. The reproducer contains a comment detailing the configuration of the pass manager(e.g. the textual description of the pass pipeline that the pass manager was executing), along with the original input module.
Example Output:
// configuration: -pass-pipeline='func(cse, canonicalize), inline'
// note: verifyPasses=false
module {
...
}
PiperOrigin-RevId:
274088134
River Riddle [Fri, 11 Oct 2019 02:13:44 +0000 (19:13 -0700)]
NFC: Initialize pass manager option fields inline instead of the class constructor.
PiperOrigin-RevId:
274087577
Alex Zinenko [Thu, 10 Oct 2019 23:25:11 +0000 (16:25 -0700)]
Standard-to-LLVM conversion: check that operands have LLVM types
In Standard to LLVM dialect conversion, the binary op conversion pattern
implicitly assumed some operands were of LLVM IR dialect type. This is not
necessarily true, for example if the Ops that produce those operands did not
match the existing convresion patterns. Check if all operands are of LLVM IR
dialect type and if not, fail to patch the binary op pattern.
Closes tensorflow/mlir#168
PiperOrigin-RevId:
274063207
Alex Zinenko [Thu, 10 Oct 2019 23:01:41 +0000 (16:01 -0700)]
Translation to LLVM: check the validity of module-level Ops
Translation to LLVM expects the entry module to have only specific types of ops
that correspond to LLVM IR entities allowed in a module. Currently those are
restricted to functions and globals. Introduce an additional check at the
module level. Inside individual functions, the check for supported Ops is
already performed, but it accepts all LLVM dialect Ops and wouldn't be
immediately applicable at the module level.
PiperOrigin-RevId:
274058651
Mahesh Ravishankar [Thu, 10 Oct 2019 22:51:35 +0000 (15:51 -0700)]
Add lowering of constant ops to SPIR-V.
The lowering is specified as a pattern and is done only if the result
is a SPIR-V scalar type or vector type.
Handling ConstantOp with index return type needs special handling
since SPIR-V dialect does not have index types. Based on the bitwidth
of the attribute value, either i32 or i64 is chosen.
Other constant lowerings are left as a TODO.
PiperOrigin-RevId:
274056805
Geoffrey Martin-Noble [Thu, 10 Oct 2019 22:01:34 +0000 (15:01 -0700)]
Add trait for specified shapes matching
PiperOrigin-RevId:
274046434
River Riddle [Thu, 10 Oct 2019 19:12:39 +0000 (12:12 -0700)]
Add support for canonicalizing callable regions during inlining.
This will allow for inlining newly devirtualized calls, as well as give a more accurate cost model(when we have one). Currently canonicalization will only run for nodes that have no child edges, as the child nodes may be erased during canonicalization. We can support this in the future, but it requires more intricate deletion tracking.
PiperOrigin-RevId:
274011386
River Riddle [Thu, 10 Oct 2019 19:01:45 +0000 (12:01 -0700)]
Remove the need to convert operations in regions of operations that have been replaced.
When an operation with regions gets replaced, we currently require that all of the remaining nested operations are still converted even though they are going to be replaced when the rewrite is finished. This cl adds a tracking for a minimal set of operations that are known to be "dead". This allows for ignoring the legalization of operations that are won't survive after conversion.
PiperOrigin-RevId:
274009003
Alex Zinenko [Thu, 10 Oct 2019 17:25:46 +0000 (10:25 -0700)]
Python bindings: export index_cast
We are now properly enforcing the absence of index elements in memrefs and
tensors. Instead, users are expected to store sized integers and cast them to
index type if necessary. Expose the respective operation to Python bindings.
PiperOrigin-RevId:
273985856
Christian Sigg [Thu, 10 Oct 2019 13:31:39 +0000 (06:31 -0700)]
Mark GPU dialect as illegal when lowering to NVVM.
PiperOrigin-RevId:
273948293
Geoffrey Martin-Noble [Thu, 10 Oct 2019 09:31:21 +0000 (02:31 -0700)]
NFC: Cleanup of type checking tests
1. Rename test ops referencing operand to index from 0 consistent with how we index elsewhere.
2. Don't limit type checking that functions for all shaped types to only tensors.
3. Don't limit (element) type checking functions and add tests for scalars.
4. Remove SSA values that don't do anything.
PiperOrigin-RevId:
273917608
Alex Zinenko [Thu, 10 Oct 2019 08:33:33 +0000 (01:33 -0700)]
Use llvm.func to define functions with wrapped LLVM IR function type
This function-like operation allows one to define functions that have wrapped
LLVM IR function type, in particular variadic functions. The operation was
added in parallel to the existing lowering flow, this commit only switches the
flow to use it.
Using a custom function type makes the LLVM IR dialect type system more
consistent and avoids complex conversion rules for functions that previously
had to use the built-in function type instead of a wrapped LLVM IR dialect type
and perform conversions during the analysis.
PiperOrigin-RevId:
273910855
Parker Schuh [Thu, 10 Oct 2019 03:42:32 +0000 (20:42 -0700)]
Add test for fix to tablegen for custom folders for ops that return a single
variadic result.
Add missing test for single line fix to `void OpEmitter::genFolderDecls()`
entitled "Fold away reduction over 0 dimensions."
PiperOrigin-RevId:
273880337
Kazuaki Ishizaki [Thu, 10 Oct 2019 03:32:12 +0000 (20:32 -0700)]
Fix typo in QuantizedType method names
Closes tensorflow/mlir#172
COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/172 from kiszk:quantops
e27b57eac8f4c6ef7ee6a6f7b497d3e2f56f6798
PiperOrigin-RevId:
273879164
MLIR Team [Thu, 10 Oct 2019 02:57:02 +0000 (19:57 -0700)]
Pre-allocate space for results from a regex match that uses 3 match strings.
That space is 4 StringRefs, not 3, because element 0 of the match always
contains the entire source string.
PiperOrigin-RevId:
273875606
Kazuaki Ishizaki [Wed, 9 Oct 2019 22:06:54 +0000 (15:06 -0700)]
minor spelling tweaks
--
f93661f2c25aab6cc5bf439606b0a1312998a575 by Kazuaki Ishizaki <ishizaki@jp.ibm.com>:
address @River707's comment
Closes tensorflow/mlir#176
COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/176 from kiszk:spelling_tweaks_include_tools
f93661f2c25aab6cc5bf439606b0a1312998a575
PiperOrigin-RevId:
273830689
MLIR Team [Wed, 9 Oct 2019 20:48:38 +0000 (13:48 -0700)]
Add ::printAsTextualPipeline to Pass and OpPassManager.
Allow printing out pipelines in a format that is as close as possible to the
textual pass pipeline format. Individual passes can override the print function
in order to format any options that may have been used to construct that pass.
PiperOrigin-RevId:
273813627
Christian Sigg [Wed, 9 Oct 2019 18:32:54 +0000 (11:32 -0700)]
Guard rewriter insertion point during signature conversion.
Avoid unexpected side effect in rewriter insertion point.
PiperOrigin-RevId:
273785794
Mahesh Ravishankar [Wed, 9 Oct 2019 18:25:25 +0000 (11:25 -0700)]
Make SPIR-V lowering infrastructure follow Vulkan SPIR-V validation.
The lowering infrastructure needs to be enhanced to lower into a
spv.Module that is consistent with the SPIR-V spec. The following
changes are needed
1) The Vulkan/SPIR-V validation rules dictates entry functions to have
signature of void(void). This requires changes to the function
signature conversion infrastructure within the dialect conversion
framework. When an argument is dropped from the original function
signature, a function can be specified that when invoked will return
the value to use as a replacement for the argument from the original
function.
2) Some changes to the type converter to make the converted type
consistent with the Vulkan/SPIR-V validation rules,
a) Add support for converting dynamically shaped tensors to
spv.rtarray type.
b) Make the global variable of type !spv.ptr<!spv.struct<...>>
3) Generate the entry point operation for the kernel functions and
automatically compute all the interface variables needed
PiperOrigin-RevId:
273784229
Nicolas Vasilache [Wed, 9 Oct 2019 17:36:59 +0000 (10:36 -0700)]
Fix Windows linkage error
This CL fixes bad macro names usage in mlir_runner_utils.h.
The macro mlir_runner_utils_EXPORTS now matches what is defined in CMakeLists.txt.
PiperOrigin-RevId:
273773931
Diego Caballero [Wed, 9 Oct 2019 17:36:54 +0000 (10:36 -0700)]
Add support for some multi-store cases in affine fusion
This PR is a stepping stone towards supporting generic multi-store
source loop nests in affine loop fusion. It extends the algorithm to
support fusion of multi-store loop nests that:
1. have only one store that writes to a function-local live out, and
2. the remaining stores are involved in loop nest self dependences
or no dependences within the function.
Closes tensorflow/mlir#162
COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/162 from dcaballe:dcaballe/multi-output-fusion
7fb7dec6fe8b45f5ce176f018bfe37b256420c45
PiperOrigin-RevId:
273773907
MLIR Team [Wed, 9 Oct 2019 12:01:07 +0000 (05:01 -0700)]
Update the usage and comments in define_inst.sh.
PiperOrigin-RevId:
273723108
Alexander Belyaev [Wed, 9 Oct 2019 11:19:06 +0000 (04:19 -0700)]
Add exp operation to LLVMOPs.td.
PiperOrigin-RevId:
273718958
Christian Sigg [Wed, 9 Oct 2019 09:46:04 +0000 (02:46 -0700)]
Change to doxygen comments. NFC.
PiperOrigin-RevId:
273707610
Christian Sigg [Wed, 9 Oct 2019 09:43:18 +0000 (02:43 -0700)]
Assert that region is not cloned into itself.
PiperOrigin-RevId:
273707291
River Riddle [Wed, 9 Oct 2019 04:15:49 +0000 (21:15 -0700)]
NFC: Fully qualify use of std::string.
PiperOrigin-RevId:
273668957
Smit Hinsu [Wed, 9 Oct 2019 02:36:37 +0000 (19:36 -0700)]
Allow dynamic but ranked types in ops with SameOperandsAndResultShape and SameOperandsAndResultType traits
Currently SameOperandsAndResultShape trait allows operands to have tensor<*xf32> and tensor<2xf32> but doesn't allow tensor<?xf32> and tensor<10xf32>.
Also, use the updated shape compatibility helper function in TensorCastOp::areCastCompatible method.
PiperOrigin-RevId:
273658336
River Riddle [Wed, 9 Oct 2019 01:38:05 +0000 (18:38 -0700)]
Update the symbol utility methods to handle the case of unknown operations.
This enhances the symbol table utility methods to handle the case where an unknown operation may define a symbol table. When walking symbols, we now collect all symbol uses before allowing the user to iterate. This prevents the user from assuming that all symbols are actually known before performing a transformation.
PiperOrigin-RevId:
273651963
MLIR Team [Wed, 9 Oct 2019 01:23:13 +0000 (18:23 -0700)]
Add Instance Specific Pass Options.
This allows individual passes to define options structs and for these options to be parsed per instance of the pass while building the pass pipeline from the command line provided textual specification.
The user can specify these per-instance pipeline options like so:
```
struct MyPassOptions : public PassOptions<MyPassOptions> {
Option<int> exampleOption{*this, "flag-name", llvm::cl::desc("...")};
List<int> exampleListOption{*this, "list-flag-name", llvm::cl::desc("...")};
};
static PassRegistration<MyPass, MyPassOptions> pass("my-pass", "description");
```
PiperOrigin-RevId:
273650140
River Riddle [Wed, 9 Oct 2019 00:44:39 +0000 (17:44 -0700)]
Add support for parsing/printing non bare-identifier SymbolRefs.
The restriction that symbols can only have identifier names is arbitrary, and artificially limits the names that a symbol may have. This change adds support for parsing and printing symbols that don't fit in the 'bare-identifier' grammar by printing the reference in quotes, e.g. @"0_my_reference" can now be used as a symbol name.
PiperOrigin-RevId:
273644768