summaryrefslogtreecommitdiffstats
path: root/mlir/test
Commit message (Collapse)AuthorAgeFilesLines
...
* Correctly parse empty affine maps.MLIR Team2019-11-203-3/+15
| | | | | | Previously the test case crashes / produces an error. PiperOrigin-RevId: 281630540
* Merge DCE and unreachable block elimination into a new utility ↵River Riddle2019-11-202-5/+9
| | | | | | | | '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-202-0/+98
| | | | PiperOrigin-RevId: 281605471
* Verify subview op result has dynamic shape, when sizes are specified.Mahesh Ravishankar2019-11-201-1/+11
| | | | | | | 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-201-0/+162
| | | | | | | | | 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-203-13/+104
| | | | | | | | | | | | | | 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-1/+88
| | | | | | | | | 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-1/+59
| | | | | | | | | | | | | | | | | | | | | | | 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
* Add StridedMemRef<>::operator[] - NFCNicolas Vasilache2019-11-201-0/+29
| | | | | | This operator is used for internal debugging purposes. PiperOrigin-RevId: 281544152
* Fix 'the the' typo.Alexander Belyaev2019-11-202-3/+2
| | | | PiperOrigin-RevId: 281501234
* Extend kernel outlining to also consider dim worth inlining.Stephan Herhut2019-11-201-1/+1
| | | | PiperOrigin-RevId: 281483447
* Make type and rank explicit in mcuMemHostRegister function.Christian Sigg2019-11-193-9/+6
| | | | | | Fix registered size of indirect MemRefType kernel arguments. PiperOrigin-RevId: 281362940
* Add VectorOps.StridedSliceOpNicolas Vasilache2019-11-192-0/+71
| | | | | | | | | | | | | | | | | | | | | 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
* Fix pretty printer corner case in mlir_runner_utils.cpp.Nicolas Vasilache2019-11-192-27/+17
| | | | | | | In the particular case where the size of a memref dimension is 1, double printing would happen because printLast was called unconditionally. This CL fixes the print and updates an incorrect test that should have caught this in the first place. PiperOrigin-RevId: 281345142
* Add getRemappedValue to ConversionPatternRewriterDiego Caballero2019-11-192-0/+76
| | | | | | | | | | 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
* Change conversion CLI flag from -lower-to-llvm to -convert-std-to-llvmAlex Zinenko2019-11-196-9/+9
| | | | | | | | | | | | 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-1/+45
| | | | | | | | 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
* Lower linalg.indexed_generic to loops.Alexander Belyaev2019-11-182-9/+164
| | | | PiperOrigin-RevId: 281169885
* Fix SubViewOp stride calculation in constant folding.Andy Davis2019-11-181-6/+28
| | | | | | Adds unit tests for subview offset and stride argument constant folding. PiperOrigin-RevId: 281161041
* Add a parseAttribute<AttrType> overload for the non-type case.River Riddle2019-11-181-1/+1
| | | | | | The variant that accepts a type will check that the parsed attribute is a valid instance of AttrType. The non-type variant would silently fail in this case, leading to garbage attribute values. PiperOrigin-RevId: 281136528
* [spirv] Add a canonicalizer for BitcastOp.Denis Khalikov2019-11-181-0/+28
| | | | | | | | | | 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
* Fix Affine Loop Fusion test case reported on github.Andy Davis2019-11-181-5/+55
| | | | | | 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
* Implement folding of pattern dim(subview(_)[...][s1, ..., sn][...], i) -> si.Stephan Herhut2019-11-181-4/+16
| | | | PiperOrigin-RevId: 281042016
* Rename CLI flags -lower-gpu-ops-to-*-ops to -convert-gpu-to-*Alex Zinenko2019-11-182-2/+2
| | | | | | | This makes the flags consistent with the naming scheme used elsewhere in the codebase for dialect conversions. PiperOrigin-RevId: 281027517
* [spirv] Add bit opsDenis Khalikov2019-11-152-0/+65
| | | | | | | | | | | | | This CL added op definitions for a few bit operations: * OpBitFieldInsert * OpBitFieldSExtract * OpBitFieldUExtract Closes tensorflow/mlir#233 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/233 from denis0x0D:sandbox/bit_field_ops e7fd85b00d72d483d7992dc42b9cc4d673903455 PiperOrigin-RevId: 280691816
* NFC: Convert CmpIPredicate in StandardOps to use EnumAttrLei Zhang2019-11-151-2/+2
| | | | | | This turns several hand-written functions to auto-generated ones. PiperOrigin-RevId: 280684326
* Use aggregate-parameter builder for ops having autogen type-deduction builderLei Zhang2019-11-152-6/+5
| | | | | | | | | | | | | | | | | | | | | | Thus far DRR always invokes the separate-parameter builder (i.e., requiring a separate parameter for each result-type/operand/attribute) for creating ops, no matter whether we can auto-generate a builder with type-deduction ability or not. This CL changes the path for ops that we can auto-generate type-deduction builders, i.e., with SameOperandsAndResultType/FirstAttrDerivedResultType traits. Now they are going through a aggregate-parameter builder (i.e., requiring one parameter for all result-types/operands/attributes). attributes.) It is expected this approach will be more friendly for future shape inference function autogen and calling those autogen'd shape inference function without excessive packing and repacking operand/attribute lists. Also, it would enable better support for creating ops with optional attributes because we are not required to provide an Attribute() as placeholder for an optional attribute anymore. PiperOrigin-RevId: 280654800
* Mark std.view as no-sideeffect.Stephan Herhut2019-11-151-0/+6
| | | | | | The same reasoning as for std.subview applies. PiperOrigin-RevId: 280639308
* Mark std.subview as no-sideeffect.Stephan Herhut2019-11-151-25/+36
| | | | | | | | In essence, std.subview is just an abstract indexing transformation (somewhat akin to a gep in llvm) and by itself has no effect. From a practical perspective this helps, as it allows to remove dead subview operations. PiperOrigin-RevId: 280630046
* Refactor the LowerVectorTransfers pass to use the RewritePattern infra - NFCNicolas Vasilache2019-11-144-1/+46
| | | | | | This is step 1/n in refactoring infrastructure along the Vector dialect to make it ready for retargetability and composable progressive lowering. PiperOrigin-RevId: 280529784
* Adds canonicalizer to SubViewOp which folds constants from base memref and ↵Andy Davis2019-11-142-2/+47
| | | | | | | | operands into the subview result memref type. Changes SubViewOp to support zero operands case, when offset, strides and sizes are all constant. PiperOrigin-RevId: 280485075
* [ODS] Fix operation argument population to avoid crashLei Zhang2019-11-142-0/+36
| | | | | | | | | | The `Operator` class keeps an `arguments` field, which contains pointers to `operands` and `attributes` elements. Thus it must be populated after `operands` and `attributes` are finalized so to have stable pointers. SmallVector may re-allocate when still having new elements added, which will invalidate pointers. PiperOrigin-RevId: 280466896
* Use MemRefDescriptor in Vector-to-LLVM convresionAlex Zinenko2019-11-141-6/+5
| | | | | | | | | | Following up on the consolidation of MemRef descriptor conversion, update Vector-to-LLVM conversion to use the helper class that abstracts away the implementation details of the MemRef descriptor. This also makes the types of the attributes in emitted llvm.insert/extractelement operations consistently i64 instead of a mix of index and i64. PiperOrigin-RevId: 280441451
* Move VectorOps to Tablegen - (almost) NFCNicolas Vasilache2019-11-1412-247/+215
| | | | | | | | | | | | | | | | This CL moves VectorOps to Tablegen and cleans up the implementation. This is almost NFC but 2 changes occur: 1. an interface change occurs in the padding value specification in vector_transfer_read: the value becomes non-optional. As a shortcut we currently use %f0 for all paddings. This should become an OpInterface for vectorization in the future. 2. the return type of vector.type_cast is trivial and simplified to `memref<vector<...>>` Relevant roundtrip and invalid tests that used to sit in core are moved to the vector dialect. The op documentation is moved to the .td file. PiperOrigin-RevId: 280430869
* Do not emit aliases when printing local formJacques Pienaar2019-11-131-0/+5
| | | | | | Expand local scope printing to skip printing aliases as aliases are printed out at the top of a module and may not be part of the output generated by local scope print. PiperOrigin-RevId: 280278617
* Deprecate linalg.subview in favor of std.subviewNicolas Vasilache2019-11-139-275/+183
| | | | | | | | | | | This CL uses the now standard std.subview in linalg. Two shortcuts are currently taken to allow this port: 1. the type resulting from a view is currently degraded to fully dynamic to pass the SubViewOp verifier. 2. indexing into SubViewOp may access out of bounds since lowering to LLVM does not currently enforce it by construction. These will be fixed in subsequent commits after discussions. PiperOrigin-RevId: 280250129
* Add FuncOp::eraseArgumentSean Silva2019-11-134-0/+169
| | | | | | | | | | | | This is a quite complex operation that users are likely to attempt to write themselves and get wrong (citation: users=me). Ideally, we could pull this into FunctionLike, but for now, the FunctionType rewriting makes it FuncOp specific. We would need some hook for rewriting the function type (which for LLVM's func op, would need to rewrite the underlying LLVM type). PiperOrigin-RevId: 280234164
* NFC: Refactor block signature conversion to not erase the original arguments.River Riddle2019-11-133-7/+25
| | | | | | This refactors the implementation of block signature(type) conversion to not insert fake cast operations to perform the type conversion, but to instead create a new block containing the proper signature. This has the benefit of enabling the use of pre-computed analyses that rely on mapping values. It also leads to a much cleaner implementation overall. The major user facing change is that applySignatureConversion will now replace the entry block of the region, meaning that blocks generally shouldn't be cached over calls to applySignatureConversion. PiperOrigin-RevId: 280226936
* Rename the current parseSymbolName to parseOptionalSymbolNameRiver Riddle2019-11-131-1/+1
| | | | | | The current implementation silently fails if the '@' identifier isn't present, making it similar to the 'optional' parse methods. This change renames the current implementation to 'Optional' and adds a new 'parseSymbolName' that emits an error. PiperOrigin-RevId: 280214610
* Make VariableOp instructions be in the first block in the function.Hanhan Wang2019-11-121-0/+13
| | | | | | | | | | | Since VariableOp is serialized during processBlock, we add two more fields, `functionHeader` and `functionBody`, to collect instructions for a function. After all the blocks have been processed, we append them to the `functions`. Also, fix a bug in processGlobalVariableOp. The global variables should be encoded into `typesGlobalValues`. PiperOrigin-RevId: 280105366
* Add operations needed to support lowering of AffineExpr to SPIR-V.Mahesh Ravishankar2019-11-121-1/+44
| | | | | | | | Lowering of CmpIOp, DivISOp, RemISOp, SubIOp and SelectOp to SPIR-V dialect enables the lowering of operations generated by AffineExpr -> StandardOps conversion into the SPIR-V dialect. PiperOrigin-RevId: 280039204
* Add support for OpPhi in loop header blockLei Zhang2019-11-121-1/+45
| | | | | | | | | | | | During deserialization, the loop header block will be moved into the spv.loop's region. If the loop header block has block arguments, we need to make sure it is correctly carried over to the block where the new spv.loop resides. During serialization, we need to make sure block arguments from the spv.loop's entry block are not silently dropped. PiperOrigin-RevId: 280021777
* Add an option to print an operation if a diagnostic is emitted on itRiver Riddle2019-11-123-5/+20
| | | | | | It is often helpful to inspect the operation that the error/warning/remark/etc. originated from, especially in the context of debugging or in the case of a verifier failure. This change adds an option 'mlir-print-op-on-diagnostic' that attaches the operation as a note to any diagnostic that is emitted on it via Operation::emit(Error|Warning|Remark). In the case of an error, the operation is printed in the generic form. PiperOrigin-RevId: 280021438
* Add Conversion to lower loop::ForOp to spirv::LoopOp.Mahesh Ravishankar2019-11-121-0/+39
| | | | | | | | | loop::ForOp can be lowered to the structured control flow represented by spirv::LoopOp by making the continue block of the spirv::LoopOp the loop latch and the merge block the exit block. The resulting spirv::LoopOp has a single back edge from the continue to header block, and a single exit from header to merge. PiperOrigin-RevId: 280015614
* Add LLVM lowering of std.subviewNicolas Vasilache2019-11-121-0/+26
| | | | | | A followup CL will replace usage of linalg.subview by std.subview. PiperOrigin-RevId: 279961981
* Adds affine.min operation which returns the minimum value from a ↵Andy Davis2019-11-123-1/+77
| | | | | | multi-result affine map. This operation is useful for things like computing the dynamic value of affine loop bounds, and is trivial to constant fold. PiperOrigin-RevId: 279959714
* Add support for alignment attribute in std.alloc.Nicolas Vasilache2019-11-127-222/+261
| | | | | | | | | | | | This CL adds an extra pointer to the memref descriptor to allow specifying alignment. In a previous implementation, we used 2 types: `linalg.buffer` and `view` where the buffer type was the unit of allocation/deallocation/alignment and `view` was the unit of indexing. After multiple discussions it was decided to use a single type, which conflates both, so the memref descriptor now needs to carry both pointers. This is consistent with the [RFC-Proposed Changes to MemRef and Tensor MLIR Types](https://groups.google.com/a/tensorflow.org/forum/#!searchin/mlir/std.view%7Csort:date/mlir/-wKHANzDNTg/4K6nUAp8AAAJ). PiperOrigin-RevId: 279959463
* Add support for nested symbol references.River Riddle2019-11-113-6/+10
| | | | | | | | | | | | | | | | | | This change allows for adding additional nested references to a SymbolRefAttr to allow for further resolving a symbol if that symbol also defines a SymbolTable. If a referenced symbol also defines a symbol table, a nested reference can be used to refer to a symbol within that table. Nested references are printed after the main reference in the following form: symbol-ref-attribute ::= symbol-ref-id (`::` symbol-ref-id)* Example: module @reference { func @nested_reference() } my_reference_op @reference::@nested_reference Given that SymbolRefAttr is now more general, the existing functionality centered around a single reference is moved to a derived class FlatSymbolRefAttr. Followup commits will add support to lookups, rauw, etc. for scoped references. PiperOrigin-RevId: 279860501
* Adds std.subview operation which takes dynamic offsets, sizes and strides ↵Andy Davis2019-11-112-0/+104
| | | | | | | | and returns a memref type which represents sub/reduced-size view of its memref argument. This operation is a companion operation to the std.view operation added as proposed in "Updates to the MLIR MemRefType" RFC. PiperOrigin-RevId: 279766410
* Also consider index constants when folding integer arithmetics with constants.Stephan Herhut2019-11-111-0/+45
| | | | PiperOrigin-RevId: 279698088
OpenPOWER on IntegriCloud