summaryrefslogtreecommitdiffstats
path: root/mlir/lib/IR/Operation.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* NFC: Rename FuncBuilder to OpBuilder and refactor to take a top level region ↵River Riddle2019-06-091-2/+1
| | | | | | instead of a function. PiperOrigin-RevId: 251563898
* 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
* 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
* Add operand type iterators to Operation and cleanup usages of ↵River Riddle2019-06-011-27/+21
| | | | | | | | operand->getType. This also simplifies some lingering usages of result->getType. -- PiperOrigin-RevId: 249889174
* Add LLVM::IntToPtrOp and LLVM::PtrToIntOp to LLVM dialect.Stephan Herhut2019-06-011-2/+5
| | | | | | -- PiperOrigin-RevId: 249604199
* Add support for streaming an OperationName into a Diagnostic.River Riddle2019-05-201-1/+1
| | | | | | -- PiperOrigin-RevId: 248987646
* 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
* 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-201-8/+8
| | | | | | | | | | | | 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
* NFC: Make ParseResult public and update the OpAsmParser(and thus all of ↵River Riddle2019-05-101-12/+13
| | | | | | | | the custom operation parsers) to use it instead of bool. -- PiperOrigin-RevId: 246955523
* CmpFOp. Add float comparison opGeoffrey Martin-Noble2019-05-101-0/+9
| | | | | | | | | | This closely mirrors the llvm fcmp instruction, defining 16 different predicates Constant folding is unsupported for NaN and Inf because there's no way to represent those as constants at the moment -- PiperOrigin-RevId: 246932358
* Simplify several usages of attributes now that they always have a type ↵River Riddle2019-05-101-1/+1
| | | | | | | | | | and, transitively, access to the context. This also fixes a bug where FunctionAttrs were not being remapped for function and function argument attributes. -- PiperOrigin-RevId: 246876924
* Namespaceify a few explicit template specializations to appease errors ↵River Riddle2019-05-061-0/+6
| | | | | | | | | | caused by a bug in gcc versions < 7.0. (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480) -- PiperOrigin-RevId: 246664463
* Add SameOperandsAndResultElementType trait.Jacques Pienaar2019-05-061-0/+33
| | | | | | | | This trait only works for tensor and vector types at the moment, verifying that the element type of an op with only tensor and vector types match. Added a unit test for it as there is no op currently in core that uses this trait. -- PiperOrigin-RevId: 246661697
* Make the Twine parameter of the current diagnostic emit functions ↵River Riddle2019-05-061-38/+37
| | | | | | | | optional. This allows for the ability to exclusively use the new diagnostic interface without breaking all of the existing usages. Several diagnostics emitted in lib/IR have been updated to make use of this functionality. -- PiperOrigin-RevId: 246546044
* Add an MLIRContext::emitWarning utility method.River Riddle2019-05-061-3/+1
| | | | | | -- PiperOrigin-RevId: 246546015
* Add the ability to attach notes to Diagnostic/InFlightDiagnostic.River Riddle2019-05-061-13/+0
| | | | | | | | | | | | | Notes are a way to add additional context to a diagnostic, but don't really make sense as standalone diagnostics. Moving forward, notes will no longer be able to be constructed directly and must be attached to a parent Diagnostic. Notes can be attached via `attachNote`: auto diag = ...; diag.attachNote() << "This is a note"; -- PiperOrigin-RevId: 246545971
* Introduce a new API for emitting diagnostics with Diagnostic and ↵River Riddle2019-05-061-25/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | InFlightDiagnostic. The Diagnostic class contains all of the information necessary to report a diagnostic to the DiagnosticEngine. It should generally not be constructed directly, and instead used transitively via InFlightDiagnostic. A diagnostic is currently comprised of several different elements: * A severity level. * A source Location. * A list of DiagnosticArguments that help compose and comprise the output message. * A DiagnosticArgument represents any value that may be part of the diagnostic, e.g. string, integer, Type, Attribute, etc. * Arguments can be added to the diagnostic via the stream(<<) operator. * (In a future cl) A list of attached notes. * These are in the form of other diagnostics that provide supplemental information to the main diagnostic, but do not have context on their own. The InFlightDiagnostic class represents an RAII wrapper around a Diagnostic that is set to be reported with the diagnostic engine. This allows for the user to modify a diagnostic that is inflight. The internally wrapped diagnostic can be reported directly or automatically upon destruction. These classes allow for more natural composition of diagnostics by removing the restriction that the message of a diagnostic is comprised of a single Twine. They should also allow for nice incremental improvements to the diagnostics experience in the future, e.g. formatv style diagnostics. Simple Example: emitError(loc, "integer bitwidth is limited to " + Twine(IntegerType::kMaxWidth) + " bits"); emitError(loc) << "integer bitwidth is limited to " << IntegerType::kMaxWidth << " bits"; -- PiperOrigin-RevId: 246526439
* Add support for basic remark diagnostics. This is the minimal ↵River Riddle2019-05-061-0/+12
| | | | | | | | functionality needed to separate notes from remarks. It also provides a starting point to start building out better remark infrastructure. -- PiperOrigin-RevId: 246175216
* Start sketching out a new diagnostics infrastructure. Create a new class ↵River Riddle2019-05-061-4/+5
| | | | | | | | 'DiagnosticEngine' and move the diagnostic handler support and final diagnostic emission from the MLIRContext to it. -- PiperOrigin-RevId: 246163897
* Make identity cast operations with the same operand and result types legalSmit Hinsu2019-05-061-0/+8
| | | | | | | | | | | | Instead, fold such operations. This way callers don't need to conditionally create cast operations depending on if a value already has the target type. Also, introduce areCastCompatible to allow cast users to verify that the generated op will be valid before creating the operation. TESTED with unit tests -- PiperOrigin-RevId: 245606133
* Introduce functionality for defining region ancestor relationAlex Zinenko2019-05-061-0/+4
| | | | | | | | | | | | Add member functions for Regions to query if another Region is a ancestor. The implementation is naive and traverses all parent regions performing one-to-one comparisons. As a side effect, this introduces `getContainingRegion` function for Operations and Values to return the Region in which they are defined, and for Regions to return the "parent" region if any. -- PiperOrigin-RevId: 245057980
* NFC: Replace usages of iterator_range<operand_iterator> with operand_range.River Riddle2019-04-051-3/+2
| | | | | | -- PiperOrigin-RevId: 242031201
* Remove the non-postorder walk functions from Function/Block/Instruction ↵River Riddle2019-04-051-11/+0
| | | | | | | | and rename walkPostOrder to walk. -- PiperOrigin-RevId: 241965239
* Rewrite the verify hooks on operations to use LogicalResult instead of ↵River Riddle2019-04-021-62/+63
| | | | | | | | bool. This also changes the return of Operation::emitError/emitOpError to LogicalResult as well. -- PiperOrigin-RevId: 241588075
* Dialect Conversion: convert regions of operations when cloning themAlex Zinenko2019-03-291-10/+26
| | | | | | | | | | | | Dialect conversion currently clones the operations that did not match any pattern. This includes cloning any regions that belong to these operations. Instead, apply conversion recursively to the nested regions. Note that if an operation matched one of the conversion patterns, it is up to the pattern rewriter to fill in the regions of the converted operation. This may require calling back to the converter and is left for future work. PiperOrigin-RevId: 240872410
* Rename InstOperand to OpOperand.River Riddle2019-03-291-9/+9
| | | | PiperOrigin-RevId: 240814651
* Replace remaining usages of the Instruction class with Operation.River Riddle2019-03-291-5/+5
| | | | PiperOrigin-RevId: 240777521
* Replace usages of Instruction with Operation in the /Analysis directory.River Riddle2019-03-291-3/+3
| | | | PiperOrigin-RevId: 240569775
* Introduce affine terminatorAlex Zinenko2019-03-291-0/+12
| | | | | | | | | | | | | | | | | | | | | | Due to legacy reasons (ML/CFG function separation), regions in affine control flow operations require contained blocks not to have terminators. This is inconsistent with the notion of the block and may complicate code motion between regions of affine control operations and other regions. Introduce `affine.terminator`, a special terminator operation that must be used to terminate blocks inside affine operations and transfers the control back to he region enclosing the affine operation. For brevity and readability reasons, allow `affine.for` and `affine.if` to omit the `affine.terminator` in their regions when using custom printing and parsing format. The custom parser injects the `affine.terminator` if it is missing so as to always have it present in constructed operations. Update transformations to account for the presence of terminator. In particular, most code motion transformation between loops should leave the terminator in place, and code motion between loops and non-affine blocks should drop the terminator. PiperOrigin-RevId: 240536998
* Include numeric header for std::accumulate.Jacques Pienaar2019-03-291-0/+1
| | | | PiperOrigin-RevId: 240462910
* Replace usages of Instruction with Operation in the /IR directory.River Riddle2019-03-291-20/+19
| | | | | | 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-291-24/+582
| | | | | | | | 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
* Push a bunch of 'consts' out of the *Op structure, in prep for removingChris Lattner2019-03-291-4/+4
| | | | | | OpPointer. PiperOrigin-RevId: 240044712
* Remove const from Value, Instruction, Argument, and the various methods on theChris Lattner2019-03-291-24/+22
| | | | | | *Op classes. This is a net reduction by almost 400LOC. PiperOrigin-RevId: 239972443
* Now that ConstOpPointer is gone, we can change the various methods generated byChris Lattner2019-03-291-3/+1
| | | | | | | | | | tblgen be non-const. This requires introducing some const_cast's at the moment, but those (and lots more stuff) will disappear in subsequent patches. This significantly simplifies those patches because the various tblgen op emitters get adjusted. PiperOrigin-RevId: 239954566
* Remove const from mlir::Block.Chris Lattner2019-03-291-2/+2
| | | | | | 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-1/+1
| | | | | | from Function. PiperOrigin-RevId: 239638635
* Remove the restriction that only registered terminator operations may ↵River Riddle2019-03-291-4/+0
| | | | | | terminate a block and have block operands. This allows for any operation to hold block operands. It also introduces the notion that unregistered operations may terminate a block. As such, the 'isTerminator' api on Instruction has been split into 'isKnownTerminator' and 'isKnownNonTerminator'. PiperOrigin-RevId: 233076831
* Begin the process of fully removing OperationInst. This patch cleans up ↵River Riddle2019-03-291-21/+21
| | | | | | references to OperationInst in the /include, /AffineOps, and lib/Analysis. PiperOrigin-RevId: 232199262
* Fold the functionality of OperationInst into Instruction. OperationInst ↵River Riddle2019-03-291-1/+1
| | | | | | still exists as a forward declaration and will be removed incrementally in a set of followup cleanup patches. PiperOrigin-RevId: 232198540
* Recommit: Define a AffineOps dialect as well as an AffineIfOp operation. ↵River Riddle2019-03-291-1/+1
| | | | | | Replace all instances of IfInst with AffineIfOp and delete IfInst. PiperOrigin-RevId: 231342063
* Automated rollback of changelist 231318632.Nicolas Vasilache2019-03-291-1/+1
| | | | PiperOrigin-RevId: 231327161
* Define a AffineOps dialect as well as an AffineIfOp operation. Replace all ↵River Riddle2019-03-291-1/+1
| | | | | | instances of IfInst with AffineIfOp and delete IfInst. PiperOrigin-RevId: 231318632
* Unify terms regarding assembly form to use generic vs. customLei Zhang2019-03-291-6/+6
| | | | | | | | | | | | This CL just changes various docs and comments to use the term "generic" and "custom" when mentioning assembly forms. To be consist, several methods are also renamed: * FunctionParser::parseVerboseOperation() -> parseGenericOperation() * ModuleState::hasShorthandForm() -> hasCustomForm() * OpAsmPrinter::printDefaultOp() -> printGenericOp() PiperOrigin-RevId: 230568819
OpenPOWER on IntegriCloud