summaryrefslogtreecommitdiffstats
path: root/mlir/test/Transforms
Commit message (Collapse)AuthorAgeFilesLines
...
* Globally change load/store/dma_start/dma_wait operations over to ↵Andy Davis2019-07-0320-1327/+1068
| | | | | | | | | | | affine.load/store/dma_start/dma_wait. In most places, this is just a name change (with the exception of affine.dma_start swapping the operand positions of its tag memref and num_elements operands). Significant code changes occur here: *) Vectorization: LoopAnalysis.cpp, Vectorize.cpp *) Affine Transforms: Transforms/Utils/Utils.cpp PiperOrigin-RevId: 256395088
* Update the 1->N legalizer test to use "test.return" so that the conversion ↵River Riddle2019-07-011-7/+3
| | | | | | cast is elided properly. PiperOrigin-RevId: 255979732
* TypeConversion: do not materialize conversion of the type to itselfAlex Zinenko2019-07-011-0/+7
| | | | | | | | | | 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
* Run FileCheck on test-legalizer.mlirAlex Zinenko2019-07-011-2/+6
| | | | | | | | 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
* Add affine-to-standard lowerings for affine.load/store/dma_start/dma_wait.Andy Davis2019-07-011-0/+62
| | | | PiperOrigin-RevId: 255960171
* Refactor DialectConversion to use 'materializeConversion' when a type ↵River Riddle2019-06-281-19/+18
| | | | | | | | 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
* Change the attribute dictionary syntax to separate name and value with '='.River Riddle2019-06-2516-122/+122
| | | | | | | | | | | 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
* Modify the syntax of the the ElementsAttrs to print the type as a colon type.River Riddle2019-06-2510-77/+77
| | | | | | | | | 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
* Update the OperationFolder to find a valid insertion point when ↵River Riddle2019-06-251-0/+22
| | | | | | | | 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
* Split test-specific passes out of mlir-optNicolas Vasilache2019-06-241-1/+1
| | | | | | Instead put their impl in test/lib and link them into mlir-test-opt PiperOrigin-RevId: 254837439
* Update CSE to respect nested regions that are isolated from above. This cl ↵River Riddle2019-06-241-0/+24
| | | | | | also removes the unused 'NthRegionIsIsolatedFromAbove' trait as it was replaced with a more general 'IsIsolatedFromAbove'. PiperOrigin-RevId: 254709704
* Add support for 1->N type mappings in the dialect conversion infrastructure. ↵River Riddle2019-06-221-6/+20
| | | | | | 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
* Refactor the TypeConverter to support more robust type conversions:River Riddle2019-06-191-1/+59
| | | | | | | | | | | | * 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
* Remove unnecessary -verify-diagnosticsGeoffrey Martin-Noble2019-06-193-4/+4
| | | | | | 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
* Rename -verify mlir-opt flag to -verify-expected-diagnosticsGeoffrey Martin-Noble2019-06-199-10/+10
| | | | | | This name has caused some confusion because it suggests that it's running op verification (and that this verification isn't getting run by default). PiperOrigin-RevId: 254035268
* LoopFusion: adds support for computing forward computation slices, which ↵Andy Davis2019-06-191-0/+145
| | | | | | will enable fusion of consumer loop nests into their producers in subsequent CLs. PiperOrigin-RevId: 253601994
* Refactor SplatElementsAttr to inherit from DenseElementsAttr as opposed to ↵River Riddle2019-06-1910-79/+79
| | | | | | being a separate Attribute type. DenseElementsAttr provides a better internal representation for splat values as well as better API for accessing elements. PiperOrigin-RevId: 253138287
* Add basic cost modeling to the dialect conversion infrastructure. This ↵River Riddle2019-06-191-0/+15
| | | | | | | | | | | | initial cost model favors specific patterns based upon two criteria: 1) Lowest minimum pattern stack depth when legalizing. - This leads the system to favor patterns that have lower legalization stacks, i.e. represent a more direct mapping to the target. 2) Pattern benefit. - When considering multiple patterns with the same legalization depth, this favors patterns with a larger specified benefit. PiperOrigin-RevId: 252713470
* Loop invariant code motion - remove reliance on getForwardSlice. Add ↵Amit Sabne2019-06-011-6/+346
| | | | | | | | more tests. -- PiperOrigin-RevId: 250950703
* Add a rank op to MLIR. Example:Rasmus Munk Larsen2019-06-011-0/+14
| | | | | | | | %1 = rank %0 : index -- PiperOrigin-RevId: 250505411
* Affine Loop Fusion Utility Module (1/n).Andy Davis2019-06-011-0/+337
| | | | | | | | | | *) Adds LoopFusionUtils which will expose a set of loop fusion utilities (e.g. dependence checks, fusion cost/storage reduction, loop fusion transformation) for use by loop fusion algorithms. Support for checking block-level fusion-preventing dependences is added in this CL (additional loop fusion utilities will be added in subsequent CLs). *) Adds TestLoopFusion test pass for testing LoopFusionUtils at a fine granularity. *) Adds unit test for testing dependence check for block-level fusion-preventing dependences. -- PiperOrigin-RevId: 249861071
* Add support for saving and restoring the insertion point of a ↵River Riddle2019-05-201-1/+1
| | | | | | | | FuncBuilder. This also updates the edsc::ScopedContext to use a single builder that saves/restores insertion points. This is necessary for using edscs within RewritePatterns. -- PiperOrigin-RevId: 248812645
* Fixes a small bug in computing dependence direction vectors, where ↵Andy Davis2019-05-201-0/+54
| | | | | | | | equality constraint can be created on the wrong loop IVs when source/sink of the dependence are at different loop depths. Adds unit tests for cases where source/sink of the dependence are at varying loop depths. -- PiperOrigin-RevId: 248627490
* Add test for affine-loop-tile pass with a loop of trip count 1Tamas Berghammer2019-05-201-0/+16
| | | | | | -- PiperOrigin-RevId: 247950156
* rename -memref-dependence-check to -test-memref-dependence-check since itChris Lattner2019-05-201-1/+1
| | | | | | | | | | | | generates remarks for testing, it isn't itself a transformation. While there, upgrade its diagnostic emission to use the streaming interface. Prune some unnecessary #includes. -- PiperOrigin-RevId: 247768062
* Add memref dimension bounds as upper/lower bounds on MemRefRegion ↵Andy Davis2019-05-102-6/+34
| | | | | | | | constraints, to guard against potential over-approximation from projection. -- PiperOrigin-RevId: 247431201
* Fix bug in DmaGenerate pass where MemRefRegion union was not propagated ↵Andy Davis2019-05-101-14/+68
| | | | | | | | | | to read region. Also cleaned up dma-generate.mlir a bit. -- PiperOrigin-RevId: 247417358
* Simplify the parser/printer of ConstantOp now that all attributes have ↵River Riddle2019-05-1010-72/+72
| | | | | | | | types. This has the added benefit of removing type redundancy from the pretty form. As a consequence, IntegerAttr/FloatAttr will now always print the type even if it is i64/f64. -- PiperOrigin-RevId: 247295828
* Verify that attribute type and constant op return type matches.Jacques Pienaar2019-05-101-2/+2
| | | | | | -- PiperOrigin-RevId: 247263129
* CmpFOp. Add float comparison opGeoffrey Martin-Noble2019-05-101-0/+61
| | | | | | | | | | This closely mirrors the llvm fcmp instruction, defining 16 different predicates Constant folding is unsupported for NaN and Inf because there's no way to represent those as constants at the moment -- PiperOrigin-RevId: 246932358
* Add split-input-file to constant fold testGeoffrey Martin-Noble2019-05-101-13/+53
| | | | | | | | Better to keep tests as separate as possible -- PiperOrigin-RevId: 246900564
* Change syntax of regions in the generic form of operationsAlex Zinenko2019-05-061-2/+2
| | | | | | | | | | | | | | | The generic form of operations currently supports optional regions to be located after the operation type. As we are going to add a type to each region in a leading position in the region syntax, similarly to functions, it becomes ambiguous to have regions immediately after the operation type. Put regions between operands the optional list of successors in the generic operation syntax and wrap them in parentheses. The effect on the exisitng IR syntax is minimal since only three operations (`affine.for`, `affine.if` and `gpu.kernel`) currently use regions. -- PiperOrigin-RevId: 246787087
* Prepend an "affine-" prefix to Affine pass option names - NFCNicolas Vasilache2019-05-0622-32/+32
| | | | | | | | | | | Trying to activate both LLVM and MLIR passes in mlir-cpu-runner showed name collisions when registering pass names. One possible way of disambiguating that should also work across dialects is to prepend the dialect name to the passes that specifically operate on that dialect. With this CL, mlir-cpu-runner tests still run when both LLVM and MLIR passes are registered -- PiperOrigin-RevId: 246539917
* Add support for basic remark diagnostics. This is the minimal ↵River Riddle2019-05-062-286/+286
| | | | | | | | functionality needed to separate notes from remarks. It also provides a starting point to start building out better remark infrastructure. -- PiperOrigin-RevId: 246175216
* Make identity cast operations with the same operand and result types legalSmit Hinsu2019-05-061-0/+21
| | | | | | | | | | | | Instead, fold such operations. This way callers don't need to conditionally create cast operations depending on if a value already has the target type. Also, introduce areCastCompatible to allow cast users to verify that the generated op will be valid before creating the operation. TESTED with unit tests -- PiperOrigin-RevId: 245606133
* Apply patterns repeatly if the function is modifiedFeng Liu2019-04-231-5/+3
| | | | | | | | | | | | | | | | | | During the pattern rewrite, if the function is changed, i.e. ops created, deleted or swapped, the pattern rewriter needs to re-scan the function entirely and apply the patterns again, so the patterns whose root ops have been popped out from the working list nor an immediate users of the changed ops can be reconsidered. A command line flag is added to set the max number of iterations rescanning the function for pattern match. If the rewrite doesn' converge after this number, this compiling will continue and the result can be sub-optimal. One unit test is updated because this change fixed the missing optimization opportunities. -- PiperOrigin-RevId: 244754190
* Loop invariant code motion.Amit Sabne2019-04-181-0/+189
| | | | | | -- PiperOrigin-RevId: 244043679
* Fix CHECK-EMPTY directives without trailing colonSmit Hinsu2019-04-181-2/+1
| | | | | | | | | | | There are no empty lines in output for three of these directives so removed them and replaced the remaining one with 'CHECK-NOT:' as otherwise it is failing with the following error. error: found 'CHECK-EMPTY' without previous 'CHECK: line TESTED = n/a PiperOrigin-RevId: 243288605
* Add xor bitwise operation to StandardOps.Stephan Herhut2019-04-081-0/+40
| | | | | | | | | | This adds parsing, printing and some folding/canonicalization. Also extends rewriting of subi %0, %0 to handle vectors and tensors. -- PiperOrigin-RevId: 242448164
* Add and and or bitwise operations to StandardOps.Stephan Herhut2019-04-081-0/+93
| | | | | | | | This adds parsing, printing and some folding/canonicalization. -- PiperOrigin-RevId: 242409840
* Iterate on the operations to fold in TestConstantFold in reverse to ↵River Riddle2019-04-051-2/+2
| | | | | | | | | | remove the need for ConstantFoldHelper to have a flag for insertion at the head of the entry block. This also fixes an asan bug in TestConstantFold due to the iteration order of operations and ConstantFoldHelper's constant insertion placement. Note: This now means that we cannot fold chains of operations, i.e. where constant foldable operations feed into each other. Given that this is a testing pass solely for constant folding, this isn't really something that we want anyways. Constant fold tests should be simple and direct, with more advanced folding/feeding being tested with the canonicalizer. -- PiperOrigin-RevId: 242011744
* Deduplicate constant folding logic in ConstantFold and ↵Lei Zhang2019-04-051-16/+17
| | | | | | | | | | | | | | | | | | | | | GreedyPatternRewriteDriver There are two places containing constant folding logic right now: the ConstantFold pass and the GreedyPatternRewriteDriver. The logic was not shared and started to drift apart. We were testing constant folding logic using the ConstantFold pass, but lagged behind the GreedyPatternRewriteDriver, where we really want the constant folding to happen. This CL pulled the logic into utility functions and classes for sharing between these two places. A new ConstantFoldHelper class is created to help constant fold and de-duplication. Also, renamed the ConstantFold pass to TestConstantFold to make it clear that it is intended for testing purpose. -- PiperOrigin-RevId: 241971681
* Remove the non-postorder walk functions from Function/Block/Instruction ↵River Riddle2019-04-053-38/+40
| | | | | | | | and rename walkPostOrder to walk. -- PiperOrigin-RevId: 241965239
* Fix bug in LoopTiling where creation of tile-space loop upper bound did ↵Andy Davis2019-04-051-5/+74
| | | | | | | | not handle symbol operands correctly. -- PiperOrigin-RevId: 241958502
* Adds dependence analysis support for iteration domains with local ↵Andy Davis2019-04-051-0/+68
| | | | | | | | variables (enables dependence analysis of loops with non-unit step). -- PiperOrigin-RevId: 241957023
* Fix test that fails on non-determinism in LowerVectorTransfersNicolas Vasilache2019-04-031-27/+17
| | | | | | | | | This CL fixes the non-determinism across compilers in an edsc::select expression used in LowerVectorTransfers. This is achieved by factoring the expression out of the function call to ensure a deterministic order of evaluation. Since the expression is now factored out, fewer IR is generated and the test is updated accordingly. -- PiperOrigin-RevId: 241679962
* Enable producer-consumer fusion for liveout memrefs if consumer read ↵Andy Davis2019-04-021-5/+84
| | | | | | | | region matches producer write region. -- PiperOrigin-RevId: 241517207
* Remove MLPatternLoweringPass and rewrite LowerVectorTransfers to use ↵River Riddle2019-04-021-1/+1
| | | | | | | | RewritePattern instead. -- PiperOrigin-RevId: 241455472
* Cleanup SuperVectorization dialect printing and parsing.Nicolas Vasilache2019-03-2911-155/+155
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | On the read side, ``` %3 = vector_transfer_read %arg0, %i2, %i1, %i0 {permutation_map: (d0, d1, d2)->(d2, d0)} : (memref<?x?x?xf32>, index, index, index) -> vector<32x256xf32> ``` becomes: ``` %3 = vector_transfer_read %arg0[%i2, %i1, %i0] {permutation_map: (d0, d1, d2)->(d2, d0)} : memref<?x?x?xf32>, vector<32x256xf32> ``` On the write side, ``` vector_transfer_write %0, %arg0, %c3, %c3 {permutation_map: (d0, d1)->(d0)} : vector<128xf32>, memref<?x?xf32>, index, index ``` becomes ``` vector_transfer_write %0, %arg0[%c3, %c3] {permutation_map: (d0, d1)->(d0)} : vector<128xf32>, memref<?x?xf32> ``` Documentation will be cleaned up in a followup commit that also extracts a proper .md from the top of the file comments. PiperOrigin-RevId: 241021879
* Refactor vectorization patternsNicolas Vasilache2019-03-291-6/+57
| | | | | | | | | | This CL removes the reliance of the vectorize pass on the specification of a `fastestVaryingDim` parameter. This parameter is a restriction meant to more easily target a particular loop/memref combination for vectorization and is mainly used for testing. This also had the side-effect of restricting vectorization patterns to only the ones in which all memrefs were contiguous along the same loop dimension. This simple restriction prevented matmul to vectorize in 2-D. this CL removes the restriction and adds the matmul test which vectorizes in 2-D along the parallel loops. Support for reduction loops is left for future work. PiperOrigin-RevId: 240993827
OpenPOWER on IntegriCloud