summaryrefslogtreecommitdiffstats
path: root/mlir/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
...
* Add experimental support for multi-threading the pass manager. This adds ↵River Riddle2019-03-292-0/+9
| | | | | | support for running function pipelines on functions across multiple threads, and is guarded by an off-by-default flag 'experimental-mt-pm'. There are still quite a few things that need to be done before multi-threading is ready for general use(e.g. pass-timing), but this allows for those things to be tested in a multi-threaded environment. PiperOrigin-RevId: 240489002
* Replace usages of Instruction with Operation in the /IR directory.River Riddle2019-03-2914-111/+108
| | | | | | This is step 2/N to renaming Instruction to Operation. PiperOrigin-RevId: 240459216
* Rename the Instruction class to Operation. This just renames the class, ↵River Riddle2019-03-293-3/+3
| | | | | | | | usages of Instruction will still refer to a typedef in the interim. This is step 1/N to renaming Instruction to Operation. PiperOrigin-RevId: 240431520
* Allow creating standalone RegionsAlex Zinenko2019-03-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, regions can only be constructed by passing in a `Function` or an `Instruction` pointer referencing the parent object, unlike `Function`s or `Instruction`s themselves that can be created without a parent. It leads to a rather complex flow in operation construction where one has to create the operation first before being able to work with its regions. It may be necessary to work with the regions before the operation is created. In particular, in `build` and `parse` functions that are executed _before_ the operation is created in cases where boilerplate region manipulation is required (for example, inserting the hypothetical default terminator in affine regions). Allow creating standalone regions. Such regions are meant to own a list of blocks and transfer them to other regions on demand. Each instruction stores a fixed number of regions as trailing objects and has ownership of them. This decreases the size of the Instruction object for the common case of instructions without regions. Keep this behavior intact. To allow some flexibility in construction, make OperationState store an owning vector of regions. When the Builder creates an Instruction from OperationState, the bodies of the regions are transferred into the instruction-owned regions to minimize copying. Thus, it becomes possible to fill standalone regions with blocks and move them to an operation when it is constructed, or move blocks from a region to an operation region, e.g., for inlining. PiperOrigin-RevId: 240368183
* Make FunctionPass::getFunction() return a reference to the function, instead ofChris Lattner2019-03-2919-73/+81
| | | | | | | a pointer. This makes it consistent with all the other methods in FunctionPass, as well as with ModulePass::getModule(). NFC. PiperOrigin-RevId: 240257910
* Replace usages of "Op::operator->" with ".".River Riddle2019-03-299-95/+94
| | | | | | This is step 2/N of removing the temporary operator-> method as part of the de-const transition. PiperOrigin-RevId: 240200792
* Refactor the Pattern framework to allow for combined match/rewrite patterns. ↵River Riddle2019-03-291-11/+7
| | | | | | | | | | This is done by adding a new 'matchAndRewrite' function to RewritePattern that performs the match and rewrite in one step. The default behavior simply calls into the existing 'match' and 'rewrite' functions. The 'PatternMatcher' class has now been specialized for RewritePatterns and has been rewritten to make use of the new matchAndRewrite functionality. This combined match/rewrite functionality allows simplifying the majority of existing RewritePatterns, as they do not benefit from separate match and rewrite functions. Some of the existing canonicalization patterns in StandardOps have been modified to take advantage of this functionality. PiperOrigin-RevId: 240187856
* Replace usages of "operator->" with "." for the AffineOps.River Riddle2019-03-299-229/+225
| | | | | Note: The "operator->" method is a temporary helper for the de-const transition and is gradually being phased out. PiperOrigin-RevId: 240179439
* NFC: Rename the 'for' operation in the AffineOps dialect to 'affine.for' and ↵River Riddle2019-03-2913-79/+83
| | | | | | set the namespace of the AffineOps dialect to 'affine'. PiperOrigin-RevId: 240165792
* Using getContext() instead of getInstruction()->getContext() on Operation (NFC)Mehdi Amini2019-03-291-1/+1
| | | | PiperOrigin-RevId: 240088209
* Various small cleanups to the code, mostly removing const_cast's.Chris Lattner2019-03-291-3/+3
| | | | PiperOrigin-RevId: 240083489
* NFC: Rename the 'if' operation in the AffineOps dialect to 'affine.if'.River Riddle2019-03-293-15/+15
| | | | PiperOrigin-RevId: 240071154
* Remove OpPointer, cleaning up a ton of code. This also moves Ops to usingChris Lattner2019-03-2913-146/+130
| | | | | | | | | inherited constructors, which is cleaner and means you can now use DimOp() to get a null op, instead of having to use Instruction::getNull<DimOp>(). This removes another 200 lines of code. PiperOrigin-RevId: 240068113
* Push a bunch of 'consts' out of the *Op structure, in prep for removingChris Lattner2019-03-292-2/+2
| | | | | | OpPointer. PiperOrigin-RevId: 240044712
* Cleanup ValueHandleArrayNicolas Vasilache2019-03-291-4/+6
| | | | | | | | | We just need a way to unpack ArrayRef<ValueHandle> to ArrayRef<Value*>. No need to expose this to the user. This reduces the cognitive overhead for the tutorial. PiperOrigin-RevId: 240037425
* Remove const from Value, Instruction, Argument, and the various methods on theChris Lattner2019-03-299-47/+48
| | | | | | *Op classes. This is a net reduction by almost 400LOC. PiperOrigin-RevId: 239972443
* Remove const from mlir::Block.Chris Lattner2019-03-292-8/+9
| | | | | | This also eliminates some incorrect reinterpret_cast logic working around it, and numerous const-incorrect issues (like block argument iteration). PiperOrigin-RevId: 239712029
* Continue pushing const out of the core IR types - in this case, remove constChris Lattner2019-03-291-10/+8
| | | | | | from Function. PiperOrigin-RevId: 239638635
* Improve comment for `augmentMapAndBounds`Nicolas Vasilache2019-03-291-2/+6
| | | | | | Followup from a previous CL. PiperOrigin-RevId: 239591775
* Move to new `const` model, part 1: remove ConstOpPointer.Chris Lattner2019-03-292-5/+4
| | | | | | | | This eliminate ConstOpPointer (but keeps OpPointer for now) by making OpPointer implicitly launder const in a const incorrect way. It will eventually go away entirely, this is a progressive step towards the new const model. PiperOrigin-RevId: 239512640
* Properly propagate induction variable in tilingNicolas Vasilache2019-03-291-16/+47
| | | | | | | This CL fixes an issue where cloned loop induction variables were not properly propagated and beefs up the corresponding test. PiperOrigin-RevId: 239422961
* Cleanup for changes failing with std=c++11Jacques Pienaar2019-03-292-1/+4
| | | | | | The static constexpr were failing with undefined reference due to lacking definition at namespace scope. PiperOrigin-RevId: 239241157
* Remove some statements that required >C++11, add includes and qualify names. ↵Jacques Pienaar2019-03-295-5/+7
| | | | | | NFC. PiperOrigin-RevId: 239197784
* Avoiding allocations during argument attribute conversion.Dimitrios Vytiniotis2019-03-291-11/+14
| | | | PiperOrigin-RevId: 239144675
* Cleanups Vectorize and SliceAnalysis - NFCNicolas Vasilache2019-03-291-188/+155
| | | | | | This CL cleans up and refactors super-vectorization and slice analysis. PiperOrigin-RevId: 238986866
* Port Tablegen'd reference implementation of Add to declarative builders.Nicolas Vasilache2019-03-291-10/+6
| | | | PiperOrigin-RevId: 238977252
* Remove LOAD/STORE/RETURN boilerplate in declarative builders.Nicolas Vasilache2019-03-291-4/+2
| | | | | | | | | | | | | This CL introduces a ValueArrayHandle helper to manage the implicit conversion of ArrayRef<ValueHandle> -> ArrayRef<Value*> by converting first to ValueArrayHandle. Without this, boilerplate operations that take ArrayRef<Value*> cannot be removed easily. This all seems to boil down to decoupling Value from Type. Alternative solutions exist (e.g. MLIR using Value by value everywhere) but they would be very intrusive. This seems to be the lowest impedance change. Intrinsics are also lowercased by popular demand. PiperOrigin-RevId: 238974125
* Port LowerVectorTransfers from EDSC + AST to declarative buildersNicolas Vasilache2019-03-291-244/+195
| | | | | | | | | | | | | | | This CL removes the dependency of LowerVectorTransfers on the AST version of EDSCs which will be retired. This exhibited a pretty fundamental staging difference in AST-based vs declarative based emission. Since the delayed creation with an AST was staged, the loop order came into existence after the clipping expressions were computed. This now changes as the loops first need to be created declaratively in fixed order and then the clipping expressions are created. Also, due to lack of staging, coalescing cannot be done on the fly anymore and needs to be done either as a pre-pass (current implementation) or as a local transformation on the generated IR (future work). Tests are updated accordingly. PiperOrigin-RevId: 238971631
* Cache the simplified attributes in SimplifyAffineStructures to avoid ↵River Riddle2019-03-291-19/+49
| | | | | | redundant simplifications, as well as unnecessary accesses to the MLIRContext. PiperOrigin-RevId: 238654325
* Rename BlockList into RegionAlex Zinenko2019-03-297-26/+25
| | | | | | NFC. This is step 1/n to specifying regions as parts of any operation. PiperOrigin-RevId: 238472370
* Change getMemoryFootprintBytes emitError to a warningUday Bondhugula2019-03-291-1/+0
| | | | | | | | - this is really not a hard error; emit a warning instead (for inability to compute footprint due to the union failing due to unimplemented cases) - remove a misleading warning from LoopFusion.cpp PiperOrigin-RevId: 238118711
* Fix misc bugs / TODOs / other improvements to analysis utilsUday Bondhugula2019-03-291-2/+0
| | | | | | | | | | | | | | - fix for getConstantBoundOnDimSize: floordiv -> ceildiv for extent - make getConstantBoundOnDimSize also return the identifier upper bound - fix unionBoundingBox to correctly use the divisor and upper bound identified by getConstantBoundOnDimSize - deal with loop step correctly in addAffineForOpDomain (covers most cases now) - fully compose bound map / operands and simplify/canonicalize before adding dim/symbol to FlatAffineConstraints; fixes false positives in -memref-bound-check; add test case there - expose mlir::isTopLevelSymbol from AffineOps PiperOrigin-RevId: 238050395
* Extend loop unrolling and unroll-jamming to non-matching bound operands andUday Bondhugula2019-03-292-97/+107
| | | | | | | | | | | | | | | | | | | | | multi-result upper bounds, complete TODOs, fix/improve test cases. - complete TODOs for loop unroll/unroll-and-jam. Something as simple as "for %i = 0 to %N" wasn't being unrolled earlier (unless it had been written as "for %i = ()[s0] -> (0)()[%N] to %N"; addressed now. - update/replace getTripCountExpr with buildTripCountMapAndOperands; makes it more powerful as it composes inputs into it - getCleanupLowerBound and getUnrolledLoopUpperBound actually needed the same code; refactor and remove one. - reorganize test cases, write previous ones better; most of these changes are "label replacements". - fix wrongly labeled test cases in unroll-jam.mlir PiperOrigin-RevId: 238014653
* Update the constantFold/fold API to use LogicalResult instead of bool.River Riddle2019-03-292-3/+3
| | | | PiperOrigin-RevId: 237719658
* Move the success/failure functions out of LogicalResult and into the mlir ↵River Riddle2019-03-294-32/+32
| | | | | | namespace. PiperOrigin-RevId: 237712180
* Rename Status to LogicalResult to avoid conflictions with the Status in ↵River Riddle2019-03-295-69/+69
| | | | | | xla/tensorflow/etc. PiperOrigin-RevId: 237537341
* Add a basic model to set tile sizes + some cleanupUday Bondhugula2019-03-292-31/+180
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - compute tile sizes based on a simple model that looks at memory footprints (instead of using the hardcoded default value) - adjust tile sizes to make them factors of trip counts based on an option - update loop fusion CL options to allow setting maximal fusion at pass creation - change an emitError to emitWarning (since it's not a hard error unless the client treats it that way, in which case, it can emit one) $ mlir-opt -debug-only=loop-tile -loop-tile test/Transforms/loop-tiling.mlir test/Transforms/loop-tiling.mlir:81:3: note: using tile sizes [4 4 5 ] for %i = 0 to 256 { for %i0 = 0 to 256 step 4 { for %i1 = 0 to 256 step 4 { for %i2 = 0 to 250 step 5 { for %i3 = #map4(%i0) to #map11(%i0) { for %i4 = #map4(%i1) to #map11(%i1) { for %i5 = #map4(%i2) to #map12(%i2) { %0 = load %arg0[%i3, %i5] : memref<8x8xvector<64xf32>> %1 = load %arg1[%i5, %i4] : memref<8x8xvector<64xf32>> %2 = load %arg2[%i3, %i4] : memref<8x8xvector<64xf32>> %3 = mulf %0, %1 : vector<64xf32> %4 = addf %2, %3 : vector<64xf32> store %4, %arg2[%i3, %i4] : memref<8x8xvector<64xf32>> } } } } } } PiperOrigin-RevId: 237461836
* Convert ambiguous bool returns in /Analysis to use Status instead.River Riddle2019-03-292-15/+16
| | | | PiperOrigin-RevId: 237390240
* Use Status instead of bool in DialectConversion.River Riddle2019-03-291-36/+35
| | | | PiperOrigin-RevId: 237339277
* Move UtilResult into the Support directory and rename it to Status. Status ↵River Riddle2019-03-295-50/+48
| | | | | | | | | | | | provides an unambiguous way to specify success/failure results. These can be generated by 'Status::success()' and Status::failure()'. Status provides no implicit conversion to bool and should be consumed by one of the following utility functions: * bool succeeded(Status) - Return if the status corresponds to a success value. * bool failed(Status) - Return if the status corresponds to a failure value. PiperOrigin-RevId: 237153884
* NFC: Remove 'Result' from the analysis manager api to better reflect the ↵River Riddle2019-03-292-3/+3
| | | | | | implementation. There is no distinction between analysis computation and result. PiperOrigin-RevId: 237093101
* Add support for preserving specific analyses in the analysis manager. Passes ↵River Riddle2019-03-291-0/+10
| | | | | | | | | | | can now preserve specific analyses via 'markAnalysesPreserved'. Example: markAnalysesPreserved<DominanceInfo>(); markAnalysesPreserved<DominanceInfo, PostDominanceInfo>(); PiperOrigin-RevId: 237081454
* Use FlatAffineConstraints::unionBoundingBox to perform slice bounds union ↵MLIR Team2019-03-291-77/+106
| | | | | | | | | for loop fusion pass (WIP). Adds utility to convert slice bounds to a FlatAffineConstraints representation. Adds utility to FlatAffineConstraints to promote loop IV symbol identifiers to dim identifiers. PiperOrigin-RevId: 236973261
* DMA generation CL flag updateUday Bondhugula2019-03-291-7/+11
| | | | | | | - allow mem capacity to be overridden by command-line flag - change default fast mem space to 2 PiperOrigin-RevId: 236951598
* Change Pass:getFunction() to return pointer instead of ref - NFCUday Bondhugula2019-03-2918-30/+33
| | | | | | | | | - change this for consistency - everything else similar takes/returns a Function pointer - the FuncBuilder ctor, Block/Value/Instruction::getFunction(), etc. - saves a whole bunch of &s everywhere PiperOrigin-RevId: 236928761
* Fix lower/upper bound mismatch in stripmineSinkNicolas Vasilache2019-03-291-1/+1
| | | | | | Also beef up the corresponding test case. PiperOrigin-RevId: 236878818
* Supporting conversion of argument attributes along their types.Dimitrios Vytiniotis2019-03-291-7/+13
| | | | | | | | | | | | | | | | | This fixes a bug: previously, during conversion function argument attributes were neither beings passed through nor converted. This fix extends DialectConversion to allow for simultaneous conversion of the function type and the argument attributes. This was important when lowering MLIR to LLVM where attribute information (e.g. noalias) needs to be preserved in MLIR(LLVMDialect). Longer run it seems reasonable that we want to convert both the function attribute and its type and the argument attributes, but that requires a small refactoring in Function.h to aggregate these three fields in an inner struct, which will require some discussion. PiperOrigin-RevId: 236709409
* Handle MemRefRegion::compute return value in loop fusion pass (NFC).MLIR Team2019-03-291-8/+27
| | | | PiperOrigin-RevId: 236685849
* Implement the initial AnalysisManagement infrastructure, with the ↵River Riddle2019-03-292-7/+13
| | | | | | | | | | | | | | | | | | introduction of the FunctionAnalysisManager and ModuleAnalysisManager classes. These classes provide analysis computation, caching, and invalidation for a specific IR unit. The invalidation is currently limited to either all or none, i.e. you cannot yet preserve specific analyses. An analysis can be any class, but it must provide the following: * A constructor for a given IR unit. struct MyAnalysis { // Compute this analysis with the provided module. MyAnalysis(Module *module); }; Analyses can be accessed from a Pass by calling either the 'getAnalysisResult<AnalysisT>' or 'getCachedAnalysisResult<AnalysisT>' methods. A FunctionPass may query for a cached analysis on the parent module with 'getCachedModuleAnalysisResult'. Similary, a ModulePass may query an analysis, it doesn't need to be cached, on a child function with 'getFunctionAnalysisResult'. By default, when running a pass all cached analyses are set to be invalidated. If no transformation was performed, a pass can use the method 'markAllAnalysesPreserved' to preserve all analysis results. As noted above, preserving specific analyses is not yet supported. PiperOrigin-RevId: 236505642
* Remove hidden flag from fusion CL optionsUday Bondhugula2019-03-291-4/+4
| | | | PiperOrigin-RevId: 236409185
OpenPOWER on IntegriCloud