summaryrefslogtreecommitdiffstats
path: root/mlir/test/lib/TestDialect
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* 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
* 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
* Add InferTypeOpTrait & enable generating its member function definitionJacques Pienaar2019-09-294-2/+60
| | | | | | | | | | Use OpInterfaces to add an interface for ops defining a return type function. This change does not use this trait in any meaningful way, I'll use it in a follow up to generalize and unify some of the op type traits/constraints. Also, currently the infer type function can only be manually specified in C++, that should rather be the fallback in future. PiperOrigin-RevId: 271883746
* Tablegen helpers for accessing properties of shaped typesGeoffrey Martin-Noble2019-09-271-3/+2
| | | | | | Tablegen's lack of functions continues to be annoying PiperOrigin-RevId: 271680947
* Add tablegen verification traits for comparing different propertiesGeoffrey Martin-Noble2019-09-251-0/+12
| | | | | | This allows things like comparing the rank of one operand to the size of another that specifies indices into it. PiperOrigin-RevId: 271150439
* Add interfaces for call-like/callable operations.River Riddle2019-09-232-4/+11
| | | | | | | | | | | These two operation interfaces will be used in a followup to support building a callgraph: * CallOpInterface - Operations providing this interface are call-like, and have a "call" target. A call target may be a symbol reference, via SymbolRefAttr, or a SSA value. * CallableOpInterface - Operations providing this interfaces define destinations to call-like operations, e.g. FuncOp. These operations may define any number of callable regions. PiperOrigin-RevId: 270723300
* Fix a number of Clang-Tidy warnings.Christian Sigg2019-09-231-1/+1
| | | | PiperOrigin-RevId: 270632324
* [ODS] Add support for FloatElementsAttrLei Zhang2019-09-211-0/+17
| | | | | | | | | This CL adds a new FloatElementsAttr definition to ODS for float elements attributes of a certain type. Tests are added to show both verification and how to use it in patterns. PiperOrigin-RevId: 270455487
* NFC: Pass OpAsmPrinter by reference instead of by pointer.River Riddle2019-09-202-11/+11
| | | | | | MLIR follows the LLVM style of pass-by-reference. PiperOrigin-RevId: 270401378
* NFC: Pass OperationState by reference instead of by pointer.River Riddle2019-09-202-26/+26
| | | | | | MLIR follows the LLVM convention of passing by reference instead of by pointer. PiperOrigin-RevId: 270396945
* NFC: Pass OpAsmParser by reference instead of by pointer.River Riddle2019-09-202-18/+18
| | | | | | MLIR follows the LLVM style of pass-by-reference. PiperOrigin-RevId: 270315612
* Add support to OpAsmParser for parsing unknown keywords.River Riddle2019-09-172-3/+28
| | | | | | This is useful in several cases, for example a user may want to sugar the syntax of a string(as we do with custom operation syntax), or avoid many nested ifs for parsing a set of known keywords. PiperOrigin-RevId: 269695451
* Add support for multi-level value mapping to DialectConversion.River Riddle2019-09-162-4/+90
| | | | | | When performing A->B->C conversion, an operation may still refer to an operand of A. This makes it necessary to unmap through multiple levels of replacement for a specific value. PiperOrigin-RevId: 269367859
* Add type constraints for shaped types with same rank and element countGeoffrey Martin-Noble2019-09-131-0/+19
| | | | PiperOrigin-RevId: 269000237
* Add tablegen class for memrefs with rank constraintsGeoffrey Martin-Noble2019-09-131-0/+4
| | | | PiperOrigin-RevId: 268968004
* Add `parseGenericOperation()` to the OpAsmParserMehdi Amini2019-09-082-0/+50
| | | | | | | | | This method parses an operation in its generic form, from the current parser state. This is the symmetric of OpAsmPrinter::printGenericOp(). An immediate use case is illustrated in the test dialect, where an operation wraps another one in its region and makes use of a single-line pretty-print form. PiperOrigin-RevId: 267930869
* Use "final" instead of marking method virtual in override (NFC)Mehdi Amini2019-09-071-1/+1
| | | | | | | | This is the only example for overriding this interface in the repo, let's try to make it right as it may be taken as a reference when implemented in other dialects PiperOrigin-RevId: 267811123
* Add the initial inlining infrastructure.River Riddle2019-09-052-1/+47
| | | | | | | | | | | | | | | | | | This defines a set of initial utilities for inlining a region(or a FuncOp), and defines a simple inliner pass for testing purposes. A new dialect interface is defined, DialectInlinerInterface, that allows for dialects to override hooks controlling inlining legality. The interface currently provides the following hooks, but these are just premilinary and should be changed/added to/modified as necessary: * isLegalToInline - Determine if a region can be inlined into one of this dialect, *or* if an operation of this dialect can be inlined into a given region. * shouldAnalyzeRecursively - Determine if an operation with regions should be analyzed recursively for legality. This allows for child operations to be closed off from the legality checks for operations like lambdas. * handleTerminator - Process a terminator that has been inlined. This cl adds support for inlining StandardOps, but other dialects will be added in followups as necessary. PiperOrigin-RevId: 267426759
* Generalize I32ElementsAttr definition and introduce I64ElementsAttrSmit Hinsu2019-09-041-1/+7
| | | | | | Also, fix constBuilderCall to return attribute of the storage class DenseIntElementsAttr PiperOrigin-RevId: 267305813
* Add a new dialect interface for the OperationFolder `OpFolderDialectInterface`.River Riddle2019-09-012-0/+24
| | | | | | This interface will allow for providing hooks to interrop with operation folding. The first hook, 'shouldMaterializeInto', will allow for controlling which region to insert materialized constants into. The folder will generally materialize constants into the top-level isolated region, this allows for materializing into a lower level ancestor region if it is more profitable/correct. PiperOrigin-RevId: 266702972
* Add TensorRankOf for ranked tensor types with specific ranksLogan Chien2019-08-301-3/+12
| | | | | | | | | This commit adds `TensorRankOf<types, typeNames, ranks>` to specify ranked tensor types with the specified types and ranks. For example, `TensorRankOf<[I32, F32], ["i32", "F32"], [0, 1]>` matches `tensor<i32>`, `tensor<?xi32>`, `tensor<f32>`, or `tensor<?xf32>`. PiperOrigin-RevId: 266461256
* Add implementation for tensor_load and tensor_store operations.Stephan Herhut2019-08-281-0/+11
| | | | | | This change adds definitions, parsing and verification for both ops. PiperOrigin-RevId: 265954051
* NFC: Remove the explicit context from Operation::create and OperationState.River Riddle2019-08-261-2/+3
| | | | | | The context can easily be recovered from the Location in these situations. PiperOrigin-RevId: 265578574
* Support folding of ops with inner ops in GreedyPatternRewriteDriver.Andy Ly2019-08-262-5/+24
| | | | | | This fixes a bug when folding ops with inner ops and inner ops are still being visited. PiperOrigin-RevId: 265475780
* Introduce the ability for "isolated from above" ops to introduce shadowingChris Lattner2019-08-232-0/+8
| | | | | | names for the basic block arguments in their body. PiperOrigin-RevId: 265084627
* Add I32ElementsAttr to OpBaseMLIR Team2019-08-221-0/+4
| | | | PiperOrigin-RevId: 264969142
* Add Positive{I32,I64}Attr and HasAnyRankOfPredLogan Chien2019-08-221-0/+14
| | | | | | | | This commit adds `PositiveI32Attr` and `PositiveI64Attr` to match positive integers but not zero nor negative integers. This commit also adds `HasAnyRankOfPred` to match tensors with the specified ranks. PiperOrigin-RevId: 264867046
* [TableGen] Add a `StaticShapeMemRefOf` trait.MLIR Team2019-08-211-0/+4
| | | | | | The trait specifies that the `MemRefOf` has to have a static shape. PiperOrigin-RevId: 264692758
* Support variadic ops in declarative rewrite rulesLei Zhang2019-08-211-0/+110
| | | | | | | | | | | | | | | | | | | | | | | | This CL extends declarative rewrite rules to support matching and generating ops with variadic operands/results. For this, the generated `matchAndRewrite()` method for each pattern now are changed to * Use "range" types for the local variables used to store captured values (`operand_range` for operands, `ArrayRef<Value *>` for values, *Op for results). This allows us to have a unified way of handling both single values and value ranges. * Create local variables for each operand for op creation. If the operand is variadic, then a `SmallVector<Value*>` will be created to collect all values for that operand; otherwise a `Value*` will be created. * Use a collective result type builder. All result types are specified via a single parameter to the builder. We can use one result pattern to replace multiple results of the matched root op. When that happens, it will require specifying types for multiple results. Add a new collective-type builder. PiperOrigin-RevId: 264588559
* Allow isolated regions to form isolated SSA name scopes in the printer.River Riddle2019-08-192-5/+34
| | | | | | | | | | | This will allow for naming values the same as existing SSA values for regions attached to operations that are isolated from above. This fits in with how the system already allows separate name scopes for sibling regions. This name shadowing can be enabled in the custom parser of operations by setting the 'enableNameShadowing' flag to true when calling 'parseRegion'. %arg = constant 10 : i32 foo.op { %arg = constant 10 : i32 } PiperOrigin-RevId: 264255999
* Change from llvm::make_unique to std::make_uniqueJacques Pienaar2019-08-171-1/+1
| | | | | | | | Switch to C++14 standard method as llvm::make_unique has been removed ( https://reviews.llvm.org/D66259). Also mark some targets as c++14 to ease next integrates. PiperOrigin-RevId: 263953918
* Express ownership transfer in PassManager API through std::unique_ptr (NFC)Mehdi Amini2019-08-121-3/+6
| | | | | | | | | | | | | | Since raw pointers are always passed around for IR construct without implying any ownership transfer, it can be error prone to have implicit ownership transferred the same way. For example this code can seem harmless: Pass *pass = .... pm.addPass(pass); pm.addPass(pass); pm.run(module); PiperOrigin-RevId: 263053082
* NFC: Standardize the terminology used for parent ops/regions/etc.River Riddle2019-08-091-1/+1
| | | | | | There are currently several different terms used to refer to a parent IR unit in 'get' methods: getParent/getEnclosing/getContaining. This cl standardizes all of these methods to use 'getParent*'. PiperOrigin-RevId: 262680287
* NFC: Update usages of OwningRewritePatternList to pass by & instead of &&.River Riddle2019-08-091-4/+3
| | | | | | This will allow for reusing the same pattern list, which may be costly to continually reconstruct, on multiple invocations. PiperOrigin-RevId: 262664599
* Remove ops in regions/blocks from worklist when parent op is being removed ↵Andy Ly2019-08-062-0/+27
| | | | | | | | via GreedyPatternRewriteDriver::replaceOp. This fixes a bug where ops inside the parent op are visited even though the parent op has been removed. PiperOrigin-RevId: 261953580
* NFC: Implement OwningRewritePatternList as a class instead of a using directive.River Riddle2019-08-051-4/+4
| | | | | | This allows for proper forward declaration, as opposed to leaking the internal implementation via a using directive. This also allows for all pattern building to go through 'insert' methods on the OwningRewritePatternList, replacing uses of 'push_back' and 'RewriteListBuilder'. PiperOrigin-RevId: 261816316
* [ODS] Add new definitions for non-negative integer attributesLei Zhang2019-08-031-0/+7
| | | | | | | This CL added a new NonNegativeIntAttrBase class and two instantiations, one for I32 and the other for I64. PiperOrigin-RevId: 261513292
* Replace the verifyUnusedValue directive with HasNoUseOf constraintLei Zhang2019-08-011-17/+1
| | | | | | | | | verifyUnusedValue is a bit strange given that it is specified in a result pattern but used to generate match statements. Now we are able to support multi-result ops better, we can retire it and replace it with a HasNoUseOf constraint. This reduces the number of mechanisms. PiperOrigin-RevId: 261166863
* Migrate pattern symbol binding tests to use TestDialectLei Zhang2019-07-311-0/+42
| | | | PiperOrigin-RevId: 261045611
* Fix support for auxiliary ops in declarative rewrite rulesLei Zhang2019-07-311-8/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We allow to generate more ops than what are needed for replacing the matched root op. Only the last N static values generated are used as replacement; the others serve as auxiliary ops/values for building the replacement. With the introduction of multi-result op support, an op, if used as a whole, may be used to replace multiple static values of the matched root op. We need to consider this when calculating the result range an generated op is to replace. For example, we can have the following pattern: ```tblgen def : Pattern<(ThreeResultOp ...), [(OneResultOp ...), (OneResultOp ...), (OneResultOp ...)]>; // Two op to replace all three results def : Pattern<(ThreeResultOp ...), [(TwoResultOp ...), (OneResultOp ...)]>; // One op to replace all three results def : Pat<(ThreeResultOp ...), (ThreeResultOp ...)>; def : Pattern<(ThreeResultOp ...), [(AuxiliaryOp ...), (ThreeResultOp ...)]>; ``` PiperOrigin-RevId: 261017235
* RewriterGen: properly handle zero-result opsAlex Zinenko2019-07-301-0/+10
| | | | | | | | | RewriterGen was emitting invalid C++ code if the pattern required to create a zero-result operation due to the absence of a special case that would avoid generating a spurious comma. Handle this case. Also add rewriter tests for zero-argument operations. PiperOrigin-RevId: 260576998
* Fix SingleBlockImplicitTerminator traits to catch empty blocksMehdi Amini2019-07-301-0/+8
| | | | | | | | | | The code was written with the assumption that on failure an error would be issued by another verifier. However verification is stopping on the first failure which lead to an empty output. Instead we make sure an error is displayed. Also add tests in the test dialect for this trait. PiperOrigin-RevId: 260541290
* Add a `HasParent` operation trait to enforce a specific parent on an ↵Mehdi Amini2019-07-301-0/+4
| | | | | | operation (NFC) PiperOrigin-RevId: 260532592
* Support referencing a single value generated by a matched multi-result opLei Zhang2019-07-261-1/+11
| | | | | | | | It's quite common that we want to put further constraints on the matched multi-result op's specific results. This CL enables referencing symbols bound to source op with the `__N` syntax. PiperOrigin-RevId: 260122401
* Add support for an analysis mode to DialectConversion.River Riddle2019-07-251-5/+42
| | | | | | | | This mode analyzes which operations are legalizable to the given target if a conversion were to be applied, i.e. no rewrites are ever performed even on success. This mode is useful for device partitioning or other utilities that may want to analyze the effect of conversion to different targets before performing it. The analysis method currently just fills a provided set with the operations that were found to be legalizable. This can be extended in the future to capture more information as necessary. PiperOrigin-RevId: 259987105
* ODS: support UnitAttr in Operation definitionsAlex Zinenko2019-07-231-0/+11
| | | | | | | | | | | | | | | A recent commit introduced UnitAttr into the ODS but did not include the support for using UnitAttrs in operation definitions (only patterns were supported). Extend the ODS definition of UnitAttr to be usable in operation definition by providing a trivial builder and an accessor that returns "true" if the unit attribute is present since the attribute presence itself has meaning. Additionally, test that unit attributes are effectively rewritten in patterns in addition to the already available FileCheck tests of the generated rewriter code. PiperOrigin-RevId: 259560653
* Introduce parser library method to parse list of region argumentsUday Bondhugula2019-07-222-0/+34
| | | | | | | | | | | | | | | | | - introduce parseRegionArgumentList (similar to parseOperandList) to parse a list of region arguments with a delimiter - allows defining custom parse for op's with multiple/variadic number of region arguments - use this on the gpu.launch op (although the latter has a fixed number of region arguments) - add a test dialect op to test region argument list parsing (with the no delimiter case) Signed-off-by: Uday Bondhugula <uday@polymagelabs.com> Closes tensorflow/mlir#40 PiperOrigin-RevId: 259442536
OpenPOWER on IntegriCloud