summaryrefslogtreecommitdiffstats
path: root/mlir
Commit message (Collapse)AuthorAgeFilesLines
* Automated rollback of changelist 232717775.Uday Bondhugula2019-03-2962-1041/+1036
| | | | PiperOrigin-RevId: 232807986
* When canonicalizing only erase the operation after calling the 'fold' hook ↵River Riddle2019-03-291-2/+2
| | | | | | if replacement results were supplied. This fixes a bug where the operation would always get erased, even if it was modified in place. PiperOrigin-RevId: 232757964
* Rename the 'if' operation in the AffineOps dialect to 'affine.if' and namespaceRiver Riddle2019-03-2926-138/+139
| | | | | | the AffineOps dialect with 'affine'. PiperOrigin-RevId: 232728977
* Add constant build() method not requiring result typeLei Zhang2019-03-292-0/+11
| | | | | | | | Instead, we deduce the result type from the given attribute. This is in preparation for generating constant ops with TableGen. PiperOrigin-RevId: 232723467
* Implement Quantization dialect and minimal UniformQuantizedType.Stella Laurenzo2019-03-291-0/+1
| | | | PiperOrigin-RevId: 232723240
* Port alloc/dealloc LLVM IR conversion into the LLVM IR dialect loweringAlex Zinenko2019-03-292-20/+227
| | | | | | | | | | | | | | | Implement the lowering of memref allocation and deallocation standard operations into the LLVM IR dialect. This largely follows the existing mechanism in MLIR-to-LLVM-IR translation for the sake of compatibility. A memref value is transformed into a memref descriptor value which holds the pointer to the underlying data buffer and the dynamic memref sizes. The buffer is allocated using `malloc` and freed using `free`. The lowering inserts declarations of these functions if necessary. Memref descriptors are values of the LLVM IR structure type wrapped into an MLIR LLVM dialect type. The pointer to the buffer and the individual sizes are accessed using `extractvalue` and `insertvalue` LLVM IR instructions. PiperOrigin-RevId: 232719419
* NFC: Rename the 'for' operation in the AffineOps dialect to 'affine.for'. ↵River Riddle2019-03-2962-1049/+1055
| | | | | | The is the second step to adding a namespace to the AffineOps dialect. PiperOrigin-RevId: 232717775
* Address post submit review comments for removing Block::findInstPositionInBlock.River Riddle2019-03-292-4/+6
| | | | PiperOrigin-RevId: 232713514
* NFC: Rename affine_apply to affine.apply. This is the first step to adding a ↵River Riddle2019-03-2945-773/+773
| | | | | | namespace to the affine dialect. PiperOrigin-RevId: 232707862
* Adds the ability to compute the MemRefRegion of a sliced loop nest. Utilizes ↵MLIR Team2019-03-295-90/+230
| | | | | | | | | this feature during loop fusion cost computation, to compute what the write region of a fusion candidate loop nest slice would be (without having to materialize the slice or change the IR). *) Adds parameter to public API of MemRefRegion::compute for passing in the slice loop bounds to compute the memref region of the loop nest slice. *) Exposes public method MemRefRegion::getRegionSize for computing the size of the memref region in bytes. PiperOrigin-RevId: 232706165
* Address follow on comments for quickstart doc.Jacques Pienaar2019-03-291-20/+21
| | | | PiperOrigin-RevId: 232705423
* Remove findInstPositionInBlock from the Block api.River Riddle2019-03-294-27/+21
| | | | PiperOrigin-RevId: 232704766
* [TableGen] Model variadic operands using Variadic<Type>Lei Zhang2019-03-297-44/+84
| | | | | | | | | | Previously, we were using the trait mechanism to specify that an op has variadic operands. That led a discrepancy between how we handle ops with deterministic number of operands. Besides, we have no way to specify the constraints and match against the variadic operands. This CL introduced Variadic<Type> as a way to solve the above issues. PiperOrigin-RevId: 232656104
* Move the AffineFor loop bound folding to a canonicalization pattern on the ↵River Riddle2019-03-2910-121/+128
| | | | | | AffineForOp. PiperOrigin-RevId: 232610715
* Emit a parser error when the min/max prefix is missing from a multi value ↵River Riddle2019-03-292-6/+26
| | | | | | AffineFor loop bound AffineMap. PiperOrigin-RevId: 232609693
* Refactor the affine analysis by moving some functionality to IR and some to ↵River Riddle2019-03-2924-1035/+907
| | | | | | | | | | | | | | AffineOps. This is important for allowing the affine dialect to define canonicalizations directly on the operations instead of relying on transformation passes, e.g. ComposeAffineMaps. A summary of the refactoring: * AffineStructures has moved to IR. * simplifyAffineExpr/simplifyAffineMap/getFlattenedAffineExpr have moved to IR. * makeComposedAffineApply/fullyComposeAffineMapAndOperands have moved to AffineOps. * ComposeAffineMaps is replaced by AffineApplyOp::canonicalize and deleted. PiperOrigin-RevId: 232586468
* Define the initial g3doc for the Affine dialect.River Riddle2019-03-293-194/+201
| | | | PiperOrigin-RevId: 232581506
* Add derived type attributes for TensorFlow ops generated by TableGenSmit Hinsu2019-03-292-8/+25
| | | | | | | | | | | | | | | Motivation for this change is to remove redundant TF type attributes for TensorFlow ops. For example, tf$T: "tfdtype$DT_FLOAT". Type attributes can be derived using the MLIR operand or result MLIR types, attribute names and their mapping. This will also allow constant folding of instructions generated within MLIR (and not imported from TensorFlow) without adding type attributes for the instruction. Derived attributes are populated while exporting MLIR to TF GraphDef using auto-generated populators. Populators are only available for the ops that are generated by the TableGen. Also, fixed Operator::getNumArgs method to exclude derived attributes as they are not part of the arguments. TESTED with unit test PiperOrigin-RevId: 232531561
* Print parens around the return type of a function if it is also a function typeAlex Zinenko2019-03-298-58/+125
| | | | | | | | | | | | | | | | | | | | | | | | Existing type syntax contains the following productions: function-type ::= type-list-parens `->` type-list type-list ::= type | type-list-parens type ::= <..> | function-type Due to these rules, when the parser sees `->` followed by `(`, it cannot disambiguate if `(` starts a parenthesized list of function result types, or a parenthesized list of operands of another function type, returned from the current function. We would need an unknown amount of lookahead to try to find the `->` at the right level of function nesting to differentiate between type lists and singular function types. Instead, require the result type of the function that is a function type itself to be always parenthesized, at the syntax level. Update the spec and the parser to correspond to the production rule names used in the spec (although it would have worked without modifications). Fix the function type parsing bug in the process, as it used to accept the non-parenthesized list of types for arguments, disallowed by the spec. PiperOrigin-RevId: 232528361
* MLIR graph rewrite using pattern quickstart doc.Jacques Pienaar2019-03-292-0/+245
| | | | | | Start quickstart guide of how to define ops + specify patterns for rewrite. PiperOrigin-RevId: 232490287
* Implemented __invert__, __and__ and __or__ in the EDSC Python bindingsSergei Lebedev2019-03-292-2/+7
| | | | | | | This allows to use bitwise operators as logical (accounting for differences in precedence). PiperOrigin-RevId: 232489024
* Print non-default attribute types in optional attr dictionaryAlex Zinenko2019-03-294-30/+60
| | | | | | | | | | | | | | | In optional attribute dictionary used, among others, in the generic form of the ops, attribute types for integers and floats are omitted. This could lead to inconsistencies when round-tripping the IR, in particular the attributes are created with incorrect types after parsing (integers default to i64, floats default to f64). Provide API to emit a trailing type after the attribute for integers and floats. Use it while printing the optional attribute dictionary. Omitting types for i64 and f64 is a pragmatic decision that minimizes changes in tests. We may want to reconsider in the future and always print types of attributes in the generic form. PiperOrigin-RevId: 232480116
* Loop fusion improvements:MLIR Team2019-03-292-22/+86
| | | | | | | *) After a private memref buffer is created for a fused loop nest, dependences on the old memref are reduced, which can open up fusion opportunities. In these cases, users of the old memref are added back to the worklist to be reconsidered for fusion. *) Fixed a bug in fusion insertion point dependence check where the memref being privatized was being skipped from the check. PiperOrigin-RevId: 232477853
* Implemented __eq__ and __ne__ in EDSC Python bindingsSergei Lebedev2019-03-295-3/+19
| | | | PiperOrigin-RevId: 232473201
* Remove stray debug output - NFCUday Bondhugula2019-03-291-1/+0
| | | | PiperOrigin-RevId: 232390076
* Remove InstWalker and move all instruction walking to the api facilities on ↵River Riddle2019-03-2925-455/+277
| | | | | | Function/Block/Instruction. PiperOrigin-RevId: 232388113
* NFC: Move AffineApplyOp to the AffineOps dialect. This also moves the ↵River Riddle2019-03-2913-316/+310
| | | | | | isValidDim/isValidSymbol methods from Value to the AffineOps dialect. PiperOrigin-RevId: 232386632
* Refactor common code getting memref access in getMemRefRegion - NFCUday Bondhugula2019-03-2910-110/+104
| | | | | | | | | | | | | | | - use getAccessMap() instead of repeating it - fold getMemRefRegion into MemRefRegion ctor (more natural, avoid heap allocation and unique_ptr where possible) - change extractForInductionVars - MutableArrayRef -> ArrayRef for the arguments. Since the method is just returning copies of 'Value *', the client can't mutate the pointers themselves; it's fine to mutate the 'Value''s themselves, but that doesn't mutate the pointers to those. - change the way extractForInductionVars returns (see b/123437690) PiperOrigin-RevId: 232359277
* Update MemRefAccess::getAccessMap to always canonicalize map + operandsUday Bondhugula2019-03-291-0/+1
| | | | | | | | | | - with this we won't see duplicate / unused operands when getting access maps, or when constructing FlatAffineConstraints based on such maps - we can probably change fullyComposeAffineMapAndOperands to ensure this TODO(b/123879896). PiperOrigin-RevId: 232356600
* Remove the OwnerTy template parameter of IROperandImpl and ValueUseIterator ↵River Riddle2019-03-295-20/+18
| | | | | | as it is no longer necessary now that all instructions are operations. PiperOrigin-RevId: 232356323
* Add option print functions with the generic form.Jacques Pienaar2019-03-292-0/+12
| | | | | | | | The generic form may be more desirable even when there is a custom form specified so add option to enable emitting it. This also exposes a current bug when round tripping constant with function attribute. PiperOrigin-RevId: 232350712
* No need to specify default behavior. NFC.Jacques Pienaar2019-03-291-9/+1
| | | | | | This avoids overriding the class members + setting the printer/parser hooks only to fall back to generic. PiperOrigin-RevId: 232348307
* Remove the forward definition of OperationInst now that no references remain.River Riddle2019-03-291-7/+0
| | | | PiperOrigin-RevId: 232325321
* Remove remaining usages of OperationInst in lib/Transforms.River Riddle2019-03-2920-317/+251
| | | | PiperOrigin-RevId: 232323671
* Remove remaining references to OperationInst in all directories except for ↵River Riddle2019-03-2912-83/+75
| | | | | | lib/Transforms. PiperOrigin-RevId: 232322771
* Replace the walkOps/visitOperationInst variants from the InstWalkers with ↵River Riddle2019-03-2925-133/+61
| | | | | | the Instruction variants. PiperOrigin-RevId: 232322030
* Exposing logical operators in EDSC all the way up to Python.Dimitrios Vytiniotis2019-03-296-30/+113
| | | | PiperOrigin-RevId: 232299839
* Update dma-generate pass to (1) work on blocks of instructions (instead of justUday Bondhugula2019-03-2912-153/+451
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | loops), (2) take into account fast memory space capacity and lower 'dmaDepth' to fit, (3) add location information for debug info / errors - change dma-generate pass to work on blocks of instructions (start/end iterators) instead of 'for' loops; complete TODOs - allows DMA generation for straightline blocks of operation instructions interspersed b/w loops - take into account fast memory capacity: check whether memory footprint fits in fastMemoryCapacity parameter, and recurse/lower the depth at which DMA generation is performed until it does fit in the provided memory - add location information to MemRefRegion; any insufficient fast memory capacity errors or debug info w.r.t dma generation shows location information - allow DMA generation pass to be instantiated with a fast memory capacity option (besides command line flag) - change getMemRefRegion to return unique_ptr's - change getMemRefFootprintBytes to work on a 'Block' instead of 'ForInst' - other helper methods; add postDomInstFilter option for replaceAllMemRefUsesWith; drop forInst->walkOps, add Block::walkOps methods Eg. output $ mlir-opt -dma-generate -dma-fast-mem-capacity=1 /tmp/single.mlir /tmp/single.mlir:9:13: error: Total size of all DMA buffers' for this block exceeds fast memory capacity for %i3 = (d0) -> (d0)(%i1) to (d0) -> (d0 + 32)(%i1) { ^ $ mlir-opt -debug-only=dma-generate -dma-generate -dma-fast-mem-capacity=400 /tmp/single.mlir /tmp/single.mlir:9:13: note: 8 KiB of DMA buffers in fast memory space for this block for %i3 = (d0) -> (d0)(%i1) to (d0) -> (d0 + 32)(%i1) { PiperOrigin-RevId: 232297044
* Begin the process of fully removing OperationInst. This patch cleans up ↵River Riddle2019-03-2944-446/+356
| | | | | | references to OperationInst in the /include, /AffineOps, and lib/Analysis. PiperOrigin-RevId: 232199262
* Fold the functionality of OperationInst into Instruction. OperationInst ↵River Riddle2019-03-2938-1100/+980
| | | | | | still exists as a forward declaration and will be removed incrementally in a set of followup cleanup patches. PiperOrigin-RevId: 232198540
* Merge OpProperty and Traits into OpTraitLei Zhang2019-03-295-96/+76
| | | | | | | | | | | | | | | They are essentially both modelling MLIR OpTrait; the former achieves the purpose via introducing corresponding symbols in TableGen, while the latter just uses plain strings. Unify them to provide a single mechanism to avoid confusion and to better reflect the definitions on MLIR C++ side. Ideally we should be able to deduce lots of these traits automatically via other bits of op definitions instead of manually specifying them; but not for now though. PiperOrigin-RevId: 232191401
* Define NumericAttr as the base class for BoolAttr, IntegerAttr, FloatAttr, ↵Lei Zhang2019-03-295-25/+56
| | | | | | | | | | | | | | and ElementsAttr These attribute kinds are different from the rest in the sense that their types are defined in MLIR's type hierarchy and we can build constant op out of them. By defining this middle-level base class, we have a unified way to test and query the type of these attributes, which will be useful when constructing constant ops of various dialects. This CL also added asserts to reject non-NumericAttr in constant op's build() method. PiperOrigin-RevId: 232188178
* Fix the handling of the resizable operands bit of OperationState in a few ↵River Riddle2019-03-292-3/+3
| | | | | | places. PiperOrigin-RevId: 232163738
* Fold IROperandOwner into Instruction.River Riddle2019-03-296-71/+36
| | | | PiperOrigin-RevId: 232159334
* When parsing, treat an IntegerSet with no constraints as a degenerate true ↵River Riddle2019-03-294-16/+19
| | | | | | case. Also update the spec to note that affine constraints are optional. PiperOrigin-RevId: 232158673
* Emit an error when parsing an affine structure if '->' or ':' is not foundRiver Riddle2019-03-292-1/+9
| | | | | | after the dim/symbol id list. PiperOrigin-RevId: 232094789
* Promote local buffers created post fusion to higher memory spaceUday Bondhugula2019-03-291-8/+54
| | | | | | | | | | | | | - fusion already includes the necessary analysis to create small/local buffers post fusion; allocate these buffers in a higher memory space if the necessary pass parameters are provided (threshold size, memory space id) - although there will be a separate utility at some point to directly detect and promote small local buffers to higher memory spaces, doing it while fusion when possible is much less expensive, comes free with fusion analysis, and covers a key common case. PiperOrigin-RevId: 232063894
* Minor fix to the lexer whitespace loop.Stella Laurenzo2019-03-291-1/+4
| | | | | | | | | | | | Nothing in the loop can (legally) cause curPtr -> nullptr. And if it did, we would null dereference right below anyway. This loop still reads funny to me but doesn't make me stare at it and wonder what I am missing anymore. -- PiperOrigin-RevId: 232062076
* Define the AffineForOp and replace ForInst with it. This patch is largely ↵River Riddle2019-03-2952-1730/+1569
| | | | | | mechanical, i.e. changing usages of ForInst to OpPointer<AffineForOp>. An important difference is that upon construction an AffineForOp no longer automatically creates the body and induction variable. To generate the body/iv, 'createBody' can be called on an AffineForOp with no body. PiperOrigin-RevId: 232060516
* [TableGen] Use tblgen::DagLeaf to model DAG argumentsLei Zhang2019-03-297-144/+292
| | | | | | | | | | This CL added a tblgen::DagLeaf wrapper class with several helper methods for handling DAG arguments. It helps to refactor the rewriter generation logic to be more higher level. This CL also added a tblgen::ConstantAttr wrapper class for constant attributes. PiperOrigin-RevId: 232050683
OpenPOWER on IntegriCloud