Lei Zhang [Tue, 11 Jun 2019 12:48:30 +0000 (05:48 -0700)]
[spirv] Add missing CMake rules for enum utility generation
PiperOrigin-RevId:
252601308
Jacques Pienaar [Tue, 11 Jun 2019 05:13:57 +0000 (22:13 -0700)]
Add bool constant attributes.
PiperOrigin-RevId:
252551030
Mehdi Amini [Tue, 11 Jun 2019 04:30:29 +0000 (21:30 -0700)]
Fix MSVC 2019 missing <string> include (NFC)
Fix tensorflow/mlir#31.
PiperOrigin-RevId:
252547010
River Riddle [Tue, 11 Jun 2019 04:15:23 +0000 (21:15 -0700)]
Change a call to FloatAttr::getChecked to FloatAttr::get inside of 'parseFloatAttr'. The invariants of FloatAttr are already checked before construction. This also removes an unnecessary materialization of a mlir::Location which becomes expensive when parsing dense element literals.
PiperOrigin-RevId:
252545776
River Riddle [Tue, 11 Jun 2019 01:37:09 +0000 (18:37 -0700)]
Add a general Operation::verify that verifies an operation instance and the dominance of operations in any nested regions.
PiperOrigin-RevId:
252529850
Lei Zhang [Mon, 10 Jun 2019 22:12:04 +0000 (15:12 -0700)]
[spirv] Add values for enum cases and generate the enum utilities
PiperOrigin-RevId:
252494957
Lei Zhang [Mon, 10 Jun 2019 20:15:52 +0000 (13:15 -0700)]
[spirv] NFC: use two spaces for indentation in gen_spirv_dialect.py
PiperOrigin-RevId:
252469663
Nicolas Vasilache [Mon, 10 Jun 2019 20:12:32 +0000 (13:12 -0700)]
Expose a minimal type parser to dialects.
This CL exposes a parseType method which allows standalone reuse of the MLIR type parsing mechanism. This is a free function for now because the underlying MLIR parser is not guaranteed to receive a StringRef which lives in the proper MemBuffer. This requires building a new MemBuffer/SourceMgr and modifying the Parser constructor to not require an mlir::Module.
The error diagnostic emitted by parseType has context limited to the local string.
For now the dialect has the additional option to emit its own extra error that has the FileLineColLoc context.
In the future, both error messages should be combined into a single error.
PiperOrigin-RevId:
252468911
Lei Zhang [Mon, 10 Jun 2019 19:21:44 +0000 (12:21 -0700)]
[spirv] Add array and run-time array types
PiperOrigin-RevId:
252458108
Lei Zhang [Mon, 10 Jun 2019 18:08:52 +0000 (11:08 -0700)]
[ODG] Address compiler warnings of comparing signed and unsigned integer expressions
PiperOrigin-RevId:
252442613
Andy Davis [Mon, 10 Jun 2019 17:50:08 +0000 (10:50 -0700)]
Return dependence result enum to distiguish between dependence result and error cases (NFC).
PiperOrigin-RevId:
252437616
Lei Zhang [Sun, 9 Jun 2019 14:00:09 +0000 (07:00 -0700)]
[ODS] Support variadic operand/result verification
This CL enables verification code generation for variadic operands and results.
In verify(), we use fallback getter methods to access all the dynamic values
belonging to one static variadic operand/result to reuse the value range
calculation there.
PiperOrigin-RevId:
252288219
Lei Zhang [Sun, 9 Jun 2019 12:50:09 +0000 (05:50 -0700)]
[ODG] Use getODSOperands() and getODSResults() to back accessors
This CL added getODSOperands() and getODSResults() as fallback getter methods for
getting all the dynamic values corresponding to a static operand/result (which
can be variadic). It should provide a uniform way of calculating the value ranges.
All named getter methods are layered on top of these methods now.
PiperOrigin-RevId:
252284270
Lei Zhang [Sat, 8 Jun 2019 15:39:07 +0000 (08:39 -0700)]
[TableGen] Generating enum definitions and utility functions
Enum attributes can be defined using `EnumAttr`, which requires all its cases
to be defined with `EnumAttrCase`. To facilitate the interaction between
`EnumAttr`s and their C++ consumers, add a new EnumsGen TableGen backend
to generate a few common utilities, including an enum class, `llvm::DenseMapInfo`
for the enum class, conversion functions from/to strings.
This is controlled via the `-gen-enum-decls` and `-gen-enum-defs` command-line
options of `mlir-tblgen`.
PiperOrigin-RevId:
252209623
MLIR Team [Fri, 7 Jun 2019 20:44:09 +0000 (13:44 -0700)]
Update function comment, since we added FP16 support for getZeroAttr.
PiperOrigin-RevId:
252110998
River Riddle [Fri, 7 Jun 2019 19:08:36 +0000 (12:08 -0700)]
NFC: Cleanup the grouping of DenseElementsAttr 'get' methods, and move the bit write/read functions to static functions in Attributes.cpp.
PiperOrigin-RevId:
252094145
River Riddle [Fri, 7 Jun 2019 16:57:29 +0000 (09:57 -0700)]
Remove the ability to directly construct a DenseElementsAttr with a raw character buffer. This made assumptions about how DenseElementsAttr structured its internal storage, which may change in the future. To replace the existing use cases, a few utility methods have been added:
* 'get' methods that allow constructing from an ArrayRef of integer or floating point values.
* A 'reshape' method to allow for changing the shape without changing the underlying data.
PiperOrigin-RevId:
252067898
River Riddle [Fri, 7 Jun 2019 16:46:13 +0000 (09:46 -0700)]
NFC: Cleanup FuncVerifier and refactor it into a general OperationVerifier. The function specific verification has been moved into Function::verify. This is in preparation for adding a general Operation::verify method.
PiperOrigin-RevId:
252065646
Geoffrey Martin-Noble [Fri, 7 Jun 2019 12:30:35 +0000 (05:30 -0700)]
Remove unnecessary StandardOps dependency
PiperOrigin-RevId:
252032386
Mehdi Amini [Fri, 7 Jun 2019 04:50:13 +0000 (21:50 -0700)]
Add a convenient getDialect() accessor on Op<> class
PiperOrigin-RevId:
251988464
River Riddle [Fri, 7 Jun 2019 04:39:36 +0000 (21:39 -0700)]
NFC: Replace typelist_contains with llvm::is_one_of. This should also fix weird build failures on MSVC related to typelist_contains for missing template arguments.
PiperOrigin-RevId:
251987621
Jacques Pienaar [Fri, 7 Jun 2019 02:53:49 +0000 (19:53 -0700)]
Add free standing getElementTypeOrSelf member.
This function returns the element type of the underlying type or the input type itself. This removes some of the casting and code from ODS and into C++ code.
I've not converted all the call sites (as this requires a new include and target) and wanted to run it past folks first.
PiperOrigin-RevId:
251978156
Mehdi Amini [Fri, 7 Jun 2019 01:52:29 +0000 (18:52 -0700)]
Internal change
PiperOrigin-RevId:
251972430
MLIR Team [Thu, 6 Jun 2019 23:42:36 +0000 (16:42 -0700)]
Add the getDialectNamespace static utility method to the Linalg dialect.
PiperOrigin-RevId:
251953766
River Riddle [Thu, 6 Jun 2019 23:15:42 +0000 (16:15 -0700)]
Remove the explicit attribute kinds for DenseIntElementsAttr and DenseFPElementsAttr in favor of just one DenseElementsAttr. Now that attribute has the ability to define 'classof(Attribute attr)' methods, these derived classes can just be specializations of the main attribute class.
PiperOrigin-RevId:
251948820
Ben Vanik [Thu, 6 Jun 2019 22:58:47 +0000 (15:58 -0700)]
Adding utility to parse optional colon-type-lists.
PiperOrigin-RevId:
251945512
River Riddle [Thu, 6 Jun 2019 22:55:17 +0000 (15:55 -0700)]
Simplify DenseElementsAttr by rounding up the storage of odd bit widths to 8-bits. This removes the requirement that the underlying buffer be aligned to 64 bits which opens the door for several optimizations in the future, e.g. detecting splat.
PiperOrigin-RevId:
251944922
River Riddle [Thu, 6 Jun 2019 22:48:14 +0000 (15:48 -0700)]
Add support to ConversionTarget for storing legalization actions for entire dialects as opposed to individual operations. This allows for better support of unregistered operations, as well as removing the need to collect all of the operations for a given dialect(which may be very expensive).
PiperOrigin-RevId:
251943590
River Riddle [Thu, 6 Jun 2019 22:38:08 +0000 (15:38 -0700)]
Add support for matchAndRewrite to the DialectConversion patterns. This also drops the default "always succeed" match override to better align with RewritePattern.
PiperOrigin-RevId:
251941625
River Riddle [Thu, 6 Jun 2019 21:28:13 +0000 (14:28 -0700)]
Add a general operation property 'IsolatedFromAbove' that guarantees that all regions of a given operation are explicit capture only and will not reference values defined above the enclosing operation. This trait will be useful for applying some of the properties currently attached to Functions to operations, e.g. verifying dominance within a specific operation, enabling multi-threading of certain transformations between different instances, etc.
PiperOrigin-RevId:
251927466
River Riddle [Thu, 6 Jun 2019 18:54:14 +0000 (11:54 -0700)]
Support constructing DominanceInfo with an Operation. This computes the dominance information for any nested regions within the operation.
PiperOrigin-RevId:
251896520
MLIR Team [Thu, 6 Jun 2019 05:02:22 +0000 (22:02 -0700)]
Support FP16 in getZeroAttr.
PiperOrigin-RevId:
251783931
River Riddle [Thu, 6 Jun 2019 01:12:16 +0000 (18:12 -0700)]
Add a verify method to FuncOp and check that the type signature matches the signature of the entry block.
PiperOrigin-RevId:
251759848
River Riddle [Thu, 6 Jun 2019 00:04:37 +0000 (17:04 -0700)]
NFC: Rename FunctionParser to OperationParser. There is nothing specific to functions about this parser and provides general parser support for operations, and regions of operations.
PiperOrigin-RevId:
251749622
MLIR Team [Wed, 5 Jun 2019 21:57:20 +0000 (14:57 -0700)]
Minor change to Linalg Tablegen file to not include OpBase.td if already included by another include
PiperOrigin-RevId:
251725376
River Riddle [Wed, 5 Jun 2019 21:49:52 +0000 (14:49 -0700)]
NFC: Cleanup the definitions of OpAsmParser and CustomOpAsmParser by adding comments, grouping similar functionality, and adding header blocks.
PiperOrigin-RevId:
251723883
River Riddle [Wed, 5 Jun 2019 21:15:05 +0000 (14:15 -0700)]
Add utility 'create' methods to OperationFolder that will create an operation with a given OpBuilder and automatically try to fold it, similarly to OpBuilder::createOrFold. The difference here is that these methods enable folding to constants in addition to existing values. This functionality is then used to replace linalg::FunctionConstants.
PiperOrigin-RevId:
251716247
River Riddle [Wed, 5 Jun 2019 20:59:28 +0000 (13:59 -0700)]
NFC: Rename FunctionParser::builder to opBuilder. This allows for removing the clang specific pragmas for ignoring field shadowing warnings.
PiperOrigin-RevId:
251712823
River Riddle [Wed, 5 Jun 2019 20:56:01 +0000 (13:56 -0700)]
Fix a warning for missing parentheses around '||' inside of an assert.
PiperOrigin-RevId:
251712106
River Riddle [Wed, 5 Jun 2019 18:57:37 +0000 (11:57 -0700)]
NFC: Cleanup FunctionParser by removing dead methods, adding header blocks, and grouping related pieces of functionality.
PiperOrigin-RevId:
251688578
MLIR Team [Wed, 5 Jun 2019 18:24:19 +0000 (11:24 -0700)]
Fix a typo in error message.
PiperOrigin-RevId:
251681475
River Riddle [Wed, 5 Jun 2019 17:50:10 +0000 (10:50 -0700)]
Add new 'createOrFold' methods to FuncBuilder to immediately try to fold an operation after creating it. This can be used to remove operations that are likely to be trivially folded later. Note, these functions only fold operations if all of the folded results are existing values.
PiperOrigin-RevId:
251674299
River Riddle [Wed, 5 Jun 2019 17:08:47 +0000 (10:08 -0700)]
Always remap results when replacing an operation. This prevents a crash when lowering identity(passthrough) operations to the same resultant type as the original operation.
PiperOrigin-RevId:
251665492
River Riddle [Wed, 5 Jun 2019 16:36:32 +0000 (09:36 -0700)]
When cleaning up after a failed legalization pattern, make sure to remove any newly created value mappings.
PiperOrigin-RevId:
251658984
River Riddle [Wed, 5 Jun 2019 06:33:18 +0000 (23:33 -0700)]
Add a few utility overloads for OpAsmParser methods:
* Add a getCurrentLocation that returns the location directly.
* Add parseOperandList/parseTrailingOperandList overloads without the required operand count.
PiperOrigin-RevId:
251585488
Jacques Pienaar [Wed, 5 Jun 2019 02:31:30 +0000 (19:31 -0700)]
ODG: Always deference operand/result when using named arg/result.
Considered adding more placeholders to designate types in the replacement pattern, but convinced for now sticking to simpler approach. This should at least enable specifying constraints across operands/results/attributes and we can start getting rid of the special cases.
PiperOrigin-RevId:
251564893
River Riddle [Wed, 5 Jun 2019 02:18:23 +0000 (19:18 -0700)]
NFC: Rename FuncBuilder to OpBuilder and refactor to take a top level region instead of a function.
PiperOrigin-RevId:
251563898
River Riddle [Tue, 4 Jun 2019 21:12:40 +0000 (14:12 -0700)]
Add support to AffineApplyOp::fold for folding dim and symbol expression results.
PiperOrigin-RevId:
251512700
Lei Zhang [Tue, 4 Jun 2019 21:03:30 +0000 (14:03 -0700)]
[spirv] Basic validity of SPV_ModuleOp
This CL adds SPV_ModuleEndOp for terminating the only block inside a
SPV_ModuleOp's only region. Verification now enforces a spv.module only
contains func or spv.* ops and no external or nested functions are
present. Because of the structural requirement of a block, spv.Return
is also added in this CL.
PiperOrigin-RevId:
251510706
River Riddle [Tue, 4 Jun 2019 19:14:43 +0000 (12:14 -0700)]
Add a utility function to Op that allows for checking if an operation has a specific trait.
PiperOrigin-RevId:
251489498
River Riddle [Tue, 4 Jun 2019 18:56:43 +0000 (11:56 -0700)]
NFC: Rename FoldHelper to OperationFolder and split a large function in two.
PiperOrigin-RevId:
251485843
Ben Vanik [Tue, 4 Jun 2019 18:35:21 +0000 (11:35 -0700)]
Adding additional dialect parsing utilities, conversion wrappers, and traversal helpers.
- added a typed walk to Block (matching the equivalent on Function)
- added token parsers (incl optional variants) for : and (
- added applyConversionPatterns that takes a list of functions to apply patterns to
PiperOrigin-RevId:
251481608
River Riddle [Tue, 4 Jun 2019 18:21:11 +0000 (11:21 -0700)]
Make it explicit that the IR printing instrumentation should not be used when multi-threading is enabled.
PiperOrigin-RevId:
251478399
River Riddle [Tue, 4 Jun 2019 18:01:32 +0000 (11:01 -0700)]
Add support to FuncOp for managing argument attributes. The syntax for argument attributes is the same as Function:
func @foo(i1 {dialect.attr: 10 : i64})
func @foo(%arg0: i1 {dialect.attr: 10 : i64}) {
return
}
PiperOrigin-RevId:
251473338
Lei Zhang [Tue, 4 Jun 2019 12:03:42 +0000 (05:03 -0700)]
[ODG] Add iterators for results in Operator
PiperOrigin-RevId:
251417085
Stephan Herhut [Tue, 4 Jun 2019 07:58:19 +0000 (00:58 -0700)]
Align NVVM operation names with names from GPU dialect.
Currently, we use different names for block and grid dimensions in the GPU vs. NVVM dialect, which is confusing. With this change, the NVVM names match the ones from the GPU dialect. The NVVM intrinsics use different names anyway, so it does not add new confusion.
PiperOrigin-RevId:
251389281
River Riddle [Mon, 3 Jun 2019 23:32:25 +0000 (16:32 -0700)]
Add a utility function to OperationName for extracting the dialect name.
PiperOrigin-RevId:
251333376
Lei Zhang [Mon, 3 Jun 2019 21:52:56 +0000 (14:52 -0700)]
[ODS] Add support for TypeArrayAttr
PiperOrigin-RevId:
251314203
Geoffrey Martin-Noble [Mon, 3 Jun 2019 21:19:04 +0000 (14:19 -0700)]
Replace comments referring to "vector or tensor" with "shaped" where appropriate
PiperOrigin-RevId:
251306752
Geoffrey Martin-Noble [Mon, 3 Jun 2019 20:07:51 +0000 (13:07 -0700)]
Make MemRefOf tablegen type subclass ShapedContainerType
Possible now because MemRef subclasses ShapedType
PiperOrigin-RevId:
251292951
River Riddle [Mon, 3 Jun 2019 19:49:55 +0000 (12:49 -0700)]
Refactor the dialect conversion framework to support multi-level conversions. Multi-level conversions are those that require multiple patterns to be applied before an operation is completely legalized. This essentially means that conversion patterns do not have to directly generate legal operations, and may be chained together to produce legal code.
To accomplish this, moving forward users will need to provide a legalization target that defines what operations are legal for the conversion. A target can mark an operation as legal by providing a specific legalization action. The initial actions are:
* Legal
- This action signals that every instance of the given operation is legal,
i.e. any combination of attributes, operands, types, etc. is valid.
* Dynamic
- This action signals that only some instances of a given operation are legal. This
allows for defining fine-tune constraints, like say std.add is only legal when
operating on 32-bit integers.
An example target is shown below:
struct MyTarget : public ConversionTarget {
MyTarget(MLIRContext &ctx) : ConversionTarget(ctx) {
// All operations in the LLVM dialect are legal.
addLegalDialect<LLVMDialect>();
// std.constant op is always legal on this target.
addLegalOp<ConstantOp>();
// std.return op has dynamic legality constraints.
addDynamicallyLegalOp<ReturnOp>();
}
/// Implement the custom legalization handler to handle
/// std.return.
bool isLegal(Operation *op) override {
// Process the dynamic handling for a std.return op (and any others that were
// marked "dynamic").
...
}
};
PiperOrigin-RevId:
251289374
Lei Zhang [Mon, 3 Jun 2019 19:38:22 +0000 (12:38 -0700)]
Support type casting Type to itself
PiperOrigin-RevId:
251287045
River Riddle [Mon, 3 Jun 2019 19:08:22 +0000 (12:08 -0700)]
Start defining a new operation 'FuncOp' that replicates all of the functionality of 'Function', but with an operation. The pretty syntax for the operation is exactly the same as that of Function. This operation is currently builtin, but should hopefully be moved to a different dialect when it has been completely decoupled from IR/. This is the first patch in a large series that refactors Functions to be represented as operations.
PiperOrigin-RevId:
251281612
Jacques Pienaar [Mon, 3 Jun 2019 18:09:02 +0000 (11:09 -0700)]
Add Windows build instructions.
PiperOrigin-RevId:
251269521
Alex Zinenko [Mon, 3 Jun 2019 17:00:16 +0000 (10:00 -0700)]
SDBM: fix the order of variables in the stripe-induced inequalities
The initial implementation of SDBM mistakenly swapped the order of variables in
the inequalities induced by a stripe equality: y = x # B actually implies
y - x <= 0 and x - y <= B - 1 rather than x - y <= 0 and y - x <= B - 1 as
implemented. Textual comments in the test files were correct but did not
correspond to the emitted IR. Round-tripping between SDBM and expression lists
was not affected because the wrong order was used in both directions of the
conversion. Use the correct order.
PiperOrigin-RevId:
251252980
River Riddle [Mon, 3 Jun 2019 16:43:22 +0000 (09:43 -0700)]
Restructure the parser to support nested name scopes. This allows for regions at the same level of nesting to have values with the same SSA name. This is a necessary step for representing functions as operations.
The following is now valid IR:
foo.op ... {
%val = ...
}, {
%val = ...
}
PiperOrigin-RevId:
251249875
Alex Zinenko [Mon, 3 Jun 2019 15:03:20 +0000 (08:03 -0700)]
Introduce OpOperandAdaptors and emit them from ODS
When manipulating generic operations, such as in dialect conversion /
rewriting, it is often necessary to view a list of Values as operands to an
operation without creating the operation itself. The absence of such view
makes dialect conversion patterns, among others, to use magic numbers to obtain
specific operands from a list of rewritten values when converting an operation.
Introduce XOpOperandAdaptor classes that wrap an ArrayRef<Value *> and provide
accessor functions identical to those available in XOp. This makes it possible
for conversions to use these adaptors to address the operands with names rather
than rely on their position in the list. The adaptors are generated from ODS
together with the actual operation definitions.
This is another step towards making dialect conversion patterns specific for a
given operation.
Illustrate the approach on conversion patterns in the standard to LLVM dialect
conversion.
PiperOrigin-RevId:
251232899
River Riddle [Mon, 3 Jun 2019 14:03:54 +0000 (07:03 -0700)]
Cleanup the Linalg trait ViewRanks.
* Fix a miscompile on older clang versions when initializing an ArrayRef with an unsigned variadic template argument.
* Update the errors to use the streaming interface instead of Twine.
PiperOrigin-RevId:
251223929
River Riddle [Mon, 3 Jun 2019 03:33:29 +0000 (20:33 -0700)]
NFC: Split up Parser::parseAttribute into multiple smaller functions to improve readability.
PiperOrigin-RevId:
251158192
Jacques Pienaar [Sat, 1 Jun 2019 17:10:24 +0000 (10:10 -0700)]
Allow constant of unit type.
--
PiperOrigin-RevId:
251053682
Jacques Pienaar [Sat, 1 Jun 2019 15:37:50 +0000 (08:37 -0700)]
Avoid failure due to incomplete type specification.
--
PiperOrigin-RevId:
251048081
Lei Zhang [Sat, 1 Jun 2019 13:34:18 +0000 (06:34 -0700)]
[spirv] Add a script to update SPIRVBase.td with new enum attributes
This script parses the SPIR-V JSON grammar to extract operand kinds that
are enums and generate TableGen definitions for them.
Also added a shell script to point to the correct relative file location
to simplify command invocation.
--
PiperOrigin-RevId:
251041084
Mehdi Amini [Sat, 1 Jun 2019 02:52:18 +0000 (19:52 -0700)]
Move NamedAttributeList::get() method out-of-line (fix CMake build due to missing include)
--
PiperOrigin-RevId:
251000296
Geoffrey Martin-Noble [Sat, 1 Jun 2019 00:19:24 +0000 (17:19 -0700)]
Use size_t for tuple type size
This is more consistent with standard containers.
--
PiperOrigin-RevId:
250985851
Geoffrey Martin-Noble [Sat, 1 Jun 2019 00:18:59 +0000 (17:18 -0700)]
Consistently use int64_t for shape-related values in shaped types
We want to support 64-bit shapes (even when the compiler is on a 32-bit architecture). Using int64_t consistently allows us to sidestep the bugginess of unsigned arithmetic.
Still unsigned: kind, memory space, and bit width. The first two are basically enums. We could have a discussion about the last one, but it's basically just a very large enum as well and we're not doing any math on it, I think.
--
PiperOrigin-RevId:
250985791
Geoffrey Martin-Noble [Fri, 31 May 2019 23:41:21 +0000 (16:41 -0700)]
Static cast size_t -> int64_t instead of vice versa for equals comparisons
These were just introduced by a previous CL moving MemRef getRank to return int64_t. size_t could be smaller than 64 bits and in equals comparisons, signed vs unsigned doesn't matter. In these cases, we know right now that the particular int64_t is not larger than max size_t (because it currently comes directly from a size() call), the alternative cast plus equals comparison is always safe, so we might as well do it that way and no longer require reasoning deeper into the callstack.
We are already assuming that size() calls fit into int64_t in a number of other cases like the aforementioned getRank() (since exabytes of RAM are rare). If we want to avoid this assumption we will have to come up with a principled way to do it throughout.
--
PiperOrigin-RevId:
250980297
River Riddle [Fri, 31 May 2019 23:03:26 +0000 (16:03 -0700)]
Add support for providing an output stream to the SourceMgrDiagnosticHandlers.
--
PiperOrigin-RevId:
250974331
Amit Sabne [Fri, 31 May 2019 20:56:47 +0000 (13:56 -0700)]
Loop invariant code motion - remove reliance on getForwardSlice. Add more tests.
--
PiperOrigin-RevId:
250950703
River Riddle [Fri, 31 May 2019 20:48:43 +0000 (13:48 -0700)]
NFC: Cleanup method definitions within Parser and add header blocks to improve readability.
--
PiperOrigin-RevId:
250949195
Mehdi Amini [Fri, 31 May 2019 20:46:23 +0000 (13:46 -0700)]
Fix CMake builds: sources not used in every targets must be marked with LLVM_OPTIONAL_SOURCES
--
PiperOrigin-RevId:
250948796
Geoffrey Martin-Noble [Fri, 31 May 2019 20:28:37 +0000 (13:28 -0700)]
Get rid of separate getRank() on MemRef now that it subclasses ShapedType
We are moving towards int64_t for these shape/dimension -related values to avoid buginess with unsigned arithmetic
--
PiperOrigin-RevId:
250945322
Geoffrey Martin-Noble [Fri, 31 May 2019 20:28:19 +0000 (13:28 -0700)]
Some cleanup of ShapedType now that MemRef subclasses it.
Extract common methods into ShapedType.
Simplify methods.
Remove some extraneous asserts.
Replace sentinel value with a helper method to check the same.
--
PiperOrigin-RevId:
250945261
Geoffrey Martin-Noble [Fri, 31 May 2019 20:28:01 +0000 (13:28 -0700)]
Make MemRefType subclass ShapedType
MemRefs have the same notion of shape, rank, and fixed element type. This allows us to reuse utilities based on shape for memref.
All dyn_cast and isa calls for ShapedType have been checked and either modified to explicitly check for vector or tensor, or confirmed to not depend on the result being a vector or tensor.
Discussion in https://groups.google.com/a/tensorflow.org/forum/#!topic/mlir/cHLoyfGu8y8
--
PiperOrigin-RevId:
250945184
Geoffrey Martin-Noble [Fri, 31 May 2019 20:01:45 +0000 (13:01 -0700)]
Don't use ShapedType to indicate vector or tensor type
MemRefType may soon subclass ShapedType. ShapedType only guarantees that something has a shape (possibly dynamic), rank (or explicitly unranked), and fixed element type.
--
PiperOrigin-RevId:
250940537
River Riddle [Fri, 31 May 2019 19:53:22 +0000 (12:53 -0700)]
Fix an msan warning for use of an uninitialized variable.
--
PiperOrigin-RevId:
250939301
River Riddle [Fri, 31 May 2019 16:27:52 +0000 (09:27 -0700)]
Remove the newline from the mlir-opt 'split-input-file' flag marker. This fixes support for DOS style new lines(/r/n).
--
PiperOrigin-RevId:
250899420
River Riddle [Fri, 31 May 2019 16:24:48 +0000 (09:24 -0700)]
Abstract the internal storage of the NamedAttributeList into a new attribute, DictionaryAttr. This attribute maintains a sorted list of NamedAttributes. This will allow for operations/functions to maintain sub dictionaries of attributes.
The syntax is the same as top level attribute dictionaries:
{sub_dictionary: {fn: @someFn, boolAttr: true}}
--
PiperOrigin-RevId:
250898950
Jacques Pienaar [Fri, 31 May 2019 01:42:16 +0000 (18:42 -0700)]
Disable named attribute in ODG for ArgOrResultElementTypeIs as was taking address of r-value.
--
PiperOrigin-RevId:
250805965
Lei Zhang [Thu, 30 May 2019 23:50:16 +0000 (16:50 -0700)]
[ODS] Support region names and constraints
Similar to arguments and results, now we require region definition in ops to
be specified as a DAG expression with the 'region' operator. This way we can
specify the constraints for each region and optionally give the region a name.
Two kinds of region constraints are added, one allowing any region, and the
other requires a certain number of blocks.
--
PiperOrigin-RevId:
250790211
Geoffrey Martin-Noble [Thu, 30 May 2019 23:02:49 +0000 (16:02 -0700)]
Replace checks against numDynamicDims with hasStaticShape
--
PiperOrigin-RevId:
250782165
River Riddle [Thu, 30 May 2019 21:58:28 +0000 (14:58 -0700)]
Replace a usage of std::vector with SmallVector to allow constructing with non-constant iterators on MSVC.
--
PiperOrigin-RevId:
250769027
Geoffrey Martin-Noble [Thu, 30 May 2019 18:01:17 +0000 (11:01 -0700)]
Make getRank abort for unranked type
This better matches the other methods in ShapedType which only make sense for ranked types. There's now an explicit hasRank for checking the rank. Actual call sites rarely used the "-1" sentinel to combine checking for rankedness and checking that rank is a certain value. And in most cases they should actually be checking for rankedness at a higher level using type predicates. Using an explicit method is clearer than a sentinel anyway.
--
PiperOrigin-RevId:
250720853
Jacques Pienaar [Thu, 30 May 2019 17:57:23 +0000 (10:57 -0700)]
Allow argument and result names replacement in predicates.
This allow specifying $x to refer to an operand's named argument (operand or attribute) or result. Skip variadic operands/results for now pending autogenerated discussion of their accessors.
This adds a new predicate, following feedback on the naming but does not remove the old one. Post feedback I'll do that, potentially in follow up.
--
PiperOrigin-RevId:
250720003
Jacques Pienaar [Thu, 30 May 2019 17:02:57 +0000 (10:02 -0700)]
Avoid unspecified files error by explicitly including for now.
--
PiperOrigin-RevId:
250708336
Jacques Pienaar [Thu, 30 May 2019 16:42:17 +0000 (09:42 -0700)]
Add keywords in target_link_libraries post add_llvm_executable.
--
PiperOrigin-RevId:
250704528
River Riddle [Thu, 30 May 2019 15:23:49 +0000 (08:23 -0700)]
Replace usages of 'add_executable' with 'add_llvm_executable'.
--
PiperOrigin-RevId:
250691487
Jacques Pienaar [Thu, 30 May 2019 04:15:43 +0000 (21:15 -0700)]
Fix 5 ClangTidy - Readability findings.
* the 'empty' method should be used to check for emptiness instead of 'size'
* using decl 'CapturableHandle' is unused
* redundant get() call on smart pointer
* using decl 'apply' is unused
* using decl 'ScopeGuard' is unused
--
PiperOrigin-RevId:
250623863
River Riddle [Thu, 30 May 2019 03:31:12 +0000 (20:31 -0700)]
NFC: Inline toString as operations can be streamed directly into raw_ostream.
--
PiperOrigin-RevId:
250619765
Geoffrey Martin-Noble [Thu, 30 May 2019 00:15:51 +0000 (17:15 -0700)]
Use hasRank instead of comparing rank to -1
--
PiperOrigin-RevId:
250598252
River Riddle [Wed, 29 May 2019 23:46:17 +0000 (16:46 -0700)]
Move CondBranchOp to the ODG framework.
--
PiperOrigin-RevId:
250593367