summaryrefslogtreecommitdiffstats
path: root/mlir/test/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* Add a new OpAsmOpInterface to allow for ops to directly hook into the ↵River Riddle2019-11-202-1/+44
| | | | | | | | | | | | | | | | | | | | | | | AsmPrinter. This interface provides more fine-grained hooks into the AsmPrinter than the dialect interface, allowing for operations to define the asm name to use for results directly on the operations themselves. The hook is also expanded to enable defining named result "groups". Get a special name to use when printing the results of this operation. The given callback is invoked with a specific result value that starts a result "pack", and the name to give this result pack. To signal that a result pack should use the default naming scheme, a None can be passed in instead of the name. For example, if you have an operation that has four results and you want to split these into three distinct groups you could do the following: setNameFn(getResult(0), "first_result"); setNameFn(getResult(1), "middle_results"); setNameFn(getResult(3), ""); // use the default numbering. This would print the operation as follows: %first_result, %middle_results:2, %0 = "my.op" ... PiperOrigin-RevId: 281546873
* Fix 'the the' typo.Alexander Belyaev2019-11-201-2/+1
| | | | PiperOrigin-RevId: 281501234
* Add getRemappedValue to ConversionPatternRewriterDiego Caballero2019-11-191-0/+63
| | | | | | | | | | This method is needed for N->1 conversion patterns to retrieve remapped Values used in the original N operations. Closes tensorflow/mlir#237 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/237 from dcaballe:dcaballe/getRemappedValue 1f64fadcf2b203f7b336ff0c5838b116ae3625db PiperOrigin-RevId: 281321881
* Refactor the LowerVectorTransfers pass to use the RewritePattern infra - NFCNicolas Vasilache2019-11-142-0/+45
| | | | | | This is step 1/n in refactoring infrastructure along the Vector dialect to make it ready for retargetability and composable progressive lowering. PiperOrigin-RevId: 280529784
* [ODS] Fix operation argument population to avoid crashLei Zhang2019-11-141-0/+24
| | | | | | | | | | The `Operator` class keeps an `arguments` field, which contains pointers to `operands` and `attributes` elements. Thus it must be populated after `operands` and `attributes` are finalized so to have stable pointers. SmallVector may re-allocate when still having new elements added, which will invalidate pointers. PiperOrigin-RevId: 280466896
* Add FuncOp::eraseArgumentSean Silva2019-11-132-0/+68
| | | | | | | | | | | | This is a quite complex operation that users are likely to attempt to write themselves and get wrong (citation: users=me). Ideally, we could pull this into FunctionLike, but for now, the FunctionType rewriting makes it FuncOp specific. We would need some hook for rewriting the function type (which for LLVM's func op, would need to rewrite the underlying LLVM type). PiperOrigin-RevId: 280234164
* NFC: Refactor block signature conversion to not erase the original arguments.River Riddle2019-11-131-5/+23
| | | | | | This refactors the implementation of block signature(type) conversion to not insert fake cast operations to perform the type conversion, but to instead create a new block containing the proper signature. This has the benefit of enabling the use of pre-computed analyses that rely on mapping values. It also leads to a much cleaner implementation overall. The major user facing change is that applySignatureConversion will now replace the entry block of the region, meaning that blocks generally shouldn't be cached over calls to applySignatureConversion. PiperOrigin-RevId: 280226936
* Add an option to print an operation if a diagnostic is emitted on itRiver Riddle2019-11-122-5/+13
| | | | | | It is often helpful to inspect the operation that the error/warning/remark/etc. originated from, especially in the context of debugging or in the case of a verifier failure. This change adds an option 'mlir-print-op-on-diagnostic' that attaches the operation as a note to any diagnostic that is emitted on it via Operation::emit(Error|Warning|Remark). In the case of an error, the operation is printed in the generic form. PiperOrigin-RevId: 280021438
* Add support for nested symbol references.River Riddle2019-11-111-3/+3
| | | | | | | | | | | | | | | | | | This change allows for adding additional nested references to a SymbolRefAttr to allow for further resolving a symbol if that symbol also defines a SymbolTable. If a referenced symbol also defines a symbol table, a nested reference can be used to refer to a symbol within that table. Nested references are printed after the main reference in the following form: symbol-ref-attribute ::= symbol-ref-id (`::` symbol-ref-id)* Example: module @reference { func @nested_reference() } my_reference_op @reference::@nested_reference Given that SymbolRefAttr is now more general, the existing functionality centered around a single reference is moved to a derived class FlatSymbolRefAttr. Followup commits will add support to lookups, rauw, etc. for scoped references. PiperOrigin-RevId: 279860501
* Add compatible query method to infer type interfaceJacques Pienaar2019-11-073-7/+18
| | | | | | | | A return type that differs from the inferred return type need not indicate that an operation is invalid (e.g., tensor<*xf32> vs tensor<10xf32>) but they should be compatible for the operation to be considered valid. Add method to query if inferred type is compatible with return type. Also add InferTypeOpIntefaceDefault trait that considers equality and compatibility as the same. Currently an op has to opt in to using it explicitly. PiperOrigin-RevId: 279085639
* Add ReferToOp attribute constraint for SymbolRefAttrLei Zhang2019-11-012-0/+12
| | | | | | | This constraint can be used to limit a SymbolRefAttr to point to a specific kind of op in the closest parent with a symbol table. PiperOrigin-RevId: 278001364
* NFC: Use #ifndef in various .td files instead of #ifdef and #elseLei Zhang2019-10-311-2/+1
| | | | | | | | | | Upstream LLVM gained support for #ifndef with https://reviews.llvm.org/D61888 This is changed mechanically via the following command: find . -name "*.td" -exec sed -i -e ':a' -e 'N' -e '$!ba' -e 's/#ifdef \([A-Z_]*\)\n#else/#ifndef \1/g' {} \; PiperOrigin-RevId: 277789427
* Add a test.symbol_scope operation that has the SymbolTable Traits to the ↵Mehdi Amini2019-10-312-0/+11
| | | | | | Test dialect PiperOrigin-RevId: 277741687
* Parse locations in parseGenericOperationSean Silva2019-10-281-1/+5
| | | | | | | | | For ops that recursively re-enter the parser to parse an operation (such as ops with a "wraps" pretty form), this ensures that the wrapped op will parse its location, which can then be used for the locations of the wrapping op and any other implicit ops. PiperOrigin-RevId: 277152636
* Add support for marking an operation as recursively legal.River Riddle2019-10-281-0/+6
| | | | | | | | | | | | | | | | | | | | | In some cases, it may be desirable to mark entire regions of operations as legal. This provides an additional granularity of context to the concept of "legal". The `ConversionTarget` supports marking operations, that were previously added as `Legal` or `Dynamic`, as `recursively` legal. Recursive legality means that if an operation instance is legal, either statically or dynamically, all of the operations nested within are also considered legal. An operation can be marked via `markOpRecursivelyLegal<>`: ```c++ ConversionTarget &target = ...; /// The operation must first be marked as `Legal` or `Dynamic`. target.addLegalOp<MyOp>(...); target.addDynamicallyLegalOp<MySecondOp>(...); /// Mark the operation as always recursively legal. target.markOpRecursivelyLegal<MyOp>(); /// Mark optionally with a callback to allow selective marking. target.markOpRecursivelyLegal<MyOp, MySecondOp>([](Operation *op) { ... }); /// Mark optionally with a callback to allow selective marking. target.markOpRecursivelyLegal<MyOp>([](MyOp op) { ... }); ``` PiperOrigin-RevId: 277086382
* Define AnyRankedTensor Type in TableGenSmit Hinsu2019-10-251-0/+4
| | | | PiperOrigin-RevId: 276714649
* Convert the Canonicalize and CSE passes to generic Operation Passes.River Riddle2019-10-241-5/+0
| | | | | | This allows for them to be used on other non-function, or even other function-like, operations. The algorithms are already generic, so this is simply changing the derived pass type. The majority of this change is just ensuring that the nesting of these passes remains the same, as the pass manager won't auto-nest them anymore. PiperOrigin-RevId: 276573038
* Add support for replacing all uses of a symbol.River Riddle2019-10-241-0/+19
| | | | | | This requires reconstructing the attribute dictionary of each operation containing a use. PiperOrigin-RevId: 276520544
* [DRR] Allow interleaved operands and attributesLei Zhang2019-10-211-0/+22
| | | | | | | | Previously DRR assumes attributes to appear after operands. This was the previous requirements on ODS, but that has changed some time ago. Fix DRR to also support interleaved operands and attributes. PiperOrigin-RevId: 275983485
* Add a Symbol trait to simplify defining operations that represent symbols.River Riddle2019-10-211-2/+2
| | | | | | This trait provides accessors for the name, symbol use list methods, verification, with more to be added. PiperOrigin-RevId: 275864554
* Fix minor spelling tweaks (NFC)Kazuaki Ishizaki2019-10-202-4/+4
| | | | | | Closes tensorflow/mlir#175 PiperOrigin-RevId: 275726876
* Add support for function result attributes.Sean Silva2019-10-182-0/+26
| | | | | | | | | | | | | | | | | | | | | | This allows dialect-specific attributes to be attached to func results. (or more specifically, FunctionLike ops). For example: ``` func @f() -> (i32 {my_dialect.some_attr = 3}) ``` This attaches my_dialect.some_attr with value 3 to the first result of func @f. Another more complex example: ``` func @g() -> (i32, f32 {my_dialect.some_attr = "foo", other_dialect.some_other_attr = [1,2,3]}, i1) ``` Here, the second result has two attributes attached. PiperOrigin-RevId: 275564165
* [DRR] Allow capturing and referencing no-result opsLei Zhang2019-10-172-0/+14
| | | | | | | | | | 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
* Fix RewriterGen to support using NativeCodeCall as auxiliary patternLei Zhang2019-10-172-0/+13
| | | | | | | | | 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
* Add ComplexType to TableGen with Tensor supportRob Suderman2019-10-161-0/+9
| | | | | | | | 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
* Add support for PatternRewriter::eraseOp.River Riddle2019-10-162-4/+4
| | | | | | This hook is useful when an operation is known to be dead, and no replacement values make sense. PiperOrigin-RevId: 275052756
* Allowing replacing non-root operations in DialectConversion.River Riddle2019-10-142-3/+24
| | | | | | 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
* Add support for generating reproducers on pass crash and failure.River Riddle2019-10-101-2/+11
| | | | | | | | | | | | | | | 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
* Add trait for specified shapes matchingGeoffrey Martin-Noble2019-10-101-0/+7
| | | | PiperOrigin-RevId: 274046434
* NFC: Cleanup of type checking testsGeoffrey Martin-Noble2019-10-101-33/+31
| | | | | | | | | 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
* Add test for fix to tablegen for custom folders for ops that return a singleParker Schuh2019-10-092-0/+14
| | | | | | | | | variadic result. Add missing test for single line fix to `void OpEmitter::genFolderDecls()` entitled "Fold away reduction over 0 dimensions." PiperOrigin-RevId: 273880337
* Add ::printAsTextualPipeline to Pass and OpPassManager.MLIR Team2019-10-091-5/+8
| | | | | | | | 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
* NFC: Fully qualify use of std::string.River Riddle2019-10-081-3/+3
| | | | PiperOrigin-RevId: 273668957
* Allow dynamic but ranked types in ops with SameOperandsAndResultShape and ↵Smit Hinsu2019-10-081-0/+6
| | | | | | | | | | 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
* Update the symbol utility methods to handle the case of unknown operations.River Riddle2019-10-081-18/+21
| | | | | | 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
* Add Instance Specific Pass Options.MLIR Team2019-10-082-15/+73
| | | | | | | | | | | | | | | | 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
* Add a PatternRewriter hook for cloning a region into another.River Riddle2019-10-081-2/+6
| | | | | | This is similar to the `inlineRegionBefore` hook, except the original blocks are unchanged. The region to be cloned *must* not have been modified during the conversion process at the point of cloning, i.e. it must belong an operation that has yet to be converted, or the operation that is currently being converted. PiperOrigin-RevId: 273622533
* Add support for walking the uses of a symbol.River Riddle2019-10-083-0/+72
| | | | | | MLIR uses symbol references to model references to many global entities, such as functions/variables/etc. Before this change, there is no way to actually reason about the uses of such entities. This change provides a walker for symbol references(via SymbolTable::walkSymbolUses), as well as 'use_empty' support(via SymbolTable::symbol_use_empty). It also resolves some deficiencies in the LangRef definition of SymbolRefAttr, namely the restrictions on where a SymbolRefAttr can be stored, ArrayAttr and DictionaryAttr, and the relationship with operations containing the SymbolTable trait. PiperOrigin-RevId: 273549331
* Fix CMake build after adding TestOpaqueLoc.cppNicolas Vasilache2019-10-071-0/+1
| | | | PiperOrigin-RevId: 273296399
* Add OpaqueLoc to MLIR locations.MLIR Team2019-10-071-0/+93
| | | | | | | | | See RFC: https://groups.google.com/a/tensorflow.org/forum/#!topic/mlir/xE2IzfhE3Wg. Opaque location stores two pointers, one of them points to some data structure that is external to MLIR, and the other one is unique for each type and represents type id of that data structure. OpaqueLoc also stores an optional location that can be used if the first one is not suitable. OpaqueLoc is managed similar to FileLineColLoc. It is passed around by MLIR transformations and can be used in compound locations like CallSiteLoc. PiperOrigin-RevId: 273266510
* Allow element type traits to operate on scalarsGeoffrey Martin-Noble2019-10-051-4/+4
| | | | | | | | This allows confirming that a scalar argument has the same element type as a shaped one. It's easy to validate a type is shaped on its own if that's desirable, so this shouldn't make that use case harder. This matches the behavior of other traits that operate on element type (e.g. AllElementTypesMatch). Also this makes the code simpler because now we just use getElementTypeOrSelf. Verified that all uses in core already check the type is shaped in another way. PiperOrigin-RevId: 273068507
* NFC: Cleanup test ops and traits testsGeoffrey Martin-Noble2019-10-051-61/+61
| | | | | | | | | 1. Rename a few ops to make it clear they operate on *element* types. 2. Remove unused and generic operand and result ODS names (e.g. $res, $arg, $input). These are just clutter and don't make the op definitions any clearer. 3. Give test cases with duplicate names clearer names. 4. Add missing test case for no operands in SameOperandAndResultElementType. PiperOrigin-RevId: 273067933
* Add missing dependency on the TypeInferOpInterface from the Test dialectMehdi Amini2019-10-041-0/+1
| | | | | | | | | This is fixing a build failure, usually non-deterministic because of parallelism in the build, but could be reliably reproduced: ninja projects/mlir/test/lib/TestDialect/CMakeFiles/MLIRTestDialect.dir/TestPatterns.cpp.o PiperOrigin-RevId: 272998436
* Replace constexpr MemRefType::kDynamicStrideOrOffset by a ↵Nicolas Vasilache2019-10-041-2/+2
| | | | | | | | | | MemRefType:;getDynamicStrideOrOffset() method - NFC This fixes global ODR-use issues, some of which manifest in Parser.cpp. Fixes tensorflow/mlir#167. PiperOrigin-RevId: 272886347
* Add support for inlining calls with different arg/result types from the ↵River Riddle2019-10-032-1/+39
| | | | | | | | callable. Some dialects have implicit conversions inherent in their modeling, meaning that a call may have a different type that the type that the callable expects. To support this, a hook is added to the dialect interface that allows for materializing conversion operations during inlining when there is a mismatch. A hook is also added to the callable interface to allow for introspecting the expected result types. PiperOrigin-RevId: 272814379
* Update the Inliner pass to work on SCCs of the CallGraph.River Riddle2019-10-031-0/+4
| | | | | | This allows for the inliner to work on arbitrary call operations. The updated inliner will also work bottom-up through the callgraph enabling support for multiple levels of inlining. PiperOrigin-RevId: 272813876
* Extract MemRefType::getStridesAndOffset as a free function and fix dynamic ↵Nicolas Vasilache2019-10-021-1/+1
| | | | | | | | offset determination. This also adds coverage with a missing test, which uncovered a bug in the conditional for testing whether an offset is dynamic or not. PiperOrigin-RevId: 272505798
* Unify Linalg types by using strided memrefsNicolas Vasilache2019-10-011-5/+3
| | | | | | | This CL finishes the implementation of the Linalg + Affine type unification of the [strided memref RFC](https://groups.google.com/a/tensorflow.org/forum/#!topic/mlir/MaL8m2nXuio). As a consequence, the !linalg.view type, linalg::DimOp, linalg::LoadOp and linalg::StoreOp can now disappear and Linalg can use standard types everywhere. PiperOrigin-RevId: 272187165
* Add verification error message for ops that require at least one operand or ↵Christian Sigg2019-10-011-5/+5
| | | | | | result. PiperOrigin-RevId: 272153634
* Enable autogenerating OpInterface method declarationsJacques Pienaar2019-09-301-7/+1
| | | | | | | | | | Add DeclareOpInterfaceFunctions to enable specifying whether OpInterfaceMethods for an OpInterface should be generated automatically. This avoids needing to declare the extra methods, while also allowing adding function declaration by way of trait/inheritance. Most of this change is mechanical/extracting classes to be reusable. PiperOrigin-RevId: 272042739
OpenPOWER on IntegriCloud