summaryrefslogtreecommitdiffstats
path: root/mlir/lib/IR
Commit message (Collapse)AuthorAgeFilesLines
...
* Refactor generic op printing: extract a public printFunctionalType() on ↵Mehdi Amini2019-06-192-15/+4
| | | | | | OpAsmPrinter (NFC) PiperOrigin-RevId: 253674584
* Also consider attributes when getting context for OperationLei Zhang2019-06-191-5/+6
| | | | | | | This CL also updates to use containing region as a fallback way to find context since functions will eventually become ops with regions. PiperOrigin-RevId: 253627322
* Factor Region::getUsedValuesDefinedAbove into Transforms/RegionUtilsAlex Zinenko2019-06-191-23/+9
| | | | | | | | Arguably, this function is only useful for transformations and should not pollute the main IR. Also make sure it accepts a the resulting container by-reference instead of returning it. PiperOrigin-RevId: 253622981
* Move the Region type out to its own .h/.cpp file instead of putting it intoChris Lattner2019-06-192-201/+238
| | | | | | | | Block.h/cpp. This doesn't change much but makes it easier to find. PiperOrigin-RevId: 253423041
* Add Linalg CopyOpNicolas Vasilache2019-06-191-0/+22
| | | | | | | | | | This CL adds a generic CopyOp to Linalg and its lowering to loops. The CopyOp supports input and output permutation maps. When combined with tiling and allocating a new local buffer, this should provide basic support for implementing simple memory transfers with coalescing. At the moment, lowering copies to a library call is not supported. PiperOrigin-RevId: 253250497
* Convert a nest affine loops to a GPU kernelAlex Zinenko2019-06-191-11/+24
| | | | | | | | | This converts entire loops into threads/blocks. No check on the size of the block or grid, or on the validity of parallelization is performed, it is under the responsibility of the caller to strip-mine the loops and to perform the dependence analysis before calling the conversion. PiperOrigin-RevId: 253189268
* Refactor SplatElementsAttr to inherit from DenseElementsAttr as opposed to ↵River Riddle2019-06-193-83/+6
| | | | | | 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
* NFC: Fix a warning for casting away const qualifiers.River Riddle2019-06-191-3/+3
| | | | PiperOrigin-RevId: 253124057
* Add several utility 'getValues<T>' functions to DenseElementsAttr that ↵River Riddle2019-06-191-54/+66
| | | | | | return ranges as opposed to filling a SmallVector. This is much more efficient for the general case and allows for avoiding constructing APInt/APFloat/Attribute when possible. PiperOrigin-RevId: 253092550
* Update the Parser to support parsing/printing DenseElementAttrs with a splat ↵River Riddle2019-06-191-7/+2
| | | | | | | | | value. The syntax for this is the same as 0-D tensors: dense<tensor<100x100x100xi32>, 10> dense<tensor<1x1x1xi64>, -5> PiperOrigin-RevId: 252907880
* Fix static assertion in AttributeDetail.hAlex Zinenko2019-06-191-1/+1
| | | | | | llvm::maskTrailingOnes<char> runs into a static assertion on the type not being unsigned. Use `unsigned char` instead of `char`. PiperOrigin-RevId: 252827214
* Refactor DenseElementsAttr to support auto-splatting the dense data on ↵River Riddle2019-06-193-70/+253
| | | | | | construction. This essentially means that we always auto-detect splat data and only store the minimum amount of data necessary. Support for parsing dense splats, and removing SplatElementsAttr(now that it is redundant) will come in followup cls PiperOrigin-RevId: 252720561
* Add a utility to OpAsmPrinter for printing an optional trailing arrow type ↵River Riddle2019-06-191-21/+1
| | | | | | list. This is useful for any operation that wants to print a set of types in the same format as a FunctionType/Operation signature. PiperOrigin-RevId: 252647152
* Use DialectConversion to lower the Affine dialect to the Standard dialectAlex Zinenko2019-06-111-0/+9
| | | | | | | | | | | | | | | | | | | | | This introduces the support for region-containing operations to the dialect conversion framework in order to support the conversion of affine control-flow operations into the standard control flow with branches. Regions that belong to an operation are converted before the operation itself. The DialectConversionPattern can therefore access the converted regions of the original operation and process them further if necessary. In particular, the conversion is allowed to move the blocks from the original region to other regions and to split blocks into multiple blocks. All block manipulations must be performed through the PatternRewriter to ensure they will be undone if the conversion fails. Port the pass converting from the affine dialect (loops and ifs with bodies as regions) to the standard dialect (branch-based cfg) to use DialectConversion in order to exercise this new functionality. The modification to the lowering functions are minor and are focused on using the PatterRewriter instead of directly modifying the IR. PiperOrigin-RevId: 252625169
* NFC: Cleanup the grouping of DenseElementsAttr 'get' methods, and move the ↵River Riddle2019-06-091-88/+88
| | | | | | bit write/read functions to static functions in Attributes.cpp. PiperOrigin-RevId: 252094145
* Remove the ability to directly construct a DenseElementsAttr with a raw ↵River Riddle2019-06-092-26/+43
| | | | | | | | | character buffer. This made assumptions about how DenseElementsAttr structured its internal storage, which may change in the future. To replace the existing use cases, a few utility methods have been added: * 'get' methods that allow constructing from an ArrayRef of integer or floating point values. * A 'reshape' method to allow for changing the shape without changing the underlying data. PiperOrigin-RevId: 252067898
* Remove the explicit attribute kinds for DenseIntElementsAttr and ↵River Riddle2019-06-093-39/+29
| | | | | | DenseFPElementsAttr in favor of just one DenseElementsAttr. Now that attribute has the ability to define 'classof(Attribute attr)' methods, these derived classes can just be specializations of the main attribute class. PiperOrigin-RevId: 251948820
* Simplify DenseElementsAttr by rounding up the storage of odd bit widths to ↵River Riddle2019-06-092-61/+56
| | | | | | 8-bits. This removes the requirement that the underlying buffer be aligned to 64 bits which opens the door for several optimizations in the future, e.g. detecting splat. PiperOrigin-RevId: 251944922
* Add a general operation property 'IsolatedFromAbove' that guarantees that ↵River Riddle2019-06-091-1/+1
| | | | | | all regions of a given operation are explicit capture only and will not reference values defined above the enclosing operation. This trait will be useful for applying some of the properties currently attached to Functions to operations, e.g. verifying dominance within a specific operation, enabling multi-threading of certain transformations between different instances, etc. PiperOrigin-RevId: 251927466
* Support FP16 in getZeroAttr.MLIR Team2019-06-091-0/+6
| | | | PiperOrigin-RevId: 251783931
* Add a verify method to FuncOp and check that the type signature matches the ↵River Riddle2019-06-091-0/+23
| | | | | | signature of the entry block. PiperOrigin-RevId: 251759848
* Fix a warning for missing parentheses around '||' inside of an assert.River Riddle2019-06-091-3/+3
| | | | PiperOrigin-RevId: 251712106
* Add new 'createOrFold' methods to FuncBuilder to immediately try to fold an ↵River Riddle2019-06-091-0/+26
| | | | | | operation after creating it. This can be used to remove operations that are likely to be trivially folded later. Note, these functions only fold operations if all of the folded results are existing values. PiperOrigin-RevId: 251674299
* Add a few utility overloads for OpAsmParser methods:River Riddle2019-06-091-2/+1
| | | | | | | * Add a getCurrentLocation that returns the location directly. * Add parseOperandList/parseTrailingOperandList overloads without the required operand count. PiperOrigin-RevId: 251585488
* NFC: Rename FuncBuilder to OpBuilder and refactor to take a top level region ↵River Riddle2019-06-094-11/+26
| | | | | | instead of a function. PiperOrigin-RevId: 251563898
* Add support to FuncOp for managing argument attributes. The syntax for ↵River Riddle2019-06-091-20/+79
| | | | | | | | | | | | argument attributes is the same as Function: func @foo(i1 {dialect.attr: 10 : i64}) func @foo(%arg0: i1 {dialect.attr: 10 : i64}) { return } PiperOrigin-RevId: 251473338
* Add a utility function to OperationName for extracting the dialect name.River Riddle2019-06-031-14/+10
| | | | PiperOrigin-RevId: 251333376
* Replace comments referring to "vector or tensor" with "shaped" where appropriateGeoffrey Martin-Noble2019-06-031-3/+3
| | | | PiperOrigin-RevId: 251306752
* Start defining a new operation 'FuncOp' that replicates all of the ↵River Riddle2019-06-032-2/+207
| | | | | | functionality of 'Function', but with an operation. The pretty syntax for the operation is exactly the same as that of Function. This operation is currently builtin, but should hopefully be moved to a different dialect when it has been completely decoupled from IR/. This is the first patch in a large series that refactors Functions to be represented as operations. PiperOrigin-RevId: 251281612
* Avoid failure due to incomplete type specification.Jacques Pienaar2019-06-011-0/+4
| | | | | | -- PiperOrigin-RevId: 251048081
* Move NamedAttributeList::get() method out-of-line (fix CMake build due ↵Mehdi Amini2019-06-011-0/+5
| | | | | | | | to missing include) -- PiperOrigin-RevId: 251000296
* Use size_t for tuple type sizeGeoffrey Martin-Noble2019-06-011-1/+1
| | | | | | | | This is more consistent with standard containers. -- PiperOrigin-RevId: 250985851
* Consistently use int64_t for shape-related values in shaped typesGeoffrey Martin-Noble2019-06-012-7/+10
| | | | | | | | | | We want to support 64-bit shapes (even when the compiler is on a 32-bit architecture). Using int64_t consistently allows us to sidestep the bugginess of unsigned arithmetic. Still unsigned: kind, memory space, and bit width. The first two are basically enums. We could have a discussion about the last one, but it's basically just a very large enum as well and we're not doing any math on it, I think. -- PiperOrigin-RevId: 250985791
* Add support for providing an output stream to the ↵River Riddle2019-06-011-12/+21
| | | | | | | | SourceMgrDiagnosticHandlers. -- PiperOrigin-RevId: 250974331
* Some cleanup of ShapedType now that MemRef subclasses it.Geoffrey Martin-Noble2019-06-011-20/+8
| | | | | | | | | | | Extract common methods into ShapedType. Simplify methods. Remove some extraneous asserts. Replace sentinel value with a helper method to check the same. -- PiperOrigin-RevId: 250945261
* Make MemRefType subclass ShapedTypeGeoffrey Martin-Noble2019-06-013-10/+6
| | | | | | | | | | | | MemRefs have the same notion of shape, rank, and fixed element type. This allows us to reuse utilities based on shape for memref. All dyn_cast and isa calls for ShapedType have been checked and either modified to explicitly check for vector or tensor, or confirmed to not depend on the result being a vector or tensor. Discussion in https://groups.google.com/a/tensorflow.org/forum/#!topic/mlir/cHLoyfGu8y8 -- PiperOrigin-RevId: 250945184
* Abstract the internal storage of the NamedAttributeList into a new ↵River Riddle2019-06-015-161/+170
| | | | | | | | | | | attribute, DictionaryAttr. This attribute maintains a sorted list of NamedAttributes. This will allow for operations/functions to maintain sub dictionaries of attributes. The syntax is the same as top level attribute dictionaries: {sub_dictionary: {fn: @someFn, boolAttr: true}} -- PiperOrigin-RevId: 250898950
* Make getRank abort for unranked typeGeoffrey Martin-Noble2019-06-011-1/+2
| | | | | | | | This better matches the other methods in ShapedType which only make sense for ranked types. There's now an explicit hasRank for checking the rank. Actual call sites rarely used the "-1" sentinel to combine checking for rankedness and checking that rank is a certain value. And in most cases they should actually be checking for rankedness at a higher level using type predicates. Using an explicit method is clearer than a sentinel anyway. -- PiperOrigin-RevId: 250720853
* Exclude all ShapedType subclasses other than TensorType subclasses from ↵Geoffrey Martin-Noble2019-06-011-5/+6
| | | | | | | | | | having non-scalar elements. The current logic assumes that ShapedType indicates a vector or tensor, which will not be true soon when MemRef subclasses ShapedType -- PiperOrigin-RevId: 250586364
* Make it clear that ElementsAttr is only for static shaped vectors or ↵Geoffrey Martin-Noble2019-06-011-0/+9
| | | | | | | | | | tensors. This is in preparation for making MemRef a subclass of ShapedType, but also UnrankedTensor should already be excluded. -- PiperOrigin-RevId: 250580197
* Remove "size" property of affine maps.MLIR Team2019-06-016-78/+28
| | | | | | -- PiperOrigin-RevId: 250572818
* Replace the Function reference methods from the OpAsmParser/OpAsmPrinter ↵River Riddle2019-06-011-8/+0
| | | | | | | | with usages of FunctionAttr. -- PiperOrigin-RevId: 250555680
* Do not assume Blocks belong to FunctionsAlex Zinenko2019-06-011-4/+4
| | | | | | | | | | | | | | | Fix Block::splitBlock and Block::eraseFromFunction that erronously assume blocks belong to functions. They now belong to regions. When splitting, new blocks should be created in the same region as the existing block. When erasing a block, it should be removed from the region rather than from the function body that transitively contains the region. Also rename Block::eraseFromFunction to Block::erase for consistency with other IR containers. -- PiperOrigin-RevId: 250278272
* Add support to RewritePattern for specifying the potential operations ↵River Riddle2019-06-011-0/+14
| | | | | | | | that can be generated during a rewrite. This will enable analyses to start understanding the possible effects of applying a rewrite pattern. -- PiperOrigin-RevId: 249936309
* Update the type printer for Diagnostic to automatically wrap the type ↵River Riddle2019-06-011-1/+1
| | | | | | | | with ''. -- PiperOrigin-RevId: 249935489
* Move the definitions of CmpIOp, CmpFOp, and SelectOp to the ODG framework.River Riddle2019-06-011-0/+2
| | | | | | -- PiperOrigin-RevId: 249928953
* Replace checks for rank -1 with direct calls to hasRankGeoffrey Martin-Noble2019-06-011-1/+1
| | | | | | | | Also removed a redundant check for rank after already checking for static shape (which implies rank) -- PiperOrigin-RevId: 249927636
* Limit the number of places where shaped type has to explicitly reference ↵Geoffrey Martin-Noble2019-06-011-34/+15
| | | | | | | | | | | | its base classes. Introduces a hasRank() method to make checking for rank a bit easier. This is partially to make it easier to make MemRef subclass ShapedType -- PiperOrigin-RevId: 249927442
* Add a type-constrained nested tuple type.Geoffrey Martin-Noble2019-06-011-0/+13
| | | | | | | | This is useful for dialects that use tuples but only support a subset of types. -- PiperOrigin-RevId: 249910133
* Add operand type iterators to Operation and cleanup usages of ↵River Riddle2019-06-012-31/+25
| | | | | | | | operand->getType. This also simplifies some lingering usages of result->getType. -- PiperOrigin-RevId: 249889174
OpenPOWER on IntegriCloud