River Riddle [Mon, 1 Jul 2019 17:29:09 +0000 (10:29 -0700)]
NFC: Refactor Function to be value typed.
Move the data members out of Function and into a new impl storage class 'FunctionStorage'. This allows for Function to become value typed, which will greatly simplify the transition of Function to FuncOp(given that FuncOp is also value typed).
PiperOrigin-RevId:
255983022
River Riddle [Mon, 1 Jul 2019 17:12:33 +0000 (10:12 -0700)]
Update the 1->N legalizer test to use "test.return" so that the conversion cast is elided properly.
PiperOrigin-RevId:
255979732
Alex Zinenko [Mon, 1 Jul 2019 16:52:53 +0000 (09:52 -0700)]
TypeConversion: do not materialize conversion of the type to itself
Type conversion does not necessarily affect all types, some of them may remain
untouched. The type conversion tool from the dialect conversion framework will
unconditionally insert a temporary cast operation from the type to itself
anyway, and will try to materialize it to a real conversion operation if there
are remaining uses. Simply use the original value instead.
PiperOrigin-RevId:
255975450
Alex Zinenko [Mon, 1 Jul 2019 16:49:31 +0000 (09:49 -0700)]
Run FileCheck on test-legalizer.mlir
The RUN line was missing a call to FileCheck making the test always pass. Add
the call to FileCheck and temporarily disable one of the tests that does not
produce the expected result.
PiperOrigin-RevId:
255974805
Andy Davis [Mon, 1 Jul 2019 15:32:44 +0000 (08:32 -0700)]
Add affine-to-standard lowerings for affine.load/store/dma_start/dma_wait.
PiperOrigin-RevId:
255960171
Lei Zhang [Mon, 1 Jul 2019 14:30:23 +0000 (07:30 -0700)]
Also disable generating underlying value to symbol conversion declaration when there is an enumerant without explicit value
PiperOrigin-RevId:
255950779
Lei Zhang [Mon, 1 Jul 2019 13:51:39 +0000 (06:51 -0700)]
Avoid generating underlying value to symbol conversion function if there is an enumerant without explicit value.
PiperOrigin-RevId:
255945801
Lei Zhang [Mon, 1 Jul 2019 12:26:14 +0000 (05:26 -0700)]
[ODS] Introduce IntEnumAttr
In ODS, right now we use StringAttrs to emulate enum attributes. It is
suboptimal if the op actually can and wants to store the enum as a
single integer value; we are paying extra cost on storing and comparing
the attribute value.
This CL introduces a new enum attribute subclass that are backed by
IntegerAttr. The downside with IntegerAttr-backed enum attributes is
that the assembly form now uses integer values, which is less obvious
than the StringAttr-backed ones. However, that can be remedied by
defining custom assembly form with the help of the conversion utility
functions generated via EnumsGen.
Choices are given to the dialect writers to decide which one to use for
their enum attributes.
PiperOrigin-RevId:
255935542
Nicolas Vasilache [Mon, 1 Jul 2019 08:31:15 +0000 (01:31 -0700)]
Add a folder-based EDSC intrinsics constructor (NFC)
PiperOrigin-RevId:
255908660
Alex Zinenko [Mon, 1 Jul 2019 07:47:58 +0000 (00:47 -0700)]
Expose AffineToGPUPass for use with PassManager
Originally, AffineToGPUPass was created and registered in the source file
mainly for testing purposes. Provide a factory function that constructs
AffineToGPU pass to make it usable in pass pipelines.
PiperOrigin-RevId:
255902831
River Riddle [Sun, 30 Jun 2019 17:44:07 +0000 (10:44 -0700)]
Extract the automatic function renaming and symbol table out of Module.
This functionality is now moved to a new class, ModuleManager. This class allows for inserting functions into a module, and will auto-rename them on insert to ensure a unique name. This now means that users adding new functions to a module must ensure that the function name is unique, as the Module will no longer do it automatically. This also means that Module::getNamedFunction now operates in O(N) instead of the O(c) time it did before. This simplifies the move of Modules to Operations as the ModuleOp will not be able to have this functionality.
PiperOrigin-RevId:
255846088
Nicolas Vasilache [Sun, 30 Jun 2019 14:07:50 +0000 (07:07 -0700)]
Move BufferAllocOp and BufferDeallocOp to ODS
This CL also fixes a parsing issue in the BufferType, adds LLVM lowering support for handling the static constant buffer size and a roundtrip test.
PiperOrigin-RevId:
255834356
jpienaar [Mon, 1 Jul 2019 16:54:15 +0000 (09:54 -0700)]
Merge pull request tensorflow/mlir#37 from tensorflow:jpienaar-patch-1
PiperOrigin-RevId:
255769524
jpienaar [Sat, 29 Jun 2019 01:06:45 +0000 (18:06 -0700)]
Update link to presentation
Jacques Pienaar [Sat, 29 Jun 2019 00:52:48 +0000 (17:52 -0700)]
Internal change
PiperOrigin-RevId:
255700627
A. Unique TensorFlower [Sat, 29 Jun 2019 00:59:58 +0000 (17:59 -0700)]
Merge pull request tensorflow/mlir#36 from pkanwar23:patch-2
PiperOrigin-RevId:
255694478
pkanwar23 [Fri, 28 Jun 2019 23:44:32 +0000 (16:44 -0700)]
Update CONTRIBUTING.md
Co-Authored-By: Mehdi Amini <joker.eph@gmail.com>
pkanwar23 [Fri, 28 Jun 2019 22:11:04 +0000 (15:11 -0700)]
Update CONTRIBUTING.md
pkanwar23 [Fri, 28 Jun 2019 22:05:13 +0000 (15:05 -0700)]
Update CONTRIBUTING.md
pkanwar23 [Fri, 28 Jun 2019 22:00:57 +0000 (15:00 -0700)]
Update CONTRIBUTING.md
Andy Davis [Fri, 28 Jun 2019 20:31:31 +0000 (13:31 -0700)]
Add new operations affine.dma_start and affine.dma_wait which take affine maps for indexing memrefs by construction.
These ops are analogues of the current standard ops dma_start/wait, with the exception that the memref operands are affine expressions of loop IVs and symbols (analogous to affine.load/store).
The addition of these operations will enable changes to affine transformation and analysis passes which operate on memory dereferencing operations.
PiperOrigin-RevId:
255658382
pkanwar23 [Fri, 28 Jun 2019 19:51:30 +0000 (12:51 -0700)]
Update CONTRIBUTING.md
Lei Zhang [Fri, 28 Jun 2019 19:31:38 +0000 (12:31 -0700)]
[spirv] Move conversion passes to a new library
PiperOrigin-RevId:
255648303
River Riddle [Fri, 28 Jun 2019 18:28:30 +0000 (11:28 -0700)]
Refactor DialectConversion to use 'materializeConversion' when a type conversion must persist after the conversion has finished.
During conversion, if a type conversion has dangling uses a type conversion must persist after conversion has finished to maintain valid IR. In these cases, we now query the TypeConverter to materialize a conversion for us. This allows for the default case of a full conversion to continue working as expected, but also handle the degenerate cases more robustly.
PiperOrigin-RevId:
255637171
Mahesh Ravishankar [Fri, 28 Jun 2019 16:59:22 +0000 (09:59 -0700)]
Add buffer size information to Linalg::BufferType. If the size is
constant then it is represented as <size x elementType>. If the size
is not a compile time constant, then it is represented as
<? x elementType>.
PiperOrigin-RevId:
255619400
River Riddle [Fri, 28 Jun 2019 03:48:53 +0000 (20:48 -0700)]
Respect the user provided type when parsing StringAttr.
PiperOrigin-RevId:
255532918
Jacques Pienaar [Fri, 28 Jun 2019 03:48:04 +0000 (20:48 -0700)]
Update cmake depedency.
PiperOrigin-RevId:
255532863
Mahesh Ravishankar [Thu, 27 Jun 2019 23:46:24 +0000 (16:46 -0700)]
Return an error when parseType doesnt parse the entire string passed
PiperOrigin-RevId:
255505300
River Riddle [Thu, 27 Jun 2019 23:42:50 +0000 (16:42 -0700)]
Cleanup the 'clone' methods and remove the need to explicitly pass in the context.
This also adds a new 'Region::cloneInto' method that accepts an insertion position.
PiperOrigin-RevId:
255504640
MLIR Team [Thu, 27 Jun 2019 17:56:37 +0000 (10:56 -0700)]
Parenthesize match expression to avoid operator precedence issues
PiperOrigin-RevId:
255435454
River Riddle [Thu, 27 Jun 2019 16:12:19 +0000 (09:12 -0700)]
Allow attaching a type to StringAttr.
Some dialects allow for string types, and this allows for reusing StringAttr for constants of these types.
PiperOrigin-RevId:
255413948
Jacques Pienaar [Thu, 27 Jun 2019 15:38:49 +0000 (08:38 -0700)]
Fix incorrect type used in forward declaration.
Addresses compiler warning.
PiperOrigin-RevId:
255407691
MLIR Team [Thu, 27 Jun 2019 02:56:42 +0000 (19:56 -0700)]
Support parsing MLIR source from stdin.
PiperOrigin-RevId:
255316118
River Riddle [Thu, 27 Jun 2019 01:49:50 +0000 (18:49 -0700)]
Add a new AttributeElementIterator to DenseElementsAttr.
This allows for iterating over the internal elements via an iterator_range of Attribute, and also allows for removing the final SmallVectorImpl based 'getValues' method.
PiperOrigin-RevId:
255309555
River Riddle [Thu, 27 Jun 2019 01:29:25 +0000 (18:29 -0700)]
Standardize and refactor Attribute type printing.
Remove the ability to print an attribute without a type, but allow for attributes to elide the type under certain circumstances. This fixes a bug where attributes within ArrayAttr, and other collection attributes, would never print the type.
PiperOrigin-RevId:
255306974
Jacques Pienaar [Wed, 26 Jun 2019 18:12:40 +0000 (11:12 -0700)]
Split out TranslateClParser and add new parse method that reuses SourceMgr.
Split out class to command line parser for translate methods into standalone
class. Similar to splitting up mlir-opt to reuse functionality with different
initialization.
PiperOrigin-RevId:
255225790
Stephan Herhut [Wed, 26 Jun 2019 12:32:46 +0000 (05:32 -0700)]
Add a pass that inserts getters for all cubins found via nvvm.cubin
annotations.
Getters are required as there are currently no global constants in MLIR and this
is an easy way to unblock CUDA execution while waiting for those.
PiperOrigin-RevId:
255169002
Stephan Herhut [Wed, 26 Jun 2019 12:16:11 +0000 (05:16 -0700)]
Make GPU to CUDA transformations independent of CUDA runtime.
The actual transformation from PTX source to a CUDA binary is now factored out,
enabling compiling and testing the transformations independently of a CUDA
runtime.
MLIR has still to be built with NVPTX target support for the conversions to be
built and tested.
PiperOrigin-RevId:
255167139
River Riddle [Wed, 26 Jun 2019 04:31:54 +0000 (21:31 -0700)]
Move the emitError/Warning/Remark utility methods out of MLIRContext and into the mlir namespace.
Now that Locations are attributes, they have direct access to the MLIR context. This allows for simplifying error emission by removing unnecessary context lookups.
PiperOrigin-RevId:
255112791
River Riddle [Wed, 26 Jun 2019 02:06:06 +0000 (19:06 -0700)]
Change the attribute dictionary syntax to separate name and value with '='.
The current syntax separates the name and value with ':', but ':' is already overloaded by several other things(e.g. trailing types). This makes the syntax difficult to parse in some situtations:
Old:
"foo: 10 : i32"
New:
"foo = 10 : i32"
PiperOrigin-RevId:
255097928
River Riddle [Tue, 25 Jun 2019 23:57:32 +0000 (16:57 -0700)]
NFC: Uniformize the return of the LocationAttr 'get' methods to 'Location'.
PiperOrigin-RevId:
255078768
River Riddle [Tue, 25 Jun 2019 23:06:13 +0000 (16:06 -0700)]
Modify the syntax of the the ElementsAttrs to print the type as a colon type.
This is the standard syntax for types on operations, and is also already used by IntegerAttr and FloatAttr.
Example:
dense<5> : tensor<i32>
dense<[3]> : tensor<1xi32>
PiperOrigin-RevId:
255069157
Rasmus Munk Larsen [Tue, 25 Jun 2019 21:59:40 +0000 (14:59 -0700)]
Fix typo in Toy tutorial documentation
PiperOrigin-RevId:
255054639
Rasmus Munk Larsen [Tue, 25 Jun 2019 19:23:28 +0000 (12:23 -0700)]
Fix unclear sentence.
PiperOrigin-RevId:
255022564
River Riddle [Tue, 25 Jun 2019 19:10:46 +0000 (12:10 -0700)]
Move the IndexedAccessorIterator to STLExtras to allow for reuse.
This iterator is useful for implementing random access iterators based upon an index and an object pointer. Moving it to STLExtras allows for reuse elsewhere throughout the codebase, e.g. simplifying the DenseElementsAttr iterators.
PiperOrigin-RevId:
255020377
Nicolas Vasilache [Tue, 25 Jun 2019 19:02:56 +0000 (12:02 -0700)]
Internal change
PiperOrigin-RevId:
255018853
Andy Davis [Tue, 25 Jun 2019 17:29:53 +0000 (10:29 -0700)]
Support printing SSA ids in affine.load/store which do not have special names.
PiperOrigin-RevId:
254997746
River Riddle [Tue, 25 Jun 2019 16:42:52 +0000 (09:42 -0700)]
Update the OperationFolder to find a valid insertion point when materializing constants.
The OperationFolder currently just inserts into the entry block of a Function, but regions may be isolated above, i.e. explicit capture only, and blindly inserting constants may break the invariants of these regions.
PiperOrigin-RevId:
254987796
Alex Zinenko [Tue, 25 Jun 2019 16:04:13 +0000 (09:04 -0700)]
GPUtoNVVM: adjust integer bitwidth when lowering special register ops
GPU dialect operations (launch and launch_func) use `index` type for thread and
block index values inside the kernel, for compatibility with affine loops.
NVVM dialect operations, following the NVVM intrinsics, use `!llvm.i32` type,
which does not necessarily have the same bit width as the lowered `index` type.
Optionally sign-extend (indices are signed) or truncate the result of the NVVM
dialect operation to the bit width of the lowered `index` type before passing
it to other operations. This behavior is consistent with `std.index_cast`. We
cannot use the latter since we are targeting LLVM dialect types directly,
rather than standard integer types.
PiperOrigin-RevId:
254980868
Stephan Herhut [Tue, 25 Jun 2019 13:44:58 +0000 (06:44 -0700)]
Add gpu::GPUDialect::isKernel helper.
Also some mild cleanup of the kernel to cubin conversion pass.
PiperOrigin-RevId:
254959303
Nicolas Vasilache [Tue, 25 Jun 2019 13:35:28 +0000 (06:35 -0700)]
Add missing dependence to MLIRLLVMIR
PiperOrigin-RevId:
254957980
Alex Zinenko [Tue, 25 Jun 2019 13:30:32 +0000 (06:30 -0700)]
NVVM target: emit nvvm.annotations for kernel functions
PTX backend in LLVM expects additional module-level metadata
`!nvvm.annotations` that lists functions that can be used as GPU kernels.
Generate this metadata based on the `gpu.kernel` attribute attached to
functions. This attribute is added automatically by the kernel outlining pass
in the GPU dialect lowering flow.
PiperOrigin-RevId:
254957345
Alex Zinenko [Tue, 25 Jun 2019 11:21:10 +0000 (04:21 -0700)]
gpu.launch_func: add accessors to grid configuration operands
Add accessor functions that return `gpu::KernelDim3` containing the respective
operands for grid and block size accepted by `gpu.launch_func`. Use the same
signature as for `gpu.launch`.
PiperOrigin-RevId:
254942674
Mehdi Amini [Tue, 25 Jun 2019 00:51:44 +0000 (17:51 -0700)]
Print both type in diagnostic emitted on mismatch between def/use of SSA Values (NFC)
The error would look like:
path/filename.mlir:32:23: error: use of value '%28' expects different type than prior uses: ''i32'' vs ''!_tf.control''
PiperOrigin-RevId:
254874859
River Riddle [Tue, 25 Jun 2019 00:36:05 +0000 (17:36 -0700)]
NFC: Move the ArgConverter methods out-of-line to improve readability.
PiperOrigin-RevId:
254872695
Nicolas Vasilache [Mon, 24 Jun 2019 22:23:26 +0000 (15:23 -0700)]
Fix OSS build
PiperOrigin-RevId:
254847773
Nicolas Vasilache [Mon, 24 Jun 2019 21:35:21 +0000 (14:35 -0700)]
Split test-specific passes out of mlir-opt
Instead put their impl in test/lib and link them into mlir-test-opt
PiperOrigin-RevId:
254837439
River Riddle [Mon, 24 Jun 2019 19:03:44 +0000 (12:03 -0700)]
Cache several common LLVMTypes in the LLVMDialect.
LLVM is not thread-safe which means that several of the 'get' methods for LLVMType must be double locked to ensure thread-safety. This cl adds static caching, i.e. no lookups or locking, for several simple LLVM types(i1, half, void, etc.). It also cleans up the implementation of the double locking that is required for some types. In the future we could add a form of dynamic caching to only need to lock one mutex in the best case, but that requires analysis on the memory overhead/vs time lost to taking two locks.
PiperOrigin-RevId:
254806747
Mahesh Ravishankar [Mon, 24 Jun 2019 17:59:05 +0000 (10:59 -0700)]
Add SPIR-V Load/Store operations. Currently this only support memory
operands being None, Volatile, Aligned and Nontemporal
PiperOrigin-RevId:
254792353
River Riddle [Mon, 24 Jun 2019 16:22:07 +0000 (09:22 -0700)]
NFC: Simplify Operation::getContext to use the context within the location.
PiperOrigin-RevId:
254771979
Nicolas Vasilache [Mon, 24 Jun 2019 16:12:47 +0000 (09:12 -0700)]
Cleanup test following bad merge
PiperOrigin-RevId:
254770395
Nicolas Vasilache [Mon, 24 Jun 2019 16:00:06 +0000 (09:00 -0700)]
Use linalg.view_slice in tiling and fusion
This CL makes use of view_slice in tiling and fusion.
Using a higher level IR element greatly simplifies the IR produced during tiling and fusion.
Lowering to LLVM is updated to first translate view_slice into a sequence of dim, range and cmpi.
This level will also be useful when lowering to affine.
PiperOrigin-RevId:
254767814
Jacques Pienaar [Mon, 24 Jun 2019 15:56:57 +0000 (08:56 -0700)]
Remove leftover change from splitting mlir-opt change.
PiperOrigin-RevId:
254767366
Jacques Pienaar [Mon, 24 Jun 2019 15:41:52 +0000 (08:41 -0700)]
Split out mlir-opt main into separate file.
Enable reusing the real mlir-opt main from unit tests and in case where
additional initialization needs to happen before main is invoked (e.g., when
using different command line flag libraries).
PiperOrigin-RevId:
254764575
Nicolas Vasilache [Mon, 24 Jun 2019 14:59:59 +0000 (07:59 -0700)]
Add higher-level linalg.view_slice operation.
This will be useful to simplify the IR emitted during transformations as well as lowering to affine.
PiperOrigin-RevId:
254757641
Andy Davis [Mon, 24 Jun 2019 14:31:52 +0000 (07:31 -0700)]
Add parsing/printing for new affine.load and affine.store operations.
The new operations affine.load and affine.store will take composed affine maps by construction.
These operations will eventually replace load and store operations currently used in affine regions and operated on by affine transformation and analysis passes.
PiperOrigin-RevId:
254754048
River Riddle [Mon, 24 Jun 2019 08:27:22 +0000 (01:27 -0700)]
Update CSE to respect nested regions that are isolated from above. This cl also removes the unused 'NthRegionIsIsolatedFromAbove' trait as it was replaced with a more general 'IsIsolatedFromAbove'.
PiperOrigin-RevId:
254709704
Jacques Pienaar [Sat, 22 Jun 2019 22:06:17 +0000 (15:06 -0700)]
Change string to std::string.
PiperOrigin-RevId:
254580672
River Riddle [Sat, 22 Jun 2019 21:39:16 +0000 (14:39 -0700)]
Allow converting Diagnostic to LogicalResult::Failure. This matches the behavior of InFlightDiagnostic and enables notes to be converted to failure.
PiperOrigin-RevId:
254579098
Jacques Pienaar [Sat, 22 Jun 2019 21:29:23 +0000 (14:29 -0700)]
Linalg1LLVMConversion should depend on MLIRLLVMIR to ensure ops generated.
PiperOrigin-RevId:
254578530
River Riddle [Sat, 22 Jun 2019 18:48:43 +0000 (11:48 -0700)]
Add a new dialect hook 'materializeConstant' to create a constant operation that materializes an attribute value with the given type. This effectively adds support for dialect specific constant values that have different invariants than std.constant. 'OperationFolder' is updated to use this new hook, or attempt to default to std.constant when legal.
PiperOrigin-RevId:
254570153
River Riddle [Sat, 22 Jun 2019 18:08:52 +0000 (11:08 -0700)]
NFC: Remove the 'context' parameter from OperationState.
Now that Locations are Attributes they contain a direct reference to the MLIRContext, i.e. the context can be directly accessed from the given location instead of being explicitly passed in.
PiperOrigin-RevId:
254568329
Jacques Pienaar [Sat, 22 Jun 2019 15:02:00 +0000 (08:02 -0700)]
Add missing build dep.
PiperOrigin-RevId:
254557652
Feng Liu [Sat, 22 Jun 2019 04:43:49 +0000 (21:43 -0700)]
Add int8 predicates to the tf lite ops
PiperOrigin-RevId:
254519710
River Riddle [Sat, 22 Jun 2019 03:20:27 +0000 (20:20 -0700)]
Define a ModuleOp that represents a Module as an Operation.
The ModuleOp contains a single region that must contain a single block. This block must be terminated by a new pseudo operation 'module_terminator'. The syntax for this operations is as follows:
`module` (`attributes` attr-dict)? region
Example:
module {
...
}
module attributes { ... } {
...
}
PiperOrigin-RevId:
254513752
Nicolas Vasilache [Sat, 22 Jun 2019 01:55:02 +0000 (18:55 -0700)]
Remove dead function
PiperOrigin-RevId:
254507641
Nicolas Vasilache [Sat, 22 Jun 2019 01:31:52 +0000 (18:31 -0700)]
Add a Linalg convolution op.
This CL adds a conv op that corresponds to the TF description along with its lowering to loops (https://www.tensorflow.org/api_docs/python/tf/nn/convolution).
The dimension of the convolution is inferred from the rank of the views. The other logical
dimensions correspond to the TF description.
The computation of tiled views need to be updated to work for the input tensor. This is left for a future CL.
PiperOrigin-RevId:
254505644
River Riddle [Sat, 22 Jun 2019 01:27:49 +0000 (18:27 -0700)]
Refactor the location classes to be attributes instead of separate IR classes.
This will allow for locations to be used in the same contexts as attributes. Given that attributes are nullable types, the 'Location' class now represents a non-nullable wrapper around a 'LocationAttr'. This preserves the desired semantics we have for non-optional locations.
PiperOrigin-RevId:
254505278
River Riddle [Sat, 22 Jun 2019 00:00:01 +0000 (17:00 -0700)]
Simplify PredecessorIterator by using mapped_iterator.
PiperOrigin-RevId:
254495164
Lei Zhang [Fri, 21 Jun 2019 21:51:58 +0000 (14:51 -0700)]
[spirv] Basic serializer and deserializer
This CL adds the basic SPIR-V serializer and deserializer for converting
SPIR-V module into the binary format and back. Right now only an empty
module with addressing model and memory model is supported; (de)serialize
other components will be added gradually with subsequent CLs.
The purpose of this library is to enable importing SPIR-V binary modules
to run transformations on them and exporting SPIR-V modules to be consumed
by execution environments. The focus is transformations, which inevitably
means changes to the binary module; so it is not designed to be a general
tool for investigating the SPIR-V binary module and does not guarantee
roundtrip equivalence (at least for now).
PiperOrigin-RevId:
254473019
River Riddle [Fri, 21 Jun 2019 20:45:21 +0000 (13:45 -0700)]
NFC: Drop the unnecessary dependence on TransformsUtils from Parser. This is a historical dependency that is no longer needed.
PiperOrigin-RevId:
254460518
River Riddle [Fri, 21 Jun 2019 20:43:38 +0000 (13:43 -0700)]
Define the 'reference' type for the remaining value-typed iterators. This allows for them to be used with llvm::enumerate and other various iterator utilities.
PiperOrigin-RevId:
254460201
River Riddle [Fri, 21 Jun 2019 17:26:57 +0000 (10:26 -0700)]
Define the 'reference' type for the OperandType and ResultType iterators so that they can be used with llvm::enumerate.
PiperOrigin-RevId:
254422623
Krzysztof Drewniak [Fri, 21 Jun 2019 17:23:18 +0000 (10:23 -0700)]
Clarify documentation for MLIR to indicate that the build instructions run the test suite.
PiperOrigin-RevId:
254421795
River Riddle [Fri, 21 Jun 2019 16:29:46 +0000 (09:29 -0700)]
Add support for 1->N type mappings in the dialect conversion infrastructure. To support these mappings a hook must be overridden on the type converter: 'materializeConversion' :to generate a cast operation from the new types to the old type. This operation is automatically erased if all uses are removed, otherwise it remains in the IR for the user to handle.
PiperOrigin-RevId:
254411383
River Riddle [Fri, 21 Jun 2019 16:20:42 +0000 (09:20 -0700)]
Cache instances of several common attributes(e.g. BoolAttr, UnitAttr) and types(I1/I16/I32/etc.) when creating the MLIRContext. This allows for these symbols to be accessed without the need to perform any lookups/locking.
PiperOrigin-RevId:
254410080
Nicolas Vasilache [Fri, 21 Jun 2019 12:34:58 +0000 (05:34 -0700)]
Support for 0-D case in Linalg ops
This CL adds support for O-D ops in Linalg ops by:
1. making the CopyOp maps optional instead of default valued
2. allowing certain map operations to accept and return empty maps
3. making linalg::LowerToLoops aware of these changes
4. providing a proper 0-D impl for CopyOp and FillOp
5. adding the relevant tests
PiperOrigin-RevId:
254381908
River Riddle [Fri, 21 Jun 2019 10:26:39 +0000 (03:26 -0700)]
Add an overload to 'PatternRewriter::inlineRegionBefore' that accepts a parent region for the insertion position. This allows for inlining the given region into the end of another region.
PiperOrigin-RevId:
254367375
Mehdi Amini [Fri, 21 Jun 2019 07:44:11 +0000 (00:44 -0700)]
Add missing override on overridden virtual method (NFC)
PiperOrigin-RevId:
254349019
Nicolas Vasilache [Thu, 20 Jun 2019 22:10:35 +0000 (15:10 -0700)]
Uniformize usage of OpBuilder& (NFC)
Historically the pointer-based version of builders was used.
This CL uniformizes to OpBuilder &
PiperOrigin-RevId:
254280885
Mahesh Ravishankar [Thu, 20 Jun 2019 20:19:41 +0000 (13:19 -0700)]
Fix a warning in enum value ecoding for SPIRV image types. Instead of
using the enum class in the packed struct, use unsigned value for
encoding and convert it lazily
PiperOrigin-RevId:
254258341
Mehdi Amini [Thu, 20 Jun 2019 15:58:24 +0000 (08:58 -0700)]
TensorFlow operands can be broadcasted with each other and with the result, relax the verifier.
PiperOrigin-RevId:
254206814
Lei Zhang [Thu, 20 Jun 2019 12:59:19 +0000 (05:59 -0700)]
Add definition for OperandElementTypeIterator and ResultElementTypeIterator
These are useful utility iterators helping use to get the element types of
operands/results of shaped types.
Also defined ranges for these iterators.
PiperOrigin-RevId:
254180888
River Riddle [Thu, 20 Jun 2019 06:39:06 +0000 (23:39 -0700)]
Rename ConversionTarget::isLegal to isDynamicallyLegal to better represent what the function is actually checking.
PiperOrigin-RevId:
254141073
Mahesh Ravishankar [Wed, 19 Jun 2019 23:09:57 +0000 (16:09 -0700)]
Add SPIRV Image Type according to the spec described here :
https://www.khronos.org/registry/spir-v/specs/1.0/SPIRV.html#OpTypeImage.
Add new enums to describe Image dimensionality, Image Depth, Arrayed
information, Sampling, Sampler User information, and Image format.
Doesn's support the Optional Access qualifier at this stage
Fix Enum generator for tblgen to add "_" at the beginning if the enum
starts with a number.
PiperOrigin-RevId:
254091423
Lei Zhang [Wed, 19 Jun 2019 21:32:07 +0000 (14:32 -0700)]
Print proper message saying variadic ops are not supported in RewriterGen
Support for ops with variadic operands/results will come later; but right now
a proper message helps to avoid deciphering confusing error messages later in
the compilation stage.
PiperOrigin-RevId:
254071820
Lei Zhang [Wed, 19 Jun 2019 21:28:19 +0000 (14:28 -0700)]
Add missing MLIRStandardOps dependency for MLIRGPU
PiperOrigin-RevId:
254070969
River Riddle [Wed, 19 Jun 2019 20:58:31 +0000 (13:58 -0700)]
Refactor the TypeConverter to support more robust type conversions:
* Support for 1->0 type mappings, i.e. when the argument is being removed.
* Reordering types when converting a type signature.
* Adding new inputs when converting a type signature.
This cl also lays down the initial foundation for supporting 1->N type mappings, but full support will come in a followup.
Moving forward, function signature changes will be driven by populating a SignatureConversion instance. This class contains all of the necessary information for adding/removing/remapping function signatures; e.g. addInputs, addResults, remapInputs, etc.
PiperOrigin-RevId:
254064665
River Riddle [Wed, 19 Jun 2019 18:55:27 +0000 (11:55 -0700)]
Extract the function symbol table functionality, i.e. mapping and name uniquing, out of Module and into a new class SymbolTable. As modules become operations it is necessary to extract out this functionality that cannot be represented with a generic operation.
PiperOrigin-RevId:
254041734
Geoffrey Martin-Noble [Wed, 19 Jun 2019 18:30:16 +0000 (11:30 -0700)]
Remove unnecessary -verify-diagnostics
These were likely added in error because of confusion about the flag when it was just called "-verify". The extra flag doesn't cause much harm, but it does make mlir-opt do more work and clutter the RUN line
PiperOrigin-RevId:
254037016