summaryrefslogtreecommitdiffstats
path: root/mlir/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
...
* Simplify the emission of various diagnostics created in Analysis/ and ↵River Riddle2019-05-103-22/+13
| | | | | | | | Transforms/ by using the new diagnostic infrastructure. -- PiperOrigin-RevId: 246955332
* Simplify several usages of attributes now that they always have a type ↵River Riddle2019-05-102-10/+21
| | | | | | | | | | and, transitively, access to the context. This also fixes a bug where FunctionAttrs were not being remapped for function and function argument attributes. -- PiperOrigin-RevId: 246876924
* Namespaceify a few explicit template specializations to appease errors ↵River Riddle2019-05-061-5/+3
| | | | | | | | | | caused by a bug in gcc versions < 7.0. (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480) -- PiperOrigin-RevId: 246664463
* Fix up some mixed sign warnings.Jacques Pienaar2019-05-062-3/+3
| | | | | | -- PiperOrigin-RevId: 246614498
* Prepend an "affine-" prefix to Affine pass option names - NFCNicolas Vasilache2019-05-0611-21/+25
| | | | | | | | | | | 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
* Fix bug in LoopTiling where a loop with trip count of 1 caused a ↵MLIR Team2019-05-061-1/+1
| | | | | | | | division by zero -- PiperOrigin-RevId: 246480710
* Add support for basic remark diagnostics. This is the minimal ↵River Riddle2019-05-066-17/+17
| | | | | | | | functionality needed to separate notes from remarks. It also provides a starting point to start building out better remark infrastructure. -- PiperOrigin-RevId: 246175216
* Start sketching out a new diagnostics infrastructure. Create a new class ↵River Riddle2019-05-061-2/+3
| | | | | | | | 'DiagnosticEngine' and move the diagnostic handler support and final diagnostic emission from the MLIRContext to it. -- PiperOrigin-RevId: 246163897
* Parsing support for Range, View and Slice operationsNicolas Vasilache2019-05-061-1/+6
| | | | | | | | | | | This CL implements the previously unsupported parsing for Range, View and Slice operations. A pass is introduced to lower to the LLVM. Tests are moved out of C++ land and into mlir/test/Examples. This allows better fitting within standard developer workflows. -- PiperOrigin-RevId: 245796600
* Rename isa_nonnull to isa_and_nonnull to match the upstream llvm name.River Riddle2019-04-231-1/+1
| | | | | | -- PiperOrigin-RevId: 244928036
* Apply patterns repeatly if the function is modifiedFeng Liu2019-04-231-87/+117
| | | | | | | | | | | | | | | | | | 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
* Fix LLVM_DEBUG instancesAmit Sabne2019-04-181-7/+7
| | | | | | -- PiperOrigin-RevId: 244058051
* Loop invariant code motion.Amit Sabne2019-04-182-0/+131
| | | | | | -- PiperOrigin-RevId: 244043679
* Remove checks guaranteed to be true by the typeLei Zhang2019-04-111-2/+1
| | | | | | | | | This addresses the compiler wraning of "comparison of unsigned expression >= 0 is always true [-Wtype-limits]". -- PiperOrigin-RevId: 242868703
* Add parentheses in various asserts to group predicatesLei Zhang2019-04-111-2/+3
| | | | | | | | | This addresses the "suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]" compiler warnings. -- PiperOrigin-RevId: 242868670
* Factor code to compute dependence components out of loop fusion pass, ↵Andy Davis2019-04-111-35/+18
| | | | | | | | and into a reusable utility function (NFC). -- PiperOrigin-RevId: 242716259
* Fix typos in LoopFusionAmit Sabne2019-04-111-14/+17
| | | | | | -- PiperOrigin-RevId: 242679298
* Filter DialectConversion pattern to be considered only if the root kind ↵Mehdi Amini2019-04-071-0/+5
| | | | | | | | | | matches the operation. This is the same logic as the PatterRewriter. -- PiperOrigin-RevId: 242287241
* Add new utilities for RTTI Operation casting: dyn_cast_or_null and ↵River Riddle2019-04-071-6/+4
| | | | | | | | | | | | | | | | | | | | | isa_nonnull * dyn_cast_or_null - This will first check if the operation is null before trying to 'dyn_cast': Value *v = ...; if (auto forOp = dyn_cast_or_null<AffineForOp>(v->getDefiningOp())) ... * isa_nonnull - This will first check if the pointer is null before trying to 'isa': Value *v = ...; if (isa_nonnull<AffineForOp>(v->getDefiningOp()); ... -- PiperOrigin-RevId: 242171343
* Fix CMake build: reflect that a new file Utils/ConstantFoldUtils.cpp was ↵Mehdi Amini2019-04-051-0/+1
| | | | | | | | added -- PiperOrigin-RevId: 242123122
* Fix CMake build: account for renamed files and add missing include on MacOSMehdi Amini2019-04-051-1/+1
| | | | | | -- PiperOrigin-RevId: 242101364
* NFC: Replace usages of iterator_range<operand_iterator> with operand_range.River Riddle2019-04-051-4/+3
| | | | | | -- PiperOrigin-RevId: 242031201
* Create a LoopUtil function to return perfectly nested loop setMLIR Team2019-04-053-15/+18
| | | | | | -- PiperOrigin-RevId: 242019230
* Iterate on the operations to fold in TestConstantFold in reverse to ↵River Riddle2019-04-052-17/+13
| | | | | | | | | | 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
* Fix a few warnings for missing parentheses around '||' and extra semicolons.River Riddle2019-04-051-1/+1
| | | | | | -- PiperOrigin-RevId: 241994767
* Deduplicate constant folding logic in ConstantFold and ↵Lei Zhang2019-04-054-212/+271
| | | | | | | | | | | | | | | | | | | | | 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-055-12/+9
| | | | | | | | 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-6/+16
| | | | | | | | not handle symbol operands correctly. -- PiperOrigin-RevId: 241958502
* Fix test that fails on non-determinism in LowerVectorTransfersNicolas Vasilache2019-04-031-3/+7
| | | | | | | | | 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
* Rewrite the verify hooks on operations to use LogicalResult instead of ↵River Riddle2019-04-021-3/+3
| | | | | | | | bool. This also changes the return of Operation::emitError/emitOpError to LogicalResult as well. -- PiperOrigin-RevId: 241588075
* Enable producer-consumer fusion for liveout memrefs if consumer read ↵Andy Davis2019-04-021-17/+23
| | | | | | | | region matches producer write region. -- PiperOrigin-RevId: 241517207
* Remove MLPatternLoweringPass and rewrite LowerVectorTransfers to use ↵River Riddle2019-04-021-56/+43
| | | | | | | | RewritePattern instead. -- PiperOrigin-RevId: 241455472
* Fix MacOS buildMehdi Amini2019-04-011-1/+2
| | | | | | | | | This is making up for some differences in standard library and linker flags. It also get rid of the requirement to build with RTTI. -- PiperOrigin-RevId: 241348845
* Add build files and update README.Jacques Pienaar2019-03-301-0/+31
| | | | | | | | | * Add initial version of build files; * Update README with instructions to download and build MLIR from github; -- PiperOrigin-RevId: 241102092
* Cleanup SuperVectorization dialect printing and parsing.Nicolas Vasilache2019-03-294-104/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Make createMaterializeVectorsPass take a vectorSize parameter - NFCNicolas Vasilache2019-03-292-13/+22
| | | | | | | This CL allows the programmatic control of the target hardware vector size when creating a MaterializeVectorsPass. This is useful for registering passes for the tutorial. PiperOrigin-RevId: 240996136
* Refactor vectorization patternsNicolas Vasilache2019-03-291-119/+93
| | | | | | | | | | 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
* Enable input-reuse fusion to search function arguments for fusion candidates ↵MLIR Team2019-03-291-34/+82
| | | | | | (takes care of a TODO, enables another tutorial test case). PiperOrigin-RevId: 240979894
* Change the vectorizer test pass to output via diagnostics instead of ↵River Riddle2019-03-291-28/+34
| | | | | | llvm::outs. This allows for the output to be deterministic when multi-threading is enabled. PiperOrigin-RevId: 240905858
* Remove extra qualificationJacques Pienaar2019-03-291-4/+2
| | | | PiperOrigin-RevId: 240875432
* Dialect Conversion: convert regions of operations when cloning themAlex Zinenko2019-03-291-32/+62
| | | | | | | | | | | | Dialect conversion currently clones the operations that did not match any pattern. This includes cloning any regions that belong to these operations. Instead, apply conversion recursively to the nested regions. Note that if an operation matched one of the conversion patterns, it is up to the pattern rewriter to fill in the regions of the converted operation. This may require calling back to the converter and is left for future work. PiperOrigin-RevId: 240872410
* Remove overly conservative check in LoopFusion pass (enables fusion in ↵MLIR Team2019-03-291-8/+2
| | | | | | tutorial example). PiperOrigin-RevId: 240859227
* Rename InstOperand to OpOperand.River Riddle2019-03-292-3/+3
| | | | PiperOrigin-RevId: 240814651
* Make vectorization aware of loop semanticsNicolas Vasilache2019-03-291-34/+56
| | | | | | Now that we have a dependence analysis, we can check that loops are indeed parallel and make vectorization correct. PiperOrigin-RevId: 240682727
* Give the Vectorize pass a virtualVectorSize argument.Nicolas Vasilache2019-03-291-4/+24
| | | | | | | This CL allows vectorization to be called and configured in other ways than just via command line arguments. This allows triggering vectorization programmatically. PiperOrigin-RevId: 240638208
* Replace usages of Instruction with Operation in the Transforms/ directory.River Riddle2019-03-2920-512/+496
| | | | PiperOrigin-RevId: 240636130
* Simplify API uses of `getContext()` (NFC)Mehdi Amini2019-03-294-4/+4
| | | | | | The Pass base class is providing a convenience getContext() accessor. PiperOrigin-RevId: 240634961
* Fix include path in test pass.Jacques Pienaar2019-03-291-1/+1
| | | | PiperOrigin-RevId: 240628260
* Replace usages of Instruction with Operation in the /Analysis directory.River Riddle2019-03-295-22/+21
| | | | PiperOrigin-RevId: 240569775
* Introduce affine terminatorAlex Zinenko2019-03-295-62/+73
| | | | | | | | | | | | | | | | | | | | | | Due to legacy reasons (ML/CFG function separation), regions in affine control flow operations require contained blocks not to have terminators. This is inconsistent with the notion of the block and may complicate code motion between regions of affine control operations and other regions. Introduce `affine.terminator`, a special terminator operation that must be used to terminate blocks inside affine operations and transfers the control back to he region enclosing the affine operation. For brevity and readability reasons, allow `affine.for` and `affine.if` to omit the `affine.terminator` in their regions when using custom printing and parsing format. The custom parser injects the `affine.terminator` if it is missing so as to always have it present in constructed operations. Update transformations to account for the presence of terminator. In particular, most code motion transformation between loops should leave the terminator in place, and code motion between loops and non-affine blocks should drop the terminator. PiperOrigin-RevId: 240536998
OpenPOWER on IntegriCloud