summaryrefslogtreecommitdiffstats
path: root/mlir/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* Use vector.InsertStridedSlice in Vector -> Vector unrollingNicolas Vasilache2019-11-252-20/+79
| | | | | | | | This CL uses the recently added op to finish the implementation of Vector -> Vector unrolling by replacing the "fake join op" by a series of InsertStridedSliceOp. Test is updated accordingly PiperOrigin-RevId: 282451126
* Add a vector.InsertStridedSliceOpNicolas Vasilache2019-11-251-117/+211
| | | | | | This new op is the counterpart of vector.StridedSliceOp and will be used for in the pattern rewrites for vector unrolling. PiperOrigin-RevId: 282447414
* Allow LLVM::ExtractElementOp to have non-i32 indices.MLIR Team2019-11-251-17/+14
| | | | | | Also change the text format a bit, so that indices are braced by squares. PiperOrigin-RevId: 282437095
* Make std.divis and std.diviu support ElementsAttr folding.Ben Vanik2019-11-251-24/+20
| | | | PiperOrigin-RevId: 282434465
* NFC: Actually expose the implementation of createGPUToSPIRVLoweringPass.Mahesh Ravishankar2019-11-251-2/+3
| | | | | | | | A mismatch in the function declaration and function definition, prevented the implementation of the createGPUToSPIRVLoweringPass from being exposed. PiperOrigin-RevId: 282419815
* Add missing rule to generate SPIR-V ABI Attribute using tblgen to CMake.Mahesh Ravishankar2019-11-251-0/+1
| | | | PiperOrigin-RevId: 282415592
* Update VectorContractionOp to take iterator types and index mapping ↵Andy Davis2019-11-251-17/+87
| | | | | | attributes compatible with linalg ops. PiperOrigin-RevId: 282412311
* Introduce attributes that specify the final ABI for a spirv::ModuleOp.Mahesh Ravishankar2019-11-2511-213/+388
| | | | | | | | | | | | | | | | | | | | | | | | To simplify the lowering into SPIR-V, while still respecting the ABI requirements of SPIR-V/Vulkan, split the process into two 1) While lowering a function to SPIR-V (when the function is an entry point function), allow specifying attributes on arguments and function itself that describe the ABI of the function. 2) Add a pass that materializes the ABI described in the function. Two attributes are needed. 1) Attribute on arguments of the entry point function that describe the descriptor_set, binding, storage class, etc, of the spv.globalVariable this argument will be replaced by 2) Attribute on function that specifies workgroup size, etc. (for now only workgroup size). Add the pass -spirv-lower-abi-attrs to materialize the ABI described by the attributes. This change makes the SPIRVBasicTypeConverter class unnecessary and is removed, further simplifying the SPIR-V lowering path. PiperOrigin-RevId: 282387587
* Allow memref_cast from static strides to dynamic strides.Mahesh Ravishankar2019-11-251-2/+22
| | | | | | | | Memref_cast supports cast from static shape to dynamic shape memrefs. The same should be true for strides as well, i.e a memref with static strides can be casted to a memref with dynamic strides. PiperOrigin-RevId: 282381862
* Add vector.insertelement opNicolas Vasilache2019-11-251-1/+73
| | | | | | | | | This is the counterpart of vector.extractelement op and has the same limitations at the moment (static I64IntegerArrayAttr to express position). This restriction will be filterd in the future. LLVM lowering will be added in a subsequent commit. PiperOrigin-RevId: 282365760
* Introduce gpu.funcAlex Zinenko2019-11-252-47/+256
| | | | | | | | | | | | | | | | | | Introduce a new function-like operation to the GPU dialect to provide a placeholder for the execution semantic description and to add support for GPU memory hierarchy. This aligns with the overall goal of the dialect to expose the common abstraction layer for GPU devices, in particular by providing an MLIR unit of semantics (i.e. an operation) for memory modeling. This proposal has been discussed in the mailing list: https://groups.google.com/a/tensorflow.org/d/msg/mlir/RfXNP7Hklsc/MBNN7KhjAgAJ As decided, the "convergence" aspect of the execution model will be factored out into a new discussion and therefore is not included in this commit. This commit only introduces the operation but does not hook it up with the remaining flow. The intention is to develop the new flow while keeping the old flow operational and do the switch in a simple, separately reversible commit. PiperOrigin-RevId: 282357599
* Support folding of StandardOps with DenseElementsAttr.Ben Vanik2019-11-241-14/+30
| | | | PiperOrigin-RevId: 282270243
* NFC: Wire up DRR settings for SPIR-V canonicalization patternsLei Zhang2019-11-233-58/+55
| | | | | | | | This CL added necessary files and settings for using DRR to write SPIR-V canonicalization patterns and also converted the patterns for spv.Bitcast and spv.LogicalNot. PiperOrigin-RevId: 282132786
* Make isValidSymbol more powerfulUday Bondhugula2019-11-223-11/+49
| | | | | | | | | | | | | | | | | The check in isValidSymbol, as far as a DimOp result went, checked if the dim op was on a top-level memref. However, any alloc'ed, view, or subview memref would be fine as long as the corresponding dimension of that memref is either a static one or was in turn created using a valid symbol in the case of dynamic dimensions. Reported-by: Jose Gomez Signed-off-by: Uday Bondhugula <uday@polymagelabs.com> Closes tensorflow/mlir#252 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/252 from bondhugula:symbol 7b57dc394df9375e651f497231c6e4525a32a662 PiperOrigin-RevId: 282097114
* NFC: Remove unnecessarily guarded tablegen includes.River Riddle2019-11-222-10/+0
| | | | | | Support for including a file multiple times was added in tablegen, removing the need for these extra guards. This is because we already insert c/c++ style header guards within each of the specific .td files. PiperOrigin-RevId: 282076728
* Fix Windows BuildNicolas Vasilache2019-11-221-1/+2
| | | | PiperOrigin-RevId: 282048102
* [spirv] Add a canonicalizer for `spirv::LogicalNotOp`.Denis Khalikov2019-11-221-0/+41
| | | | | | | | | | | | | | | | Add a canonicalizer for `spirv::LogicalNotOp`. Converts: * spv.LogicalNot(spv.IEqual(...)) -> spv.INotEqual(...) * spv.LogicalNot(spv.INotEqual(...)) -> spv.IEqual(...) * spv.LogicalNot(spv.LogicalEqual(...)) -> spv.LogicalNotEqual(...) * spv.LogicalNot(spv.LogicalNotEqual(...)) -> spv.LogicalEqual(...) Also moved the test for spv.IMul to arithemtic tests. Closes tensorflow/mlir#256 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/256 from denis0x0D:sandbox/canon_logical_not 76ab5787b2c777f948c8978db061d99e76453d44 PiperOrigin-RevId: 282012356
* Add more canonicalizations for SubViewOp.Mahesh Ravishankar2019-11-221-92/+122
| | | | | | | | | | Depending on which of the offsets, sizes, or strides are constant, the subview op can be canonicalized in different ways. Add such canonicalizations, which generalize the existing approach of canonicalizing subview op only if all of offsets, sizes and shapes are constants. PiperOrigin-RevId: 282010703
* Unify vector op names with other dialects.Jean-Michel Gorius2019-11-228-127/+119
| | | | | | | | | | Change vector op names from VectorFooOp to Vector_FooOp and from vector::VectorFooOp to vector::FooOp. Closes tensorflow/mlir#257 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/257 from Kayjukh:master dfc3a0e04114885aaec8740d5951d6984d6e1577 PiperOrigin-RevId: 281967461
* Move Linalg Transforms that are actually Conversions - NFCNicolas Vasilache2019-11-214-25/+32
| | | | PiperOrigin-RevId: 281844602
* Add support for using the ODS result names as the Asm result names for ↵River Riddle2019-11-211-0/+3
| | | | | | | | | | | | | | | multi-result operations. This changes changes the OpDefinitionsGen to automatically add the OpAsmOpInterface for operations with multiple result groups using the provided ODS names. We currently just limit the generation to multi-result ops as most single result operations don't have an interesting name(result/output/etc.). An example is shown below: // The following operation: def MyOp : ... { let results = (outs AnyType:$first, Variadic<AnyType>:$middle, AnyType); } // May now be printed as: %first, %middle:2, %0 = "my.op" ... PiperOrigin-RevId: 281834156
* Fix OSS builds - NFCNicolas Vasilache2019-11-211-1/+1
| | | | PiperOrigin-RevId: 281757979
* Drop unused function - NFCNicolas Vasilache2019-11-211-5/+0
| | | | PiperOrigin-RevId: 281741923
* Split Linalg declarative patterns from specific test patterns - NFCNicolas Vasilache2019-11-211-62/+37
| | | | | | This will make it easier to scale out test patterns and build specific passes that do not interfere with independent testing. PiperOrigin-RevId: 281736335
* Don't force newline before function attributesAlex Zinenko2019-11-211-5/+1
| | | | | | | | | | | Due to legacy reasons, a newline character followed by two spaces was always inserted before the attributes of the function Op in pretty form. This breaks formatting when functions are nested in some other operations. Don't print the newline and just put the attributes on the same line, which is also more consistent with module Op. Line breaking aware of indentation can be introduced separately into the parser if deemed useful. PiperOrigin-RevId: 281721793
* NFC: Use Region::getBlocks to fix build failure with drop_begin.River Riddle2019-11-201-1/+1
| | | | PiperOrigin-RevId: 281656603
* Correctly parse empty affine maps.MLIR Team2019-11-201-3/+7
| | | | | | Previously the test case crashes / produces an error. PiperOrigin-RevId: 281630540
* Merge DCE and unreachable block elimination into a new utility ↵River Riddle2019-11-204-274/+286
| | | | | | | | 'simplifyRegions'. This moves the different canonicalizations of regions into one place and invokes them in the fixed-point iteration of the canonicalizer. PiperOrigin-RevId: 281617072
* Add VectorContractionOp to the VectorOps dialect.Andy Davis2019-11-201-0/+209
| | | | PiperOrigin-RevId: 281605471
* Verify subview op result has dynamic shape, when sizes are specified.Mahesh Ravishankar2019-11-201-0/+14
| | | | | | | If the sizes are specified as arguments to the subview op, then the shape must be dynamic as well. PiperOrigin-RevId: 281591608
* Add multi-level DCE pass.Sean Silva2019-11-203-0/+236
| | | | | | | | | This is a simple multi-level DCE pass that operates pretty generically on the IR. Its key feature compared to the existing peephole dead op folding that happens during canonicalization is being able to delete recursively dead cycles of the use-def graph, including block arguments. PiperOrigin-RevId: 281568202
* Changes to SubViewOp to make it more amenable to canonicalization.Mahesh Ravishankar2019-11-202-42/+138
| | | | | | | | | | | | | | The current SubViewOp specification allows for either all offsets, shape and stride to be dynamic or all of them to be static. There are opportunities for more fine-grained canonicalization based on which of these are static. For example, if the sizes are static, the result memref is of static shape. The specification of SubViewOp is modified to allow on or more of offsets, shapes and strides to be statically specified. The verification is updated to ensure that the result type of the subview op is consistent with which of these are static and which are dynamic. PiperOrigin-RevId: 281560457
* Implement unrolling of vector ops to finer-grained vector ops as a pattern.Nicolas Vasilache2019-11-204-21/+420
| | | | | | | | | This CL uses the pattern rewrite infrastructure to implement a simple VectorOps -> VectorOps legalization strategy to unroll coarse-grained vector operations into finer grained ones. The transformation is written using local pattern rewrites to allow composition with other rewrites. It proceeds by iteratively introducing fake cast ops and cleaning canonicalizing or lowering them away where appropriate. This is an example of writing transformations as compositions of local pattern rewrites that should enable us to make them significantly more declarative. PiperOrigin-RevId: 281555100
* Add a new OpAsmOpInterface to allow for ops to directly hook into the ↵River Riddle2019-11-203-86/+167
| | | | | | | | | | | | | | | | | | | | | | | AsmPrinter. This interface provides more fine-grained hooks into the AsmPrinter than the dialect interface, allowing for operations to define the asm name to use for results directly on the operations themselves. The hook is also expanded to enable defining named result "groups". Get a special name to use when printing the results of this operation. The given callback is invoked with a specific result value that starts a result "pack", and the name to give this result pack. To signal that a result pack should use the default naming scheme, a None can be passed in instead of the name. For example, if you have an operation that has four results and you want to split these into three distinct groups you could do the following: setNameFn(getResult(0), "first_result"); setNameFn(getResult(1), "middle_results"); setNameFn(getResult(3), ""); // use the default numbering. This would print the operation as follows: %first_result, %middle_results:2, %0 = "my.op" ... PiperOrigin-RevId: 281546873
* Fix 'the the' typo.Alexander Belyaev2019-11-201-1/+1
| | | | PiperOrigin-RevId: 281501234
* Extend kernel outlining to also consider dim worth inlining.Stephan Herhut2019-11-201-9/+21
| | | | PiperOrigin-RevId: 281483447
* Make type and rank explicit in mcuMemHostRegister function.Christian Sigg2019-11-191-8/+10
| | | | | | Fix registered size of indirect MemRefType kernel arguments. PiperOrigin-RevId: 281362940
* Add VectorOps.StridedSliceOpNicolas Vasilache2019-11-191-2/+176
| | | | | | | | | | | | | | | | | | | | | The `vector.strided_slice` takes an n-D vector, k-D `offsets` integer array attribute, a k-D `sizes` integer array attribute, a k-D `strides` integer array attribute and extracts the n-D subvector at the proper offset. Returns an n-D vector where the first k-D dimensions match the `sizes` attribute. The returned subvector contains the elements starting at offset `offsets` and ending at `offsets + sizes`. Example: ``` %1 = vector.strided_slice %0 {offsets : [0, 2], sizes : [2, 4], strides : [1, 1]}: vector<4x8x16xf32> // returns a vector<2x4x16xf32> ``` This op will be useful for progressive lowering within the VectorOp dialect. PiperOrigin-RevId: 281352749
* Add getRemappedValue to ConversionPatternRewriterDiego Caballero2019-11-191-0/+6
| | | | | | | | | | This method is needed for N->1 conversion patterns to retrieve remapped Values used in the original N operations. Closes tensorflow/mlir#237 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/237 from dcaballe:dcaballe/getRemappedValue 1f64fadcf2b203f7b336ff0c5838b116ae3625db PiperOrigin-RevId: 281321881
* Add '*' and '?' and optional brace parse calls to the ParserEric Schweitz2019-11-191-0/+20
| | | | | | Closes tensorflow/mlir#245 PiperOrigin-RevId: 281321459
* Change conversion CLI flag from -lower-to-llvm to -convert-std-to-llvmAlex Zinenko2019-11-191-1/+2
| | | | | | | | | | | | The command-line flag name `lower-to-llvm` for the pass performing dialect conversion from the Standard dialect to the LLVM dialect is misleading and inconsistent with most of the conversion passses. It leads the user to believe that there are no restrictions on what can be converted, while in fact only a subset of the Standard dialect can be converted (with operations from other dialects converted by separate passes). Use `convert-std-to-llvm` that better reflects what the pass does and is consistent with most other conversions. PiperOrigin-RevId: 281238797
* Support SPIR-V constant op to take DenseElementsAttr as input.Hanhan Wang2019-11-182-174/+110
| | | | | | | | Iterates each element to build the array. This includes a little refactor to combine bool/int/float into a function, since they are similar. The only difference is calling different function in the end. PiperOrigin-RevId: 281210288
* Use SmallVectorImpl instead of SmallVector for function parameters (NFC)Tian Jin2019-11-181-1/+1
| | | | | | Closes tensorflow/mlir#247 PiperOrigin-RevId: 281185661
* Lower linalg.indexed_generic to loops.Alexander Belyaev2019-11-183-65/+212
| | | | PiperOrigin-RevId: 281169885
* Fix SubViewOp stride calculation in constant folding.Andy Davis2019-11-181-6/+8
| | | | | | Adds unit tests for subview offset and stride argument constant folding. PiperOrigin-RevId: 281161041
* [spirv] Add a canonicalizer for BitcastOp.Denis Khalikov2019-11-181-4/+33
| | | | | | | | | | Convert chained `spirv::BitcastOp` operations into one `spirv::BitcastOp` operation. Closes tensorflow/mlir#238 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/238 from denis0x0D:sandbox/canon_bitcast 4352ed4f81b959ec92f849c599e733b62a99c010 PiperOrigin-RevId: 281129234
* Also elide large array attribute in OpGraph DumpJing Pu2019-11-181-0/+6
| | | | PiperOrigin-RevId: 281114034
* ConvertStandardToLLVM: replace assertion with graceful failureAlex Zinenko2019-11-181-2/+2
| | | | | | | | | | | | | The assertion was introduced in the early days of dialect conversion infrastructure when we had the matching function separate from the rewriting function. The infrastructure evolved to have a common matchAndRewrite function and the separate matching function was dropped without chaning the rewriting that became matchAndRewrite. This has led to assertion being triggered. Return a matchFailure instead of failing an assertion on unsupported types. Closes tensorflow/mlir#230 PiperOrigin-RevId: 281113741
* Fix Affine Loop Fusion test case reported on github.Andy Davis2019-11-182-19/+67
| | | | | | This CL utilizies the more robust fusion feasibility analysis being built out in LoopFusionUtils, which will eventually be used to replace the current affine loop fusion pass. PiperOrigin-RevId: 281112340
* Standardize all VectorOps class names to be prefixed by Vector - NFCNicolas Vasilache2019-11-182-34/+46
| | | | | | This improves consistency and will concretely avoid collisions between VectorExtractElementOp and ExtractElementOp when they are included in the same transforms / rewrites. PiperOrigin-RevId: 281101588
OpenPOWER on IntegriCloud