summaryrefslogtreecommitdiffstats
path: root/mlir/lib/IR/MLIRContext.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Adjust License.txt file to use the LLVM licenseMehdi Amini2019-12-231-13/+4
| | | | PiperOrigin-RevId: 286906740
* Add UnrankedMemRef Typenmostafa2019-12-051-2/+2
| | | | | | | Closes tensorflow/mlir#261 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/261 from nmostafa:nmostafa/unranked 96b6e918f6ed64496f7573b2db33c0b02658ca45 PiperOrigin-RevId: 284037040
* Fix minor spelling tweaks (NFC)Kazuaki Ishizaki2019-10-201-1/+1
| | | | | | Closes tensorflow/mlir#177 PiperOrigin-RevId: 275692653
* Add OpaqueLoc to MLIR locations.MLIR Team2019-10-071-1/+2
| | | | | | | | | See RFC: https://groups.google.com/a/tensorflow.org/forum/#!topic/mlir/xE2IzfhE3Wg. Opaque location stores two pointers, one of them points to some data structure that is external to MLIR, and the other one is unique for each type and represents type id of that data structure. OpaqueLoc also stores an optional location that can be used if the first one is not suitable. OpaqueLoc is managed similar to FileLineColLoc. It is passed around by MLIR transformations and can be used in compound locations like CallSiteLoc. PiperOrigin-RevId: 273266510
* Fix typos, NFC.Christian Sigg2019-10-041-4/+4
| | | | PiperOrigin-RevId: 272851237
* NFC: Keep the dialect list in the context sorted by namespace.River Riddle2019-08-201-6/+14
| | | | | | Most dialects are initialized statically, which does not have a guaranteed initialization order. By keeping the dialect list sorted, we can guarantee a deterministic iteration order of dialects. PiperOrigin-RevId: 264522875
* Fix build of affine load/store with empty mapDiego Caballero2019-08-201-1/+1
| | | | | | | | | | | | | | | tensorflow/mlir#58 fixed and exercised verification of load/store ops using empty affine maps. Unfortunately, it didn't exercise the creation of them. This PR addresses that aspect. It removes the assumption of AffineMap having at least one result and stores a pointer to MLIRContext as member of AffineMap. * Add empty map support to affine.store + test * Move MLIRContext to AffineMapStorage Closes tensorflow/mlir#74 PiperOrigin-RevId: 264416260
* Fix verification of zero-dim memref in ↵Diego Caballero2019-08-071-6/+15
| | | | | | | | | | | | | affine.load/affine.store/std.load/std.store Verification complained when using zero-dimensional memrefs in affine.load, affine.store, std.load and std.store. This PR extends verification so that those memrefs can be used. Closes tensorflow/mlir#58 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/58 from dcaballe:dcaballe/zero-dim 49bcdcd45c52c48beca776431328e5ce551dfa9e PiperOrigin-RevId: 262164916
* Add missing include to DenseMap in MLIRContext.cppMehdi Amini2019-08-011-0/+1
| | | | | | This is fixing the build of MLIR on MacOS when built within TensorFlow PiperOrigin-RevId: 261223250
* Rename FunctionAttr to SymbolRefAttr.River Riddle2019-07-121-1/+1
| | | | | | This allows for the attribute to hold symbolic references to other operations than FuncOp. This also allows for removing the dependence on FuncOp from the base Builder. PiperOrigin-RevId: 257650017
* NFC: Replace Module::getNamedFunction with lookupSymbol<FuncOp>.River Riddle2019-07-121-0/+1
| | | | | | This allows for removing the last direct reference to FuncOp from ModuleOp. PiperOrigin-RevId: 257498296
* Move the emitError/Warning/Remark utility methods out of MLIRContext and ↵River Riddle2019-06-251-38/+0
| | | | | | | | into the mlir namespace. Now that Locations are attributes, they have direct access to the MLIR context. This allows for simplifying error emission by removing unnecessary context lookups. PiperOrigin-RevId: 255112791
* NFC: Uniformize the return of the LocationAttr 'get' methods to 'Location'.River Riddle2019-06-251-1/+1
| | | | PiperOrigin-RevId: 255078768
* Define a ModuleOp that represents a Module as an Operation.River Riddle2019-06-221-4/+4
| | | | | | | | | | | | | | | | | | The ModuleOp contains a single region that must contain a single block. This block must be terminated by a new pseudo operation 'module_terminator'. The syntax for this operations is as follows: `module` (`attributes` attr-dict)? region Example: module { ... } module attributes { ... } { ... } PiperOrigin-RevId: 254513752
* Refactor the location classes to be attributes instead of separate IR classes.River Riddle2019-06-221-213/+10
| | | | | | This will allow for locations to be used in the same contexts as attributes. Given that attributes are nullable types, the 'Location' class now represents a non-nullable wrapper around a 'LocationAttr'. This preserves the desired semantics we have for non-optional locations. PiperOrigin-RevId: 254505278
* Cache instances of several common attributes(e.g. BoolAttr, UnitAttr) and ↵River Riddle2019-06-221-0/+116
| | | | | | types(I1/I16/I32/etc.) when creating the MLIRContext. This allows for these symbols to be accessed without the need to perform any lookups/locking. PiperOrigin-RevId: 254410080
* Replace usages of 'UniquedFilename' with 'Identifier' and remove it. ↵River Riddle2019-06-191-15/+2
| | | | | | Identifier already contains all of the necessary functionality/verification, so having a separate class for filenames is unnecessary. PiperOrigin-RevId: 253855505
* Refactor SplatElementsAttr to inherit from DenseElementsAttr as opposed to ↵River Riddle2019-06-191-2/+1
| | | | | | 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
* Remove the explicit attribute kinds for DenseIntElementsAttr and ↵River Riddle2019-06-091-3/+3
| | | | | | 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
* Fix a warning for missing parentheses around '||' inside of an assert.River Riddle2019-06-091-3/+3
| | | | PiperOrigin-RevId: 251712106
* Start defining a new operation 'FuncOp' that replicates all of the ↵River Riddle2019-06-031-2/+7
| | | | | | 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
* Abstract the internal storage of the NamedAttributeList into a new ↵River Riddle2019-06-011-96/+2
| | | | | | | | | | | 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
* Remove "size" property of affine maps.MLIR Team2019-06-011-16/+9
| | | | | | -- PiperOrigin-RevId: 250572818
* Update Attribute::getDialect/Type::getDialect to return a non-const ↵River Riddle2019-06-011-2/+2
| | | | | | | | dialect reference. -- PiperOrigin-RevId: 249467245
* 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
* SDBMExpr: factor uniqu'ing out of MLIRContext.cppAlex Zinenko2019-06-011-111/+3
| | | | | | | | | | | | | 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-011-307/+7
| | | | | | | | | | | | | 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
* Add support for parsing/printing dialect defined attributes. This also ↵River Riddle2019-05-201-2/+3
| | | | | | | | | | | | 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
* Refactor NameLoc so that it also holds a child location. This removes ↵River Riddle2019-05-201-2/+4
| | | | | | | | the awkward use of CallSiteLoc as a variable usage location. -- PiperOrigin-RevId: 248014642
* NFC: Cleanup the definitions of the Location classes.River Riddle2019-05-201-15/+0
| | | | | | -- PiperOrigin-RevId: 247979132
* Refactor the includes of Function.h now that the dependency on Operation ↵River Riddle2019-05-201-0/+1
| | | | | | | | 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
* Ensure that all attributes are registered with a dialect. This is one of ↵River Riddle2019-05-101-15/+38
| | | | | | | | 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 a new ClassID utility class that allows for generating unique ↵River Riddle2019-05-101-3/+3
| | | | | | | | identifiers for class types. This replaces the duplicated functionality of AnalysisID/PassID/etc. -- PiperOrigin-RevId: 247237835
* Simplify several usages of attributes now that they always have a type ↵River Riddle2019-05-101-3/+3
| | | | | | | | | | 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
* Make the Twine parameter of the current diagnostic emit functions ↵River Riddle2019-05-061-6/+24
| | | | | | | | 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-0/+7
| | | | | | -- PiperOrigin-RevId: 246546015
* Introduce a new API for emitting diagnostics with Diagnostic and ↵River Riddle2019-05-061-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | 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/+5
| | | | | | | | 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-66/+11
| | | | | | | | 'DiagnosticEngine' and move the diagnostic handler support and final diagnostic emission from the MLIRContext to it. -- PiperOrigin-RevId: 246163897
* Refactor Attribute uniquing to use StorageUniquer instead of being hard ↵River Riddle2019-05-061-522/+6
| | | | | | | | coded in the MLIRContext. This allows for attributes to be uniqued similarly to types. This is the second step towards allowing dialects to define attributes. -- PiperOrigin-RevId: 245974705
* Fix opt build failure.Jacques Pienaar2019-05-061-1/+2
| | | | | | -- PiperOrigin-RevId: 245844236
* Add support for a NoneType.River Riddle2019-05-061-6/+8
| | | | | | | | | | none-type ::= `none` The `none` type is a unit type, i.e. a type with exactly one possible value, where its value does not have a defined dynamic representation. -- PiperOrigin-RevId: 245599248
* Start building SDBM infrastructureAlex Zinenko2019-05-061-0/+118
| | | | | | | | | | | Striped difference-bound matrix expressions are a subset of affine expressions supporting low-complexity algorithms that can be useful for loop transformations. This introduces the basic data data structures for building such expressions and unique'ing them in a MLIRContext. -- PiperOrigin-RevId: 245380206
* Refactor the generic storage object uniquing functionality from ↵River Riddle2019-05-061-124/+4
| | | | | | | | TypeUniquer into its own class 'StorageUniquer'. This is the first step in supporting dialect extensible attributes. -- PiperOrigin-RevId: 245358744
* Add support for Unit Attributes.River Riddle2019-05-061-0/+5
| | | | | | | | | | | | | | | | | | | | | | | A unit attribute is an attribute that represents a value of `unit` type. The `unit` type allows only one value forming a singleton set. This attribute value is used to represent attributes that only have meaning from their existence. One example of such an attribute could be the `swift.self` attribute. This attribute indicates that a function parameter is the self/context parameter. It could be represented as a boolean attribute(true or false), but a value of false doesn't really bring any value. The parameter either is the self/context or it isn't. ```mlir {.mlir} // A unit attribute defined with the `unit` value specifier. func @verbose_form(i1 {unitAttr : unit}) // A unit attribute can also be defined without the `unit` value specifier. func @simple_form(i1 {unitAttr}) ``` -- PiperOrigin-RevId: 245254045
* Factor out thread-safe uniqu'ing backed by vector in MLIRcontextAlex Zinenko2019-04-231-47/+44
| | | | | | | | | | Extract common code from getAffineSymbolExpr and getAffineConstantExpr into a utility function safeGetOrCreate, similarly to the existing overloads for sets and maps. The position in the vector is used as indexing key. NFC. -- PiperOrigin-RevId: 244820859
* Abort via report_fatal_error if dialect has been registered.Jacques Pienaar2019-04-181-5/+8
| | | | | | | | | | Fixes test in opt mode. Closes: tensorflow/mlir#17. -- PiperOrigin-RevId: 243711043
* Add parentheses in various asserts to group predicatesLei Zhang2019-04-111-5/+4
| | | | | | | | | This addresses the "suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]" compiler warnings. -- PiperOrigin-RevId: 242868670
* NFC: Fix a few typos in the tutorials and one in the comment of ↵River Riddle2019-04-051-1/+1
| | | | | | | | FunctionAttr::dropFunctionReference. -- PiperOrigin-RevId: 242050934
* Rename UnknownType to OpaqueType (NFC)Mehdi Amini2019-04-031-1/+1
| | | | | | | | | This came up in a review of the tutorial, it was suggested that "opaque" is more descriptive than "unknown" here. -- PiperOrigin-RevId: 241832927
OpenPOWER on IntegriCloud