summaryrefslogtreecommitdiffstats
path: root/mlir/test
Commit message (Collapse)AuthorAgeFilesLines
...
* Adds support for unrolling single-result vector operations with iterator ↵Andy Davis2019-12-041-0/+128
| | | | | | | | type lists and indexing maps to a target vector size. Adds unit tests for unrolling the vector ContractionOp with different iteration orders. PiperOrigin-RevId: 283747503
* Refactor dependencies to expose Vector transformations as patterns - NFCNicolas Vasilache2019-12-036-12/+11
| | | | | | | | | This CL refactors some of the MLIR vector dependencies to allow decoupling VectorOps, vector analysis, vector transformations and vector conversions from each other. This makes the system more modular and allows extracting VectorToVector into VectorTransforms that do not depend on vector conversions. This refactoring exhibited a bunch of cyclic library dependencies that have been cleaned up. PiperOrigin-RevId: 283660308
* [spirv] Add spv.GroupNonUniformBallotLei Zhang2019-12-033-0/+40
| | | | | | | | | This CL also did the following cleanup: - Moved the test for spv.SubgroupBallotKHR to its own file - Wrapped generated canonicalization patterns in anonymous namespace - Updated header comments in SPVOps.td PiperOrigin-RevId: 283650091
* Add a pass to legalize operations before lowering to SPIR-V.Mahesh Ravishankar2019-12-032-0/+114
| | | | | | | | | | | | Not all StandardOps can be lowered to SPIR-V. For example, subview op implementation requires use of pointer bitcasts which is not valid according to SPIR-V spec (or at least is ambiguous about it). Such ops need to be removed/transformed before lowering to SPIR-V. The SPIRVLegalizationPass is added a place where such legalizations can be added. Current implementation folds the subview ops with load/stores so that the lowering itself does not have to convert a subview op. PiperOrigin-RevId: 283642981
* Make diagnostic a bit clearer.Sean Silva2019-12-031-1/+1
| | | | | | This prints out in case of any pass failure. Not just a crash. PiperOrigin-RevId: 283616719
* Add CreateMaskOp to the VectorOps dialect.Andy Davis2019-12-032-0/+22
| | | | PiperOrigin-RevId: 283591888
* Verifier: Better error message in case of successor operand mismatch.Sean Silva2019-12-031-1/+14
| | | | | | In particular, print the successor number in the diagnostic. PiperOrigin-RevId: 283585084
* Convert MemRefType to a linearized array in SPIR-V lowering.Mahesh Ravishankar2019-12-032-10/+17
| | | | | | | | | | | | | | | The SPIR-V lowering used nested !spv.arrays to represented multi-dimensional arrays, with the hope that in-conjunction with the layout annotations, the shape and layout of memref can be represented directly. It is unclear though how portable this representation will end up being. It will rely on driver compilers implementing complex index computations faithfully. A more portable approach is to use linearized arrays to represent memrefs and explicitly instantiate all the index computation in SPIR-V. This gives added benefit that we can further optimize the generated code in MLIR before generating the SPIR-V binary. PiperOrigin-RevId: 283571167
* Fix ViewOp to have at most one offset operandAlex Zinenko2019-12-036-22/+33
| | | | | | | | | | | | | | | | | | | | | As described in the documentation, ViewOp is expected to take an optional dynamic offset followed by a list of dynamic sizes. However, the ViewOp parser did not include a check for the offset being a single value and accepeted a list of values instead. Furthermore, several tests have been exercising the wrong syntax of a ViewOp, passing multiple values to the dyanmic stride list, which was not caught by the parser. The trailing values could have been erronously interpreted as dynamic sizes. This is likely due to resyntaxing of the ViewOp, with the previous syntax taking the list of sizes before the offset. Update the tests to use the syntax with the offset preceding the sizes. Worse, the conversion of ViewOp to the LLVM dialect assumed the wrong order of operands with offset in the trailing position, and erronously relied on the permissive parsing that interpreted trailing dynamic offset values as leading dynamic sizes. Fix the lowering to use the correct order of operands. PiperOrigin-RevId: 283532506
* AffineLoopFusion: Prevent fusion of multi-out-edge producer loopsDiego Caballero2019-12-031-0/+53
| | | | | | | | | | | | | tensorflow/mlir#162 introduced a bug that incorrectly allowed fusion of producer loops with multiple outgoing edges. This commit fixes that problem. It also introduces a new flag to disable sibling loop fusion so that we can test producer-consumer fusion in isolation. Closes tensorflow/mlir#259 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/259 from dcaballe:dcaballe/fix_multi_out_edge_producer_fusion 578d5661705fd5c56c555832d5e0528df88c5282 PiperOrigin-RevId: 283531105
* Extend conversion of SubViewOp to llvm to also support cases where size and ↵Stephan Herhut2019-12-031-0/+54
| | | | | | | | | | | | stride are constant (i.e., there are no size and stride operands). We recently added canonicalization that rewrites constant size and stride operands to SubViewOp into static information in the type, so these patterns now occur during code generation. PiperOrigin-RevId: 283524688
* [spirv] Add spv.SubgroupBallotKHROpLei Zhang2019-12-032-0/+21
| | | | PiperOrigin-RevId: 283522284
* Add linkage support to LLVMFuncOpAlex Zinenko2019-12-031-0/+35
| | | | | | | | | A recent commit introduced the Linkage attribute to the LLVM dialect and used it in the Global Op. Also use it in LLVMFuncOp. As per LLVM Language Reference, if the linkage attribute is omitted, the function is assumed to have external linkage. PiperOrigin-RevId: 283493299
* [VectorOps] Add legality rules to broadcastAart Bik2019-12-022-2/+20
| | | | PiperOrigin-RevId: 283360101
* [ODS] Generate builders taking unwrapped value and defaults for attributesLei Zhang2019-12-023-80/+143
| | | | | | | | | | | | | | | | | | Existing builders generated by ODS require attributes to be passed in as mlir::Attribute or its subclasses. This is okay foraggregate- parameter builders, which is primarily to be used by programmatic C++ code generation; it is inconvenient for separate-parameter builders meant to be called in manually written C++ code because it requires developers to wrap raw values into mlir::Attribute by themselves. This CL extends to generate additional builder methods that take raw values for attributes and handles the wrapping in the builder implementation. Additionally, if an attribute appears late in the arguments list and has a default value, the default value is supplied in the declaration if possible. PiperOrigin-RevId: 283355919
* [DRR] Introduce `$_` to ignore op argument matchLei Zhang2019-12-022-0/+28
| | | | | | | | Right now op argument matching in DRR is position-based, meaning we need to specify N arguments for an op with N ODS-declared argument. This can be annoying when we don't want to capture all the arguments. `$_` is to remedy the situation. PiperOrigin-RevId: 283339992
* Lower linalg.indexed_generic with libcall to LLVM.Alexander Belyaev2019-12-021-2/+24
| | | | PiperOrigin-RevId: 283328994
* Introduce Linkage attribute to the LLVM dialectAlex Zinenko2019-12-025-43/+120
| | | | | | | | | | | LLVM IR supports linkage on global objects such as global variables and functions. Introduce the Linkage attribute into the LLVM dialect, backed by an integer storage. Use this attribute on LLVM::GlobalOp and make it mandatory. Implement parsing/printing of the attribute and conversion to LLVM IR. See tensorflow/mlir#277. PiperOrigin-RevId: 283309328
* [spirv] Check that operand of `spirv::CompositeExtractOp` is constant while ↵Denis Khalikov2019-11-281-0/+11
| | | | | | | | | folding. Closes tensorflow/mlir#281 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/281 from denis0x0D:sandbox/composite_ex_fold d02d73658bd1b9eaa515eb4e0aee34bc41d4252b PiperOrigin-RevId: 282971563
* [Linalg] Change attribute n_loop_types to iteratorJose Ignacio Gomez2019-11-287-37/+37
| | | | | | | | | | This addresses issue tensorflow/mlir#270. Linalg is updated to take the same form of iterator_types than vector contraction. Closes tensorflow/mlir#280 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/280 from tetuante:PRissue270 d26d88d090d3765d3b9884bfabdd023143f27287 PiperOrigin-RevId: 282905396
* [spirv] Add folders for spv.IAdd and spv.IMulLei Zhang2019-11-271-73/+107
| | | | | | | | | Adding zero and multiplying one can be common when generating code for index calculation. This CL also sorted canonicalize.mlir to alphabetical order. PiperOrigin-RevId: 282828055
* Fixed typo in Toy tutorial (second var e -> var f)Aart Bik2019-11-277-14/+14
| | | | PiperOrigin-RevId: 282810649
* Implement Linalg to loops lowering as a patternNicolas Vasilache2019-11-276-10/+23
| | | | | | This CL rewrites the linalg ops to loops transformations as patterns that can be targeted directly from Tablegen. Reliance on OpFolder is removed and to cope with it we introduce local folding patterns that are applied greedily. PiperOrigin-RevId: 282765550
* [VectorOps] Refine BroadcastOp in VectorOps dialectAart Bik2019-11-262-8/+8
| | | | | | | | Since second argument is always fully overwritten and shape is define in "to" clause, it is not needed. Also renamed "into" to "to" now that arg is dropped. PiperOrigin-RevId: 282686475
* [VectorOps] Add a BroadcastOp to the VectorOps dialectAart Bik2019-11-262-0/+16
| | | | PiperOrigin-RevId: 282643305
* Misc changes to lowering to SPIR-V.Mahesh Ravishankar2019-11-265-31/+27
| | | | | | | | | | | | | | | These changes to SPIR-V lowering while adding support for lowering SUbViewOp, but are not directly related. - Change the lowering of MemRefType to !spv.ptr<!spv.struct<!spv.array<...>[offset]>, ..> This is consistent with the Vulkan spec. - To enable testing a simple pattern of lowering functions is added to ConvertStandardToSPIRVPass. This is just used to convert the type of the arguments of the function. The added function lowering itself is not meant to be the way functions are eventually lowered into SPIR-V dialect. PiperOrigin-RevId: 282589644
* Automated rollback of commit d60133f89bb08341718bb3132b19bc891f7d4f4dNicolas Vasilache2019-11-268-19/+19
| | | | PiperOrigin-RevId: 282574110
* Relax restriction on affine_apply dim and symbol operandsNicolas Vasilache2019-11-261-26/+0
| | | | | | | | | | | | | | | | | | The affine_apply operation is currently "doubly" affine and conflates two things: 1. it applies an affine map to a list of values of type `index` that are defined as either dim or symbol 2. it restricts (and propagates constraints on) the provenance of dims and symbols to a small subset of ops for which more restrictive polyhedral constraints apply. Point 2. is related to the ability to form so-called static control parts and is related to dependence analysis and legality of transformations. Point 1. however is completely independent, the only local implication of dims and symbol for affine_apply is that dims compose while symbols concatenate as well as the structural constraint that dims may not be multiplied. The properties of composition and canonicalization in affine_apply are more generally useful. This CL relaxes the verifier on affine_apply so it can be used more generally. The relevant affine.for/if/load/store op verifiers already implement the dim and symbol checking. See this thread for the related discussion: https://groups.google.com/a/tensorflow.org/g/mlir/c/HkwCbV8D9N0/m/8srUNrX6CAAJ PiperOrigin-RevId: 282562517
* Add support for AttrSizedOperandSegments/AttrSizedResultSegmentsLei Zhang2019-11-252-0/+124
| | | | | | | | | | | | | | | | | Certain operations can have multiple variadic operands and their size relationship is not always known statically. For such cases, we need a per-op-instance specification to divide the operands into logical groups or segments. This can be modeled by attributes. This CL introduces C++ trait AttrSizedOperandSegments for operands and AttrSizedResultSegments for results. The C++ trait just guarantees such size attribute has the correct type (1D vector) and values (non-negative), etc. It serves as the basis for ODS sugaring that with ODS argument declarations we can further verify the number of elements match the number of ODS-declared operands and we can generate handy getter methods. PiperOrigin-RevId: 282467075
* Use vector.InsertStridedSlice in Vector -> Vector unrollingNicolas Vasilache2019-11-251-8/+15
| | | | | | | | 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-252-7/+56
| | | | | | 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-255-17/+26
| | | | | | 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-9/+71
| | | | PiperOrigin-RevId: 282434465
* Update VectorContractionOp to take iterator types and index mapping ↵Andy Davis2019-11-252-26/+180
| | | | | | attributes compatible with linalg ops. PiperOrigin-RevId: 282412311
* Changing directory shortcut for CPU/GPU runner utils.Christian Sigg2019-11-258-19/+19
| | | | | | | Moving cuda-runtime-wrappers.so into subdirectory to match libmlir_runner_utils.so. Provide parent directory when running test and load .so from subdirectory. PiperOrigin-RevId: 282410749
* De-duplicate EnumAttr overrides by defining defaultsLei Zhang2019-11-254-1/+8
| | | | | | | EnumAttr should provide meaningful defaults so concrete instances do not need to duplicate the fields. PiperOrigin-RevId: 282398431
* Introduce attributes that specify the final ABI for a spirv::ModuleOp.Mahesh Ravishankar2019-11-254-46/+170
| | | | | | | | | | | | | | | | | | | | | | | | 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-252-1/+25
| | | | | | | | 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-252-4/+48
| | | | | | | | | 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-0/+71
| | | | | | | | | | | | | | | | | | 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-0/+28
| | | | PiperOrigin-RevId: 282270243
* [spirv] NFC: rename test files and sort tests insideLei Zhang2019-11-232-33/+49
| | | | PiperOrigin-RevId: 282132339
* Make isValidSymbol more powerfulUday Bondhugula2019-11-221-0/+21
| | | | | | | | | | | | | | | | | 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-4/+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
* [spirv] Add a canonicalizer for `spirv::LogicalNotOp`.Denis Khalikov2019-11-223-12/+69
| | | | | | | | | | | | | | | | 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-10/+62
| | | | | | | | | | 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
* Add support for using the ODS result names as the Asm result names for ↵River Riddle2019-11-214-44/+28
| | | | | | | | | | | | | | | 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
* Change CUDA tests to use print_memref.Christian Sigg2019-11-213-18/+18
| | | | | | Swap dimensions in all-reduce-op test. PiperOrigin-RevId: 281791744
* Split Linalg declarative patterns from specific test patterns - NFCNicolas Vasilache2019-11-216-0/+149
| | | | | | 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-214-8/+8
| | | | | | | | | | | 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
OpenPOWER on IntegriCloud