summaryrefslogtreecommitdiffstats
path: root/mlir/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* Extend linalg transformations to allow value operands that are not viewsAlex Zinenko2019-07-163-2/+25
| | | | | | This CL extends the linalg ops that can be tiled and fused to operations that take either views, scalar or vector operands. PiperOrigin-RevId: 258159734
* Refactor LowerAffine to use OpRewritePattern instead of ConversionPattern.River Riddle2019-07-161-97/+70
| | | | | | ConversionPattern should ideally only be used when the types of the operands are changing, which in this case they aren't. Using OpRewritePattern also lends to much simpler code. PiperOrigin-RevId: 258158474
* LLVMDialect: still depend on standard types.Alex Zinenko2019-07-161-0/+1
| | | | | | | The dependecy on standard type is mandated by attribute verifiers on some operations (e.g., llvm.constant) that use values of those types. PiperOrigin-RevId: 258153134
* Automated rollback of changelist 258149291.MLIR Team2019-07-163-25/+2
| | | | PiperOrigin-RevId: 258151618
* Start moving AffineOps to ODSNicolas Vasilache2019-07-162-2/+8
| | | | | | This CL starts with the AffineTerminatorOp to ODS. PiperOrigin-RevId: 258151579
* Introduce loop coalescing utility and a simple passAlex Zinenko2019-07-163-0/+250
| | | | | | | | | | | Multiple (perfectly) nested loops with independent bounds can be combined into a single loop and than subdivided into blocks of arbitrary size for load balancing or more efficient parallelism exploitation. However, MLIR wants to preserve the multi-dimensional multi-loop structure at higher levels of abstraction. Introduce a transformation that coalesces nested loops with independent bounds so that they can be further subdivided by tiling. PiperOrigin-RevId: 258151016
* Extend linalg transformations to allow value operands that are not viewsNicolas Vasilache2019-07-163-2/+25
| | | | | | This CL extends the linalg ops that can be tiled and fused to operations that take either views, scalar or vector operands. PiperOrigin-RevId: 258149291
* Decouple LLVM dialect from Standard dialectAlex Zinenko2019-07-163-19/+36
| | | | | | | | | | | | | | | Due to the absence of ODS support for enum attributes, the implementation of the LLVM dialect `icmp` operation was reusing the comparison predicate from the Standard dialect, creating an avoidable library dependency. With ODS support and ICmpPredicate attribute recently introduced, the dependency is no longer justified. Update the Standard to LLVM convresion to also convert the CmpIPredicate into LLVM::ICmpPredicate and remove the unnecessary includes. Note that the MLIRLLVMIR library did not explicitly depend on MLIRStandardOps, requiring dependees of MLIRLLVMIR to also depend on MLIRStandardOps, which should no longer be the case. PiperOrigin-RevId: 258148456
* LLVM Dialect: define ICmpPredicate in ODSAlex Zinenko2019-07-161-37/+10
| | | | | | | | | Use the recently introduced enum-gen functionality to define the predicate attribute of the ICmp LLVM dialect operation directly in ODS. This removes the need for manually-coded string-to-integer conversion functions and contributes to the overall homogenization of the operation definitions. PiperOrigin-RevId: 258143923
* Extract std.for std.if and std.terminator in their own dialectNicolas Vasilache2019-07-1612-203/+293
| | | | | | | These ops should not belong to the std dialect. This CL extracts them in their own dialect and updates the corresponding conversions and tests. PiperOrigin-RevId: 258123853
* Fix a bug in DialectConversion when using RewritePattern.River Riddle2019-07-161-1/+2
| | | | | | When using a RewritePattern and replacing an operation with an existing value, that value may have already been replaced by something else. This cl ensures that only the final value is used when applying rewrites. PiperOrigin-RevId: 258058488
* NFC: Add header blocks to DialectConversion.h to improve readability.River Riddle2019-07-131-3/+3
| | | | PiperOrigin-RevId: 257903383
* NFC: Don't print the location of a diagnostic if it is unknown.River Riddle2019-07-121-2/+4
| | | | | | Printing 'loc(unknown)' just clutters the output with unhelpful information. PiperOrigin-RevId: 257883717
* Add serialization and deserialization of FuncOps. To support this theMahesh Ravishankar2019-07-122-50/+270
| | | | | | | | | | | | following SPIRV Instructions serializaiton/deserialization are added as well OpFunction OpFunctionParameter OpFunctionEnd OpReturn PiperOrigin-RevId: 257869806
* [spirv] Various small code improvementsLei Zhang2019-07-123-54/+43
| | | | | | | | * Changed SPIR-V types to all use unsigned for member type count and index * Used the same method name for getting element type and count * Improved spv.CompositeExtract verification a bit PiperOrigin-RevId: 257862580
* Update the PatternRewriter constructor to take a context instead of a region.River Riddle2019-07-122-6/+6
| | | | | | This will allow for cleanly using a rewriter for multiple different regions. PiperOrigin-RevId: 257845371
* Change the IR printing pass instrumentation to ignore the verifier passes on ↵River Riddle2019-07-123-23/+46
| | | | | | | | non-failure. The verifier passes are NO-OP and are only useful to print after in the case of failure. This removes a lot of unnecessary clutter when printing after/before all passes. PiperOrigin-RevId: 257836310
* Remove the 'region' field from OpBuilder.River Riddle2019-07-124-21/+29
| | | | | | This field wasn't updated as the insertion point changed, making it potentially dangerous given the multi-level of MLIR(e.g. 'createBlock' would always insert the new block in 'region'). This also allows for building an OpBuilder with just a context. PiperOrigin-RevId: 257829135
* Fix a bug in the canonicalizer when replacing constants via patterns.River Riddle2019-07-121-3/+6
| | | | | | The GreedyPatternRewriteDriver currently does not notify the OperationFolder when constants are removed as part of a pattern match. This materializes in a nasty bug where a different operation may be allocated to the same address. This causes an assertion in the OperationFolder when it gets notified of the new operations removal. PiperOrigin-RevId: 257817627
* Lower affine control flow to std control flow to LLVM dialectNicolas Vasilache2019-07-128-234/+375
| | | | | | | | | | | | | This CL splits the lowering of affine to LLVM into 2 parts: 1. affine -> std 2. std -> LLVM The conversions mostly consists of splitting concerns between the affine and non-affine worlds from existing conversions. Short-circuiting of affine `if` conditions was never tested or exercised and is removed in the process, it can be reintroduced later if needed. LoopParametricTiling.cpp is updated to reflect the newly added ForOp::build. PiperOrigin-RevId: 257794436
* [spirv] Add CompositeExtractOp operation.Denis Khalikov2019-07-122-0/+141
| | | | | | | | CompositeExtractOp allows to extract a part of a composite object. Closes tensorflow/mlir#44 PiperOrigin-RevId: 257790731
* LoopsToGPU: use PassRegistration with constructorAlex Zinenko2019-07-121-11/+8
| | | | | | | | | | PassRegistration with an optional constructor was introduced after the LoopsToGPUPass, which resorted to deriving one pass from another as a means of accepting options supplied as command-line arguments. Use PassRegistration with constructor instead of defining a derived pass for LoopsToGPU. Also rename the pass to better reflect its current nature. PiperOrigin-RevId: 257786923
* LinalgTilingPass: use PassRegistration with a pass constructorAlex Zinenko2019-07-121-14/+8
| | | | | | | | | | Linalg tiling pass was introduced before PassRegistration with an optional pass constructor. It resorted to deriving a helper class from the origial pass class in order to provide a default constructor with values obtained from command line flags. Use PassRegistration with the optional pass constructor instead, which avoids declaring an additional class. PiperOrigin-RevId: 257786876
* Update the dialect attribute verifiers related to functions.River Riddle2019-07-123-17/+14
| | | | | | Remove the Function specific attribute verifier in favor of the general operation verifier. This also generalizes the function argument verifier to allow use for an argument attached to any region of any operation. PiperOrigin-RevId: 257689962
* Add support for serialization/deserialization of OpTypeVoid andMahesh Ravishankar2019-07-122-12/+186
| | | | | | OpTypeFunction PiperOrigin-RevId: 257684235
* Rename FunctionAttr to SymbolRefAttr.River Riddle2019-07-1223-57/+69
| | | | | | 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
* FuncOp::eraseBody: drop all references before erasing blocksAlex Zinenko2019-07-123-4/+15
| | | | | | | | | | Operations in a block can use a value defined in a dominating block. When a block, and therefore all its operations, is deleted, the operations are not allowed to have any remaining uses. Drop all uses of values in all blocks before deleting them in FuncOp::eraseBody to avoid deleting an operation before deleting the users of its results. PiperOrigin-RevId: 257628002
* affine.load/store: check for the right number of operandsAlex Zinenko2019-07-121-0/+13
| | | | | | | | | | | | Affine load and store operations take a variadic number of arguments, most of which are interpreted as subscripts for the multi-dimensional memref they access. Add a verifier check that ensures the number of operands is equal to the number affine remapping inputs if present and to the rank of the acessed memref otherwise. Although it is impossible to obtain such operations by parsing the custom syntax, it is possible to construct them using the generic syntax or programmatically. PiperOrigin-RevId: 257605902
* Propagate linalg op attributes in transformationsNicolas Vasilache2019-07-122-3/+3
| | | | | | Also fix the tile_conv test. PiperOrigin-RevId: 257602321
* Update the gen_spirv_dialect.py script to add opcodes from the SPIR-VMahesh Ravishankar2019-07-123-19/+24
| | | | | | | | JSON spec into the SPIRBase.td file. This is done incrementally to only import those opcodes that are needed, through use of the script define_opcode.sh added. PiperOrigin-RevId: 257517343
* NFC: Replace Module::getNamedFunction with lookupSymbol<FuncOp>.River Riddle2019-07-128-21/+25
| | | | | | This allows for removing the last direct reference to FuncOp from ModuleOp. PiperOrigin-RevId: 257498296
* Refactor the parsing/printing of the top-level module.River Riddle2019-07-122-10/+27
| | | | | | | | | | 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
* Fix BufferSizeOp type lowering to LLVM.Nicolas Vasilache2019-07-121-1/+1
| | | | | | This fixes a bug where the result type was incorrect when lowering to LLVM. PiperOrigin-RevId: 257449384
* 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
* EDSC: use affine.load/store instead of std.load/storeAlex Zinenko2019-07-121-2/+2
| | | | | | | | | | | Standard load and store operations are evolving to be separated from the Affine constructs. Special affine.load/store have been introduced to uphold the restrictions of the Affine control flow constructs on their operands. EDSC-produced loads and stores were originally intended to uphold those restrictions as well so they should use affine.load/store instead of std.load/store. PiperOrigin-RevId: 257443307
* NFC: Remove Function::getModule.River Riddle2019-07-125-15/+8
| | | | | | 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
* Delete dead codeNicolas Vasilache2019-07-121-12/+0
| | | | | AffineIfOp::build is not tested or exercised anywhere. It also perpetuates a questionable choice of encoding an optional region as an empty region which we would like to change in the future. PiperOrigin-RevId: 257439832
* NFC: Rename Module to ModuleOp.River Riddle2019-07-1016-31/+32
| | | | | | 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-105-8/+9
| | | | | | This allows for giving a Module a more interesting location than 'Unknown'. PiperOrigin-RevId: 257310117
* NFC: Rename Function to FuncOp.River Riddle2019-07-1038-152/+142
| | | | 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
* Add parentheses around boolean operators in an assertion inAlex Zinenko2019-07-091-4/+2
| | | | | | Linalg/Transforms/Tiling.cpp. This fixes a warning. PiperOrigin-RevId: 257191302
* Fix a test broken on some systems due to a mis-rebase.Alex Zinenko2019-07-093-2/+2
| | | | PiperOrigin-RevId: 257190161
* Implement parametric tiling on standard for loopsAlex Zinenko2019-07-092-8/+238
| | | | | | | | | | | | | | | | | | Parametric tiling can be used to extract outer loops with fixed number of iterations. This in turn enables mapping to GPU kernels on a fixed grid independently of the range of the original loops, which may be unknown statically, making the kernel adaptable to different sizes. Provide a utility function that also computes the parametric tile size given the range of the loop. Exercise the utility function through a simple pass that applies it to all top-level loop nests. Permutability or parallelism checks must be performed before calling this utility function in actual passes. Note that parametric tiling cannot be implemented in a purely affine way, although it can be encoded using semi-affine maps. The choice to implement it on standard loops is guided by them being the common representation between Affine loops, Linalg and GPU kernels. PiperOrigin-RevId: 257180251
* Extend AffineToGPU to support Linalg loopsAlex Zinenko2019-07-096-250/+376
| | | | | | | | | | | | | | | | Extend the utility that converts affine loop nests to support other types of loops by abstracting away common behavior through templates. This also slightly simplifies the existing Affine to GPU conversion by always passing in the loop step as an additional kernel argument even though it is a known constant. If it is used, it will be propagated into the loop body by the existing canonicalization pattern and can be further constant-folded, otherwise it will be dropped by canonicalization. This prepares for the common loop abstraction that will be used for converting to GPU kernels, which is conceptually close to Linalg loops, while maintaining the existing conversion operational. PiperOrigin-RevId: 257172216
* 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-0815-18/+18
| | | | | | 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: Make the 'disable-pass-threading' flag a PassManagerOption.River Riddle2019-07-083-12/+29
| | | | | | This also adds the ability to programmatically disable threading. PiperOrigin-RevId: 257051809
* Remove dead code.Jacques Pienaar2019-07-081-12/+0
| | | | PiperOrigin-RevId: 257050780
OpenPOWER on IntegriCloud