summaryrefslogtreecommitdiffstats
path: root/mlir/lib/IR
Commit message (Collapse)AuthorAgeFilesLines
...
* Introduce a new common diagnostic handler ScopedDiagnosticHandler to ↵River Riddle2019-06-011-1/+17
| | | | | | | | simplify saving and restoring the currently registered handler. -- PiperOrigin-RevId: 249735912
* Added the ability to run a mapping function across the values of an elementsRob Suderman2019-06-011-0/+157
| | | | | | | | | attr. This supports both the SplatElementsAttr and DenseElementsAttr for both float and integer inputs / outputs. -- PiperOrigin-RevId: 249681056
* Add LLVM::IntToPtrOp and LLVM::PtrToIntOp to LLVM dialect.Stephan Herhut2019-06-011-2/+5
| | | | | | -- PiperOrigin-RevId: 249604199
* Automated rollback of changelist 249538085.Rob Suderman2019-06-011-167/+0
| | | | PiperOrigin-RevId: 249550805
* Added the ability to run a mapping function across the values of an elementsRob Suderman2019-06-011-0/+167
| | | | | | | | | attr. This supports both the SplatElementsAttr and DenseElementsAttr for both float and integer inputs / outputs. -- PiperOrigin-RevId: 249538085
* Refactor FunctionAttr to hold the internal function reference by name ↵River Riddle2019-06-015-117/+17
| | | | | | | | | | | | | | | | instead of pointer. The one downside to this is that the function reference held by a FunctionAttr needs to be explicitly looked up from the parent module. This provides several benefits though: * There is no longer a need to explicitly remap function attrs. - This removes a potentially expensive call from the destructor of Function. - This will enable some interprocedural transformations to now run intraprocedurally. - This wasn't scalable and forces dialect defined attributes to override a virtual function. * Replacing a function is now a trivial operation. * This is a necessary first step to representing functions as operations. -- PiperOrigin-RevId: 249510802
* Return nullptr on ↵Mehdi Amini2019-06-011-2/+0
| | | | | | | | | | | | Region::getContainingOperation()/getContainingFunction() instead of asserting This avoids crashing when trying to dump an operation nested in a region that isn't yet attached to an operation, which is quite useful when debugging. This alone won't be enough to print an unlink Operation, it'll display `<<UNLINKED INSTRUCTION>>`. -- PiperOrigin-RevId: 249496388
* Update Attribute::getDialect/Type::getDialect to return a non-const ↵River Riddle2019-06-013-4/+4
| | | | | | | | dialect reference. -- PiperOrigin-RevId: 249467245
* NFC: Fix the name of a comment header block in Diagnostics.cpp.River Riddle2019-06-011-1/+1
| | | | | | -- PiperOrigin-RevId: 249466645
* Make the ParallelDiagnosticHandler used by the pass manager publicly ↵River Riddle2019-06-011-0/+128
| | | | | | | | available in Diagnostics.h. This provides a common utility for deterministically handling diagnostics in a multi-threaded environment. -- PiperOrigin-RevId: 249325937
* Move SDBM uniquer into the SDBM dialectAlex Zinenko2019-06-011-11/+0
| | | | | | | | | | | | | | MLIRContext does not have to be aware of the SDBM unique data structures directly. Move the SDBM storage uniquer from MLIRContext to the SDBM dialect instance. Expressions that previously required a context to be constructed now require an instance of the dialect in order to access the uniquer. While they could look up the dialect in the context, it would have introduced a rather expensive lookup into each construction. Instead, the caller is expected to obtain the dialect instance and cache it. -- PiperOrigin-RevId: 249245199
* Move SDBM infrastructure into a new SDBM dialectAlex Zinenko2019-06-013-1338/+0
| | | | | | | | | | | We now have sufficient extensibility in dialects to move attribute components such as SDBM out of the core IR into a dedicated dialect and make them optional. Introduce an SDBM dialect and move the code. This is a mostly non-functional change. -- PiperOrigin-RevId: 249244802
* SDBMExpr: factor uniqu'ing out of MLIRContext.cppAlex Zinenko2019-06-013-135/+170
| | | | | | | | | | | | | SDBM expressions are designed as components of an attribute, similarly to affine expressions. As such, they need to be unique'd in the MLIRContext. When SDBM expressions were implemented, uniqu'ing objects in a context required to modify MLIRContext implementation. This is no longer the case as generic StorageUniquer has been introduced. Port the SDBMExpr uniqu'ing to use a newly introduced uniquer and remove SDBM construction from MLIRContext.cpp. -- PiperOrigin-RevId: 249244739
* AffineExpr: factor uniqu'ing out of MLIRContext.cppAlex Zinenko2019-06-013-352/+335
| | | | | | | | | | | | | Affine expressions are designed as components of an attribute and are unique'd in the MLIRContext. When affine expressions were implemented, uniqu'ing objects in a context required to modify MLIRContext implementation. This is no longer the case as generic StorageUniquer has been introduced. Port the AffineExpr construction to use the new infrastructure by introducing an affineUniquer into the MLIRContext. -- PiperOrigin-RevId: 249207539
* When changing the type of a Function, also update the type of the ↵River Riddle2019-06-012-0/+9
| | | | | | | | respective FunctionAttr. -- PiperOrigin-RevId: 249137558
* Add support for streaming an OperationName into a Diagnostic.River Riddle2019-05-202-1/+9
| | | | | | -- PiperOrigin-RevId: 248987646
* Allow a function to take the name of another existing function.River Riddle2019-05-201-0/+8
| | | | | | -- PiperOrigin-RevId: 248968285
* Add support for streaming Operations into Diagnostics.River Riddle2019-05-201-0/+4
| | | | | | -- PiperOrigin-RevId: 248967563
* Add a utility function 'Operation::replaceUsesOfWith' to replace uses of ↵River Riddle2019-05-201-0/+9
| | | | | | | | a value within a single operation. -- PiperOrigin-RevId: 248961779
* Make shape matching work for any shaped type.Geoffrey Martin-Noble2019-05-201-14/+11
| | | | | | | | | | | | The current implementation makes some assumptions about what can be a shaped type, which aren't really necessary. It also has strange behavior for types that aren't in the limited set it handles (e.g. dialect-defined types) Updated the comment to match the implementation. This is partially motivated by the desire to make MemRef a subclass of ShapedType -- PiperOrigin-RevId: 248859674
* Rewrite the DialectOpConversion patterns to inherit from RewritePattern ↵River Riddle2019-05-201-3/+4
| | | | | | | | instead of Pattern. This simplifies the infrastructure a bit by being able to reuse PatternRewriter and the RewritePatternMatcher, but also starts to lay the groundwork for a more generalized legalization framework that can operate on DialectOpConversions as well as normal RewritePatterns. -- PiperOrigin-RevId: 248836492
* Refactor PatternRewriter to inherit from FuncBuilder instead of Builder. ↵River Riddle2019-05-201-0/+2
| | | | | | | | This is necessary for allowing more complicated rewrites in the future that may do things like update the insertion point (e.g. for rewrites involving regions). -- PiperOrigin-RevId: 248803153
* Also visit memref element type in AsmPrinterGeoffrey Martin-Noble2019-05-201-3/+8
| | | | | | -- PiperOrigin-RevId: 248797935
* Fix use of variables only used in asserts.MLIR Team2019-05-201-2/+6
| | | | | | | | This otherwise triggers "unused variable" errors in optimized build mode. -- PiperOrigin-RevId: 248706350
* Overload arithmetic operators for SDBM expressionsAlex Zinenko2019-05-202-22/+120
| | | | | | | | | | | | | | | | Provide an "unsafe" version of the overloaded arithmetic operators for SDBM expressions. These operators expect the operands to be of the right SDBM expression subtype and assert if they are not. They also perform simple folding operations as well as some semantically correct operations that construct an SDBM expression of a different subtype, e.g., a difference expression if the RHS of an operator+ is a negated variable. These operators are scoped in a namespace to allow for a future "safe" version of the operators that propagates null expressions to denote the error state when expressions have wrong subtypes. -- PiperOrigin-RevId: 248704153
* Implement SDBM and conversion between SDBM and lists of SDBMExprAlex Zinenko2019-05-202-70/+597
| | | | | | | | | | | | Implement the storage class for striped difference-bound matrices (SDBM) as a container with a difference bounds matrix and a list of stripe expressions. An SDBM defines an integer set. Provide conversion mechanisms between lists of SDBM expressions treated as equalities with zero or less-than-or-equal inequalities with zero. -- PiperOrigin-RevId: 248702871
* Don't fail verifying unranked shapes as being the same as this could be ↵Jacques Pienaar2019-05-201-1/+1
| | | | | | | | | | valid at runtime. tensor<*xf32> could be a tensor<1xf32> at runtime but this verifyShapeMatch would return failure and say function is invalid. -- PiperOrigin-RevId: 248583038
* Unify the 'constantFold' and 'fold' hooks on an operation into just ↵River Riddle2019-05-201-32/+24
| | | | | | | | 'fold'. This new unified fold hook will take constant attributes as operands, and may return an existing 'Value *' or a constant 'Attribute' when folding. This removes the awkward situation where a simple canonicalization like "sub(x,x)->0" had to be written as a canonicalization pattern as opposed to a fold. -- PiperOrigin-RevId: 248582024
* Rename VectorOrTensorType to ShapedTypeGeoffrey Martin-Noble2019-05-206-59/+52
| | | | | | | | | | | | This is in preparation for making it also support/be a parent class of MemRefType. MemRefs have similar shape/rank/element semantics and it would be useful to be able to use these same utilities for them. This CL should not change any semantics and only change variables, types, string literals, and comments. In follow-up CLs I will prepare all callers to handle MemRef types or remove their dependence on ShapedType. Discussion/Rationale in https://groups.google.com/a/tensorflow.org/forum/#!topic/mlir/cHLoyfGu8y8 -- PiperOrigin-RevId: 248476449
* Add support for parsing/printing dialect defined attributes. This also ↵River Riddle2019-05-206-87/+175
| | | | | | | | | | | | adds support for a pretty syntax for dialects attributes that is synonymous with the pretty syntax for dialect types. This cl also adds a new attribute 'OpaqueAttr' that allows for roundtripping attributes attached to unregistered dialects. Dialect attributes have the following syntax: dialect-attribute ::= `#` dialect-namespace `<` `"` attr-data `"` `>` dialect-attribute ::= `#` alias-name pretty-dialect-sym-body? -- PiperOrigin-RevId: 248344416
* Remove some extraneous const qualifiers on Type, and 0b1 -> 1 in tblgen ↵Chris Lattner2019-05-203-7/+7
| | | | | | | | files. (NFC) -- PiperOrigin-RevId: 248332674
* Add an AffineExpr matcherNicolas Vasilache2019-05-201-74/+137
| | | | | | | | | | This CL gives a pattern-matching-y look and feel to AffineExpr. For now this uses a shared_ptr instead of unique'ing into a bumpPtrAllocator. SDBM gives a simple use case with more idiomatic syntax for matchers. -- PiperOrigin-RevId: 248188075
* When converting a location to an SMLoc, advance to the first ↵River Riddle2019-05-201-3/+16
| | | | | | | | | | | | | | | | | | | | | | non-whitespace if the column is unknown(zero). This also fixes a small bug with call stack printing. Example: /tmp/file_C.py:21:5: error: 'foo.bar' op attribute 'something' raise app.UsageError('Too many command-line arguments.') ^ /tmp/file_D.py:20:3: note: called from if len(argv) > 1: ^ /tmp/file_E.py:19:1: note: called from def main(argv): ^ /tmp/file_F.py:24:3: note: called from app.run(main) ^ -- PiperOrigin-RevId: 248151212
* Add initial support to the SourceMgrDiagnosticHandler for printing call ↵River Riddle2019-05-201-33/+63
| | | | | | | | | | | | | | | | | | | | | | | stacks. Example: /tmp/file_C.py:17:1: error: 'foo.bar' op attribute 'something' ... app.run(main) ^ /tmp/file_D.py:14:1: note: called from raise app.UsageError('Too many command-line arguments.') ^ /tmp/file_E.py:12:1: note: called from def main(argv): ^ /tmp/file_F.py:13:1: note: called from if len(argv) > 1: ^ -- PiperOrigin-RevId: 248074804
* Fix lingering sign compare warnings in exposed by "ninja check-mlir".Stella Laurenzo2019-05-201-1/+2
| | | | | | -- PiperOrigin-RevId: 248050178
* Refactor NameLoc so that it also holds a child location. This removes ↵River Riddle2019-05-204-5/+27
| | | | | | | | the awkward use of CallSiteLoc as a variable usage location. -- PiperOrigin-RevId: 248014642
* Use the DialectSymbolRegistry to reserve space in the Attribute::Kind ↵River Riddle2019-05-202-61/+51
| | | | | | | | enum to allow for dialects to define attribute kinds. The currently defined attributes kinds have now been moved to StandardAttributes. -- PiperOrigin-RevId: 247988373
* NFC: Cleanup the definitions of the Location classes.River Riddle2019-05-203-25/+33
| | | | | | -- PiperOrigin-RevId: 247979132
* Refactor the includes of Function.h now that the dependency on Operation ↵River Riddle2019-05-203-3/+8
| | | | | | | | has been removed. The dependency was on the op casting methods, which have now moved out of Operation, used by the walker. -- PiperOrigin-RevId: 247944666
* Remove several heavy includes from Diagnostics.h by a moving a couple of ↵River Riddle2019-05-201-20/+60
| | | | | | | | fields/methods to the .cpp file. -- PiperOrigin-RevId: 247768443
* Change the diagnostic handler to accept Diagnostic instead of ↵River Riddle2019-05-101-48/+43
| | | | | | | | location/message/kind. This opens the door for many more powerful use cases: fixits, colors, etc. -- PiperOrigin-RevId: 247705673
* Ensure that all attributes are registered with a dialect. This is one of ↵River Riddle2019-05-102-33/+45
| | | | | | | | the final steps towards allowing dialects to define their own attributes, but there are still several things missing before this is fully supported(e.g. parsing/printing ). -- PiperOrigin-RevId: 247684322
* Add support to the SourceMgrDiagnosticHandlers to auto-load new source ↵River Riddle2019-05-101-3/+4
| | | | | | | | files seen in diagnostics. -- PiperOrigin-RevId: 247681779
* Add llvm_unreachable in unreachable path to silence GCC warning (NFC)Mehdi Amini2019-05-105-1/+12
| | | | | | | | | The switch is supposed to be fully covered, but GCC warns that: "control reaches end of non-void function" -- PiperOrigin-RevId: 247672430
* Refactor the SourceMgrDiagnosticHandlers to support more locations than ↵River Riddle2019-05-101-9/+30
| | | | | | | | FileLineColLoc. -- PiperOrigin-RevId: 247662828
* Add support to SourceMgrDiagnosticHandler for handling the case where ↵River Riddle2019-05-101-13/+22
| | | | | | | | the llvm::SourceMgr has no main file. -- PiperOrigin-RevId: 247605584
* Add override keyword on overidden virtual method (NFC)Mehdi Amini2019-05-101-8/+10
| | | | | | | | Fix clang warnings -- PiperOrigin-RevId: 247556495
* Move the diagnostic verification functionality out of mlir-opt and into ↵River Riddle2019-05-101-0/+200
| | | | | | | | a new llvm::SourceMgr diagnostic handler 'SourceMgrDiagnosticVerifierHandler'. This will allow for other tools to reuse the 'expected-*' functionality. -- PiperOrigin-RevId: 247514684
* Add support in the SourceMgrDiagnosticHandler for handling source ↵River Riddle2019-05-101-5/+25
| | | | | | | | managers with multiple buffers. -- PiperOrigin-RevId: 247482733
* Fix OSS build (Linux)Nicolas Vasilache2019-05-101-2/+3
| | | | | | -- PiperOrigin-RevId: 247472005
OpenPOWER on IntegriCloud