summaryrefslogtreecommitdiffstats
path: root/mlir
Commit message (Collapse)AuthorAgeFilesLines
...
* Add a convenient getDialect() accessor on Op<> classMehdi Amini2019-06-091-0/+3
| | | | PiperOrigin-RevId: 251988464
* NFC: Replace typelist_contains with llvm::is_one_of. This should also fix ↵River Riddle2019-06-091-16/+4
| | | | | | weird build failures on MSVC related to typelist_contains for missing template arguments. PiperOrigin-RevId: 251987621
* Add free standing getElementTypeOrSelf member.Jacques Pienaar2019-06-099-20/+121
| | | | | | | | 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
* Internal changeMehdi Amini2019-06-091-0/+1
| | | | PiperOrigin-RevId: 251972430
* Add the getDialectNamespace static utility method to the Linalg dialect.MLIR Team2019-06-092-1/+2
| | | | PiperOrigin-RevId: 251953766
* Remove the explicit attribute kinds for DenseIntElementsAttr and ↵River Riddle2019-06-095-63/+44
| | | | | | 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
* Adding utility to parse optional colon-type-lists.Ben Vanik2019-06-092-0/+14
| | | | PiperOrigin-RevId: 251945512
* Simplify DenseElementsAttr by rounding up the storage of odd bit widths to ↵River Riddle2019-06-093-64/+59
| | | | | | 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
* Add support to ConversionTarget for storing legalization actions for entire ↵River Riddle2019-06-092-69/+44
| | | | | | 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
* Add support for matchAndRewrite to the DialectConversion patterns. This also ↵River Riddle2019-06-098-93/+133
| | | | | | drops the default "always succeed" match override to better align with RewritePattern. PiperOrigin-RevId: 251941625
* Add a general operation property 'IsolatedFromAbove' that guarantees that ↵River Riddle2019-06-097-11/+44
| | | | | | 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
* Support constructing DominanceInfo with an Operation. This computes the ↵River Riddle2019-06-092-2/+23
| | | | | | dominance information for any nested regions within the operation. PiperOrigin-RevId: 251896520
* Support FP16 in getZeroAttr.MLIR Team2019-06-092-0/+7
| | | | PiperOrigin-RevId: 251783931
* Add a verify method to FuncOp and check that the type signature matches the ↵River Riddle2019-06-093-1/+47
| | | | | | signature of the entry block. PiperOrigin-RevId: 251759848
* NFC: Rename FunctionParser to OperationParser. There is nothing specific to ↵River Riddle2019-06-091-46/+47
| | | | | | functions about this parser and provides general parser support for operations, and regions of operations. PiperOrigin-RevId: 251749622
* Minor change to Linalg Tablegen file to not include OpBase.td if already ↵MLIR Team2019-06-091-0/+3
| | | | | | included by another include PiperOrigin-RevId: 251725376
* NFC: Cleanup the definitions of OpAsmParser and CustomOpAsmParser by adding ↵River Riddle2019-06-092-210/+269
| | | | | | comments, grouping similar functionality, and adding header blocks. PiperOrigin-RevId: 251723883
* Add utility 'create' methods to OperationFolder that will create an ↵River Riddle2019-06-096-54/+78
| | | | | | 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
* NFC: Rename FunctionParser::builder to opBuilder. This allows for removing ↵River Riddle2019-06-091-13/+9
| | | | | | the clang specific pragmas for ignoring field shadowing warnings. PiperOrigin-RevId: 251712823
* Fix a warning for missing parentheses around '||' inside of an assert.River Riddle2019-06-091-3/+3
| | | | PiperOrigin-RevId: 251712106
* NFC: Cleanup FunctionParser by removing dead methods, adding header blocks, ↵River Riddle2019-06-091-429/+445
| | | | | | and grouping related pieces of functionality. PiperOrigin-RevId: 251688578
* Fix a typo in error message.MLIR Team2019-06-091-1/+2
| | | | PiperOrigin-RevId: 251681475
* Add new 'createOrFold' methods to FuncBuilder to immediately try to fold an ↵River Riddle2019-06-095-24/+72
| | | | | | 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
* Always remap results when replacing an operation. This prevents a crash when ↵River Riddle2019-06-091-4/+7
| | | | | | lowering identity(passthrough) operations to the same resultant type as the original operation. PiperOrigin-RevId: 251665492
* When cleaning up after a failed legalization pattern, make sure to remove ↵River Riddle2019-06-091-11/+42
| | | | | | any newly created value mappings. PiperOrigin-RevId: 251658984
* Add a few utility overloads for OpAsmParser methods:River Riddle2019-06-0910-59/+53
| | | | | | | * Add a getCurrentLocation that returns the location directly. * Add parseOperandList/parseTrailingOperandList overloads without the required operand count. PiperOrigin-RevId: 251585488
* ODG: Always deference operand/result when using named arg/result.Jacques Pienaar2019-06-094-14/+14
| | | | | | 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
* NFC: Rename FuncBuilder to OpBuilder and refactor to take a top level region ↵River Riddle2019-06-0970-229/+249
| | | | | | instead of a function. PiperOrigin-RevId: 251563898
* Add support to AffineApplyOp::fold for folding dim and symbol expression ↵River Riddle2019-06-095-47/+42
| | | | | | results. PiperOrigin-RevId: 251512700
* [spirv] Basic validity of SPV_ModuleOpLei Zhang2019-06-095-1/+276
| | | | | | | | | | 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
* Add a utility function to Op that allows for checking if an operation has a ↵River Riddle2019-06-091-0/+7
| | | | | | specific trait. PiperOrigin-RevId: 251489498
* NFC: Rename FoldHelper to OperationFolder and split a large function in two.River Riddle2019-06-094-38/+64
| | | | PiperOrigin-RevId: 251485843
* Adding additional dialect parsing utilities, conversion wrappers, and ↵Ben Vanik2019-06-095-13/+67
| | | | | | | | | | 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
* Make it explicit that the IR printing instrumentation should not be used ↵River Riddle2019-06-091-3/+6
| | | | | | when multi-threading is enabled. PiperOrigin-RevId: 251478399
* Add support to FuncOp for managing argument attributes. The syntax for ↵River Riddle2019-06-095-21/+187
| | | | | | | | | | | | 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
* [ODG] Add iterators for results in OperatorLei Zhang2019-06-092-7/+23
| | | | PiperOrigin-RevId: 251417085
* Align NVVM operation names with names from GPU dialect.Stephan Herhut2019-06-091-6/+6
| | | | | | 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
* Add a utility function to OperationName for extracting the dialect name.River Riddle2019-06-033-17/+15
| | | | PiperOrigin-RevId: 251333376
* [ODS] Add support for TypeArrayAttrLei Zhang2019-06-033-15/+45
| | | | PiperOrigin-RevId: 251314203
* Replace comments referring to "vector or tensor" with "shaped" where appropriateGeoffrey Martin-Noble2019-06-033-8/+8
| | | | PiperOrigin-RevId: 251306752
* Make MemRefOf tablegen type subclass ShapedContainerTypeGeoffrey Martin-Noble2019-06-031-3/+1
| | | | | | Possible now because MemRef subclasses ShapedType PiperOrigin-RevId: 251292951
* Refactor the dialect conversion framework to support multi-level ↵River Riddle2019-06-038-37/+374
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Support type casting Type to itselfLei Zhang2019-06-031-0/+3
| | | | PiperOrigin-RevId: 251287045
* Start defining a new operation 'FuncOp' that replicates all of the ↵River Riddle2019-06-038-19/+401
| | | | | | 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
* Add Windows build instructions.Jacques Pienaar2019-06-031-1/+15
| | | | PiperOrigin-RevId: 251269521
* SDBM: fix the order of variables in the stripe-induced inequalitiesAlex Zinenko2019-06-032-29/+54
| | | | | | | | | | | | 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
* Restructure the parser to support nested name scopes. This allows for ↵River Riddle2019-06-033-97/+145
| | | | | | | | | | | | | 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
* Introduce OpOperandAdaptors and emit them from ODSAlex Zinenko2019-06-039-83/+313
| | | | | | | | | | | | | | | | | | | | | 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
* Cleanup the Linalg trait ViewRanks.River Riddle2019-06-031-7/+7
| | | | | | | * 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
* NFC: Split up Parser::parseAttribute into multiple smaller functions to ↵River Riddle2019-06-031-286/+283
| | | | | | improve readability. PiperOrigin-RevId: 251158192
OpenPOWER on IntegriCloud