summaryrefslogtreecommitdiffstats
path: root/mlir/lib/IR
Commit message (Collapse)AuthorAgeFilesLines
...
* Refactor the parsing/printing of the top-level module.River Riddle2019-07-121-8/+3
| | | | | | | | | | This changes the top-level module parser to handle the case where the top-level module is defined with the module operation syntax, i.e: module ... { } The printer is also updated to always print the top-level module in this form. This allows for cleanly round-tripping the location and attributes of the top-level module. PiperOrigin-RevId: 257492069
* Drop the trailing newline from the FuncOp syntax.River Riddle2019-07-122-5/+2
| | | | | | The ModulePrinter prints the newline now for children of the top-level module. This also fixes the location printing for functions as the location used to be printed on a different line. PiperOrigin-RevId: 257447633
* NFC: Remove Function::getModule.River Riddle2019-07-121-6/+0
| | | | | | There is already a more general 'getParentOfType' method, and 'getModule' is likely to be misused as functions get placed within different regions than ModuleOp. PiperOrigin-RevId: 257442243
* NFC: Rename Module to ModuleOp.River Riddle2019-07-101-1/+1
| | | | | | Module is a legacy name that only exists as a typedef of ModuleOp. PiperOrigin-RevId: 257427248
* Update ModuleOp::create(...) to take a Location instead of a context.River Riddle2019-07-102-5/+3
| | | | | | This allows for giving a Module a more interesting location than 'Unknown'. PiperOrigin-RevId: 257310117
* NFC: Rename Function to FuncOp.River Riddle2019-07-105-18/+16
| | | | PiperOrigin-RevId: 257293379
* Relax the restriction that Modules cannot contain operations producing results.River Riddle2019-07-092-10/+3
| | | | | | This was an arbitrary restriction caused by the way that modules were printed. Now that that has been fixed, this restriction can be removed. PiperOrigin-RevId: 257240329
* Standardize the value numbering in the AsmPrinter.River Riddle2019-07-091-56/+85
| | | | | | Change the AsmPrinter to number values breadth-first so that values in adjacent regions can have the same name. This allows for ModuleOp to contain operations that produce results. This also standardizes the special name of region entry arguments to "arg[0-9+]" now that Functions are also operations. PiperOrigin-RevId: 257225069
* Generalize the symbol table functionality of ModuleOp into a trait ↵River Riddle2019-07-083-39/+83
| | | | | | | | 'OpTrait::SymbolTable'. Operations must only contain a single region. Once attached, all operations that contain a 'mlir::SymbolTable::getSymbolAttrName()' StringAttr attribute within the child region will be verified to ensure that the names are uniqued. Operations using this trait also gain access to the 'SymbolTable' class, which can be used to manage the symbol table of the operation. This class also provides constant-time lookup of symbols by name, and will automatically rename symbols on insertion. PiperOrigin-RevId: 257123573
* NFC: Remove `Module::getFunctions` in favor of a general `getOps<T>`.River Riddle2019-07-082-2/+2
| | | | | | Modules can now contain more than just Functions, this just updates the iteration API to reflect that. The 'begin'/'end' methods have also been updated to iterate over opaque Operations. PiperOrigin-RevId: 257099084
* NFC: Remove the various "::getFunction" methods.River Riddle2019-07-084-45/+7
| | | | | | These methods assume that a function is a valid builtin top-level operation, and removing these methods allows for decoupling FuncOp and IR/. Utility "getParentOfType" methods have been added to Operation/OpState to allow for querying the first parent operation of a given type. PiperOrigin-RevId: 257018913
* Add missing overrides.Jacques Pienaar2019-07-081-1/+1
| | | | PiperOrigin-RevId: 256995548
* NFC: Remove Region::getContainingFunction as Functions are now Operations.River Riddle2019-07-042-12/+2
| | | | PiperOrigin-RevId: 256579717
* Replace the implementation of Function and Module with FuncOp and ModuleOp.River Riddle2019-07-037-341/+268
| | | | | | This is an important step in allowing for the top-level of the IR to be extensible. FuncOp and ModuleOp contain all of the necessary functionality, while using the existing operation infrastructure. As an interim step, many of the usages of Function and Module, including the name, will remain the same. In the future, many of these will be relaxed to allow for many different types of top-level operations to co-exist. PiperOrigin-RevId: 256427100
* More general subview calculation in tilingNicolas Vasilache2019-07-032-1/+10
| | | | | | This CL refactors tiling to enable tiling of views that are not just specified by a simple permutation. This allows the tiling of convolutions for which a new example is added. PiperOrigin-RevId: 256346028
* Add support for SPIR-V Struct Types. Current support is limited toMahesh Ravishankar2019-07-021-2/+2
| | | | | | supporting only Offset decorations PiperOrigin-RevId: 256216704
* NFC: Refactor Module to be value typed.River Riddle2019-07-024-19/+21
| | | | | | As with Functions, Module will soon become an operation, which are value-typed. This eases the transition from Module to ModuleOp. A new class, OwningModuleRef is provided to allow for owning a reference to a Module, and will auto-delete the held module on destruction. PiperOrigin-RevId: 256196193
* NFC: Update the Operation 'walk' methods to use llvm::function_ref instead ↵River Riddle2019-07-024-5/+5
| | | | | | of std::function. PiperOrigin-RevId: 256099638
* gpu::LaunchOp: canonicalize away constant kernel argumentsAlex Zinenko2019-07-011-1/+2
| | | | | | | | | | | | | The GPU Launch operation may take constants as arguments, in particular affine-to-GPU mapping pass automatically forwards potentially constant lower bounds of loops into the kernel. Define a canonicalization pattern for LaunchOp that recreates the constants inside the kernel region instead of accepting them as kernel arguments. This is currently restricted to standard constants but may be extended to other constant operations. Also fix an off-by-one indexing bug in OperandStorage::eraseOperand. PiperOrigin-RevId: 256035437
* Standardize the definition and usage of getAllArgAttrs between FuncOp and ↵River Riddle2019-07-011-3/+0
| | | | | | Function. PiperOrigin-RevId: 255988352
* NFC: Refactor Function to be value typed.River Riddle2019-07-0110-83/+101
| | | | | | Move the data members out of Function and into a new impl storage class 'FunctionStorage'. This allows for Function to become value typed, which will greatly simplify the transition of Function to FuncOp(given that FuncOp is also value typed). PiperOrigin-RevId: 255983022
* Extract the automatic function renaming and symbol table out of Module.River Riddle2019-07-012-9/+12
| | | | | | This functionality is now moved to a new class, ModuleManager. This class allows for inserting functions into a module, and will auto-rename them on insert to ensure a unique name. This now means that users adding new functions to a module must ensure that the function name is unique, as the Module will no longer do it automatically. This also means that Module::getNamedFunction now operates in O(N) instead of the O(c) time it did before. This simplifies the move of Modules to Operations as the ModuleOp will not be able to have this functionality. PiperOrigin-RevId: 255846088
* Cleanup the 'clone' methods and remove the need to explicitly pass in the ↵River Riddle2019-06-273-18/+21
| | | | | | | | context. This also adds a new 'Region::cloneInto' method that accepts an insertion position. PiperOrigin-RevId: 255504640
* Allow attaching a type to StringAttr.River Riddle2019-06-273-6/+19
| | | | | | Some dialects allow for string types, and this allows for reusing StringAttr for constants of these types. PiperOrigin-RevId: 255413948
* Add a new AttributeElementIterator to DenseElementsAttr.River Riddle2019-06-261-27/+52
| | | | | | This allows for iterating over the internal elements via an iterator_range of Attribute, and also allows for removing the final SmallVectorImpl based 'getValues' method. PiperOrigin-RevId: 255309555
* Standardize and refactor Attribute type printing.River Riddle2019-06-261-40/+58
| | | | | | Remove the ability to print an attribute without a type, but allow for attributes to elide the type under certain circumstances. This fixes a bug where attributes within ArrayAttr, and other collection attributes, would never print the type. PiperOrigin-RevId: 255306974
* Move the emitError/Warning/Remark utility methods out of MLIRContext and ↵River Riddle2019-06-258-66/+60
| | | | | | | | 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
* Change the attribute dictionary syntax to separate name and value with '='.River Riddle2019-06-251-2/+2
| | | | | | | | | | | The current syntax separates the name and value with ':', but ':' is already overloaded by several other things(e.g. trailing types). This makes the syntax difficult to parse in some situtations: Old: "foo: 10 : i32" New: "foo = 10 : i32" PiperOrigin-RevId: 255097928
* NFC: Uniformize the return of the LocationAttr 'get' methods to 'Location'.River Riddle2019-06-253-16/+16
| | | | PiperOrigin-RevId: 255078768
* Modify the syntax of the the ElementsAttrs to print the type as a colon type.River Riddle2019-06-251-9/+6
| | | | | | | | | This is the standard syntax for types on operations, and is also already used by IntegerAttr and FloatAttr. Example: dense<5> : tensor<i32> dense<[3]> : tensor<1xi32> PiperOrigin-RevId: 255069157
* Move the IndexedAccessorIterator to STLExtras to allow for reuse.River Riddle2019-06-251-2/+3
| | | | | | This iterator is useful for implementing random access iterators based upon an index and an object pointer. Moving it to STLExtras allows for reuse elsewhere throughout the codebase, e.g. simplifying the DenseElementsAttr iterators. PiperOrigin-RevId: 255020377
* Support printing SSA ids in affine.load/store which do not have special names.Andy Davis2019-06-251-44/+40
| | | | PiperOrigin-RevId: 254997746
* NFC: Simplify Operation::getContext to use the context within the location.River Riddle2019-06-241-13/+1
| | | | PiperOrigin-RevId: 254771979
* Add parsing/printing for new affine.load and affine.store operations.Andy Davis2019-06-241-20/+65
| | | | | | | The new operations affine.load and affine.store will take composed affine maps by construction. These operations will eventually replace load and store operations currently used in affine regions and operated on by affine transformation and analysis passes. PiperOrigin-RevId: 254754048
* Allow converting Diagnostic to LogicalResult::Failure. This matches the ↵River Riddle2019-06-241-0/+3
| | | | | | behavior of InFlightDiagnostic and enables notes to be converted to failure. PiperOrigin-RevId: 254579098
* NFC: Remove the 'context' parameter from OperationState.River Riddle2019-06-221-10/+9
| | | | | | Now that Locations are Attributes they contain a direct reference to the MLIRContext, i.e. the context can be directly accessed from the given location instead of being explicitly passed in. PiperOrigin-RevId: 254568329
* Define a ModuleOp that represents a Module as an Operation.River Riddle2019-06-223-4/+125
| | | | | | | | | | | | | | | | | | 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
* Add a Linalg convolution op.Nicolas Vasilache2019-06-221-5/+9
| | | | | | | | | | | This CL adds a conv op that corresponds to the TF description along with its lowering to loops (https://www.tensorflow.org/api_docs/python/tf/nn/convolution). The dimension of the convolution is inferred from the rank of the views. The other logical dimensions correspond to the TF description. The computation of tiled views need to be updated to work for the input tensor. This is left for a future CL. PiperOrigin-RevId: 254505644
* Refactor the location classes to be attributes instead of separate IR classes.River Riddle2019-06-226-318/+207
| | | | | | 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
* Simplify PredecessorIterator by using mapped_iterator.River Riddle2019-06-221-11/+13
| | | | PiperOrigin-RevId: 254495164
* Cache instances of several common attributes(e.g. BoolAttr, UnitAttr) and ↵River Riddle2019-06-223-14/+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
* Support for 0-D case in Linalg opsNicolas Vasilache2019-06-221-1/+3
| | | | | | | | | | | This CL adds support for O-D ops in Linalg ops by: 1. making the CopyOp maps optional instead of default valued 2. allowing certain map operations to accept and return empty maps 3. making linalg::LowerToLoops aware of these changes 4. providing a proper 0-D impl for CopyOp and FillOp 5. adding the relevant tests PiperOrigin-RevId: 254381908
* Add an overload to 'PatternRewriter::inlineRegionBefore' that accepts a ↵River Riddle2019-06-221-2/+5
| | | | | | parent region for the insertion position. This allows for inlining the given region into the end of another region. PiperOrigin-RevId: 254367375
* Refactor the TypeConverter to support more robust type conversions:River Riddle2019-06-191-1/+5
| | | | | | | | | | | | * Support for 1->0 type mappings, i.e. when the argument is being removed. * Reordering types when converting a type signature. * Adding new inputs when converting a type signature. This cl also lays down the initial foundation for supporting 1->N type mappings, but full support will come in a followup. Moving forward, function signature changes will be driven by populating a SignatureConversion instance. This class contains all of the necessary information for adding/removing/remapping function signatures; e.g. addInputs, addResults, remapInputs, etc. PiperOrigin-RevId: 254064665
* Extract the function symbol table functionality, i.e. mapping and name ↵River Riddle2019-06-193-62/+66
| | | | | | uniquing, out of Module and into a new class SymbolTable. As modules become operations it is necessary to extract out this functionality that cannot be represented with a generic operation. PiperOrigin-RevId: 254041734
* Simplify usages of SplatElementsAttr now that it inherits from ↵River Riddle2019-06-192-27/+1
| | | | | | DenseElementsAttr. PiperOrigin-RevId: 253910543
* NFC: Reorder the attribute classes alphabetically to improve readability.River Riddle2019-06-192-268/+248
| | | | PiperOrigin-RevId: 253894445
* NFC: Append 'Location' to the end of each the location kinds. This is in ↵River Riddle2019-06-193-12/+13
| | | | | | preparation for making the location classes attributes instead of separate IR types. PiperOrigin-RevId: 253860058
* Replace usages of 'UniquedFilename' with 'Identifier' and remove it. ↵River Riddle2019-06-194-24/+13
| | | | | | Identifier already contains all of the necessary functionality/verification, so having a separate class for filenames is unnecessary. PiperOrigin-RevId: 253855505
* Fix the detection of boolean splat values in DenseElementsAttr for arrays ↵River Riddle2019-06-191-3/+5
| | | | | | with <=15 values. PiperOrigin-RevId: 253711372
OpenPOWER on IntegriCloud