summaryrefslogtreecommitdiffstats
path: root/mlir/lib/Dialect/Linalg/Transforms
Commit message (Collapse)AuthorAgeFilesLines
...
* Use llvm.func to define functions with wrapped LLVM IR function typeAlex Zinenko2019-10-101-10/+15
| | | | | | | | | | | | | | This function-like operation allows one to define functions that have wrapped LLVM IR function type, in particular variadic functions. The operation was added in parallel to the existing lowering flow, this commit only switches the flow to use it. Using a custom function type makes the LLVM IR dialect type system more consistent and avoids complex conversion rules for functions that previously had to use the built-in function type instead of a wrapped LLVM IR dialect type and perform conversions during the analysis. PiperOrigin-RevId: 273910855
* Linalg to LLVM lowering: decrease the reliance on symbol lookup in a moduleAlex Zinenko2019-10-081-19/+20
| | | | | | | | | | | During the conversion, both the original and the converted function may coexist in the module and have the same symbol name. There is no guarantee which of the two will be found by the symbol lookup. Avoid returning the result of the library function lookup when lowering Linalg to Standard or LLVM. Use the symbol reference instead. After the conversion completes, only one symbol will remain and the Ops using SymbolRefAttrs will be referring to the correct one. PiperOrigin-RevId: 273510079
* Expose `fuseProducerOf` in Linalg/Utils/Utils.h.MLIR Team2019-10-071-11/+6
| | | | PiperOrigin-RevId: 273384063
* Add missing Linalg lowerings to allow roundtrip.mlir to lower to LLVMNicolas Vasilache2019-10-041-20/+47
| | | | | | | | | | | | Certain lowering patterns were reported as [missing](https://groups.google.com/a/tensorflow.org/forum/#!topic/mlir/dkdmHa77sSQ). This CL adds them and allows Linalg/roundtrip.mlir and Linalg/loops.mlir to lower to LLVM directly. Those 2 tests are updated to additionally check that the direct lowering to LLVM does not crash. The following points, left as TODOs still need to be addressed for correct end-to-end execution: 1. the lowering for ConvOp needs to pass attributes such as strides and dilations; the external library call needs to support it. 2. the lowering for GenericOp needs to support lowering to loops as a DialectConversion pattern. This is blocked on the DialectConversion infrastructure accepting an OperationFolder. PiperOrigin-RevId: 272878131
* NFC: rename Conversion/ControlFlowToCFG to Conversion/LoopToStandardAlex Zinenko2019-10-031-1/+1
| | | | | | | | This makes the name of the conversion pass more consistent with the naming scheme, since it actually converts from the Loop dialect to the Standard dialect rather than working with arbitrary control flow operations. PiperOrigin-RevId: 272612112
* Unify Linalg types by using strided memrefsNicolas Vasilache2019-10-014-281/+126
| | | | | | | This CL finishes the implementation of the Linalg + Affine type unification of the [strided memref RFC](https://groups.google.com/a/tensorflow.org/forum/#!topic/mlir/MaL8m2nXuio). As a consequence, the !linalg.view type, linalg::DimOp, linalg::LoadOp and linalg::StoreOp can now disappear and Linalg can use standard types everywhere. PiperOrigin-RevId: 272187165
* Decouple tiling from fusion in Linalg.Nicolas Vasilache2019-09-261-157/+118
| | | | | | | | | | | | This CL modifies the linalg-fusion pass such that it does not tile anymore as part of the pass. Tiling is a separate concern that enables linalg fusion but should happen before. This makes fusion more composable with other decisions. In particular the fusion pass now becomes greedy and only applies the transformation on a best-effort basis. This should also let fusion work in a multi-hop fashion with chains of producer/consumers. Since the fusion pass does not perform tiling anymore, tests are rewritten to be in pretiled form and make the intent of the test clearer (albeit more verbose). PiperOrigin-RevId: 271357741
* Remove unused variables and methods to address compiler warningsLei Zhang2019-09-251-2/+1
| | | | PiperOrigin-RevId: 271256784
* Fix a number of Clang-Tidy warnings.Christian Sigg2019-09-234-4/+4
| | | | PiperOrigin-RevId: 270632324
* Drop makePositionAttr and the like in favor of Builder::getI64ArrayAttrAlex Zinenko2019-09-161-24/+14
| | | | | | | | | | The helper functions makePositionAttr() and positionAttr() were originally introduced in the lowering-to-LLVM-dialect pass to construct integer array attributes that are used for static positions in extract/insertelement. Constructing an integer array attribute being fairly common, a utility function Builder::getI64ArrayAttr was later introduced into the Builder API. Drop makePositionAttr and similar homegrown functions and use that API instead. PiperOrigin-RevId: 269295836
* NFC: Finish replacing FunctionPassBase/ModulePassBase with OpPassBase.River Riddle2019-09-134-4/+6
| | | | | | These directives were temporary during the generalization of FunctionPass/ModulePass to OpPass. PiperOrigin-RevId: 268970259
* Remove unused variableJacques Pienaar2019-09-101-2/+1
| | | | PiperOrigin-RevId: 268173638
* Simplify Linalg ABI integration with external function calls.Nicolas Vasilache2019-09-061-121/+123
| | | | | | | View descriptors are converted to *pointer to* LLVM struct to avoid ABI issues related to C struct packing. This creates unnecessary complexity and hampers unification with memrefs. Instead, this CL makes view descriptors convert to LLVM struct (as it was originally) and promotes all structs to pointers right before calling an external function. PiperOrigin-RevId: 267602693
* Properly clone Linalg ops with regionsNicolas Vasilache2019-09-032-12/+12
| | | | | | This CL adds support for proper cloning of Linalg ops that have regions (i.e. the generic linalg op). This is used to properly implement tiling and fusion for such ops. Adequate tests are added. PiperOrigin-RevId: 267027176
* Remove unused variablesAlex Torres2019-09-031-13/+7
| | | | | | | | | | Remove unused variables and attributes from BaseViewConversionHelper on mlir/lib/Dialect/Linalg/Transforms/LowerToLLVMDialect.cpp Closes tensorflow/mlir#116 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/116 from alexst07:fix-warnings 5f638e4677492cf71a9cc040eeb6b57427d32e06 PiperOrigin-RevId: 266972082
* Add a new dialect interface for the OperationFolder `OpFolderDialectInterface`.River Riddle2019-09-013-4/+4
| | | | | | This interface will allow for providing hooks to interrop with operation folding. The first hook, 'shouldMaterializeInto', will allow for controlling which region to insert materialized constants into. The folder will generally materialize constants into the top-level isolated region, this allows for materializing into a lower level ancestor region if it is more profitable/correct. PiperOrigin-RevId: 266702972
* Refactor the 'walk' methods for operations.River Riddle2019-08-293-5/+4
| | | | | | | | | | | | This change refactors and cleans up the implementation of the operation walk methods. After this refactoring is that the explicit template parameter for the operation type is no longer needed for the explicit op walks. For example: op->walk<AffineForOp>([](AffineForOp op) { ... }); is now accomplished via: op->walk([](AffineForOp op) { ... }); PiperOrigin-RevId: 266209552
* Lower linalg.copy to LLVM dialect in the presence of transposes.Nicolas Vasilache2019-08-231-13/+63
| | | | | | | | | | Add an extra RewritePattern that does not convert types to rewrite a CopyOp that has non-identity permutations into a sequence of TransposeOp followed by a CopyOp without such permutations. This RewitePattern is made to fail in the non-permutation case so that the conversion pattern can kick in to lower to LLVM. This is an instance of A->A->B lowering where A->A is done by a RewritePattern in case_1 and A->B is done by a ConversionPatternRewriter when not(case_1). PiperOrigin-RevId: 265171380
* Lower linalg.transpose to LLVM dialectNicolas Vasilache2019-08-231-3/+112
| | | | | | | | | | | | Add a conversion pattern that transforms a linalg.transpose op into: 1. A function entry `alloca` operation to allocate a ViewDescriptor. 2. A load of the ViewDescriptor from the pointer allocated in 1. 3. Updates to the ViewDescriptor to introduce the data ptr, offset, size and stride. Size and stride are permutations of the original values. 4. A store of the resulting ViewDescriptor to the alloca'ed pointer. The linalg.transpose op is replaced by the alloca'ed pointer. PiperOrigin-RevId: 265169112
* Add lowering of linalg.copy to an external C++ library and a test.Nicolas Vasilache2019-08-231-8/+19
| | | | | | This CL extends support for lowering of linalg to external C++ libraries with CopyOp. Currently this can only work when the permutation maps in the copies are identity. Future support for permutations will be added later. PiperOrigin-RevId: 265093025
* Avoid overflow when lowering linalg.sliceNicolas Vasilache2019-08-221-20/+21
| | | | | | | | linalg.subview used to lower to a slice with a bounded range resulting in correct bounded accesses. However linalg.slice could still index out of bounds. This CL moves the bounding to linalg.slice. LLVM select and cmp ops gain a more idiomatic builder. PiperOrigin-RevId: 264897125
* Remove dead getLLVMLibraryCallImplDefinition in Linalg's ↵Nicolas Vasilache2019-08-211-27/+4
| | | | | | LowerToLLVMDialect.cpp - NFC PiperOrigin-RevId: 264740014
* NFC: Move AffineOps dialect to the Dialect sub-directory.River Riddle2019-08-201-6/+6
| | | | PiperOrigin-RevId: 264482571
* Move Linalg and VectorOps dialects to the Dialect subdir - NFCNicolas Vasilache2019-08-194-0/+2077
PiperOrigin-RevId: 264277760
OpenPOWER on IntegriCloud