summaryrefslogtreecommitdiffstats
path: root/mlir/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
...
* LoopUnroll post order walk: fix misleading namingUday Bondhugula2019-03-291-12/+13
| | | | PiperOrigin-RevId: 206609084
* Prepare for implementation of TensorFlow passes:Chris Lattner2019-03-292-35/+24
| | | | | | | | | | - Sketch out a TensorFlow/IR directory that will hold op definitions and common TF support logic. We will eventually have TensorFlow/TF2HLO, TensorFlow/Grappler, TensorFlow/TFLite, etc. - Add sketches of a Switch/Merge op definition, including some missing stuff like the TwoResults trait. Add a skeleton of a pass to raise this form. - Beef up the Pass/FunctionPass definitions slightly, moving the common code out of LoopUnroll.cpp into a new IR/Pass.cpp file. - Switch ConvertToCFG.cpp to be a ModulePass. - Allow _ to start bare identifiers, since this is important for TF attributes. PiperOrigin-RevId: 206502517
* Stmt visitors and walkers.Uday Bondhugula2019-03-291-8/+40
| | | | | | | | | | | | | | | | | | - Update InnermostLoopGatherer to use a post order traversal (linear time/single traversal). - Drop getNumNestedLoops(). - Update isInnermost() to use the StmtWalker. When using return values in conjunction with walkers, the StmtWalker CRTP pattern doesn't appear to be of any use. It just requires overriding nearly all of the methods, which is what InnermostLoopGatherer currently does. Please see FIXME/ENLIGHTENME comments. TODO: figure this out from this CL discussion. Note - Comments on visitor/walker base class are out of date; will update when this CL is finalized. PiperOrigin-RevId: 206340901
* Implement MLValue, statement operands, operation statement operands and ↵Tatiana Shpeisman2019-03-291-1/+3
| | | | | | values. ML functions now have full support for expressing operations. Induction variables, function arguments and return values are still todo. PiperOrigin-RevId: 206253643
* Implement a proper function list in module, which auto-maintain the parentChris Lattner2019-03-292-23/+17
| | | | | | | | | pointer, and ensure that functions are deleted when the module is destroyed. This exposed the fact that MLFunction had no dtor, and that the dtor in CFGFunction was broken with cyclic references. Fix both of these problems. PiperOrigin-RevId: 206051666
* Sketch out loop unrolling transformation.Uday Bondhugula2019-03-291-0/+109
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Implement a full loop unroll for innermost loops. - Use it to implement a pass that unroll all the innermost loops of all mlfunction's in a module. ForStmt's parsed currently have constant trip counts (and constant loop bounds). - Implement StmtVisitor based (Visitor pattern) Loop IVs aren't currently parsed and represented as SSA values. Replacing uses of loop IVs in unrolled bodies is thus a TODO. Class comments are sparse at some places - will add them after one round of comments. A cmd-line flag triggers this for now. Original: mlfunc @loops() { for x = 1 to 100 step 2 { for x = 1 to 4 { "Const"(){value: 1} : () -> () } } return } After unrolling: mlfunc @loops() { for x = 1 to 100 step 2 { "Const"(){value: 1} : () -> () "Const"(){value: 1} : () -> () "Const"(){value: 1} : () -> () "Const"(){value: 1} : () -> () } return } PiperOrigin-RevId: 205933235
* Scaffolding for convertToCFG pass that replaces all instances of ML ↵Tatiana Shpeisman2019-03-291-0/+166
functions with equivalent CFG functions. Traverses module MLIR, generates CFG functions (empty for now) and removes ML functions. Adds Transforms library and tests. PiperOrigin-RevId: 205848367
OpenPOWER on IntegriCloud