summaryrefslogtreecommitdiffstats
path: root/mlir
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix typos in InferTypeOpInterface.Jacques Pienaar2019-10-151-4/+3
| | | | PiperOrigin-RevId: 274866986
* Update Chapter 3 to demonstrate pattern match and rewrite optimizationsSana Damani2019-10-1516-1172/+1032
| | | | | | | | | This is using Table-driven Declarative Rewrite Rules (DRR), the previous version of the tutorial only showed the C++ patterns. Closes tensorflow/mlir#187 PiperOrigin-RevId: 274852321
* Fix typos in LangRef and OpDefinitionsJacques Pienaar2019-10-152-21/+21
| | | | PiperOrigin-RevId: 274848361
* Consistent use of int in mlir_runner_utils.cppNicolas Vasilache2019-10-151-1/+1
| | | | | | This should fix the OSS build by only using int in template types. PiperOrigin-RevId: 274843584
* Add conversion for splat of vectors of 2+DNicolas Vasilache2019-10-154-87/+285
| | | | | | | This CL adds a missing lowering for splat of multi-dimensional vectors. Additional support is also added to the runtime utils library to allow printing memrefs with such vectors. PiperOrigin-RevId: 274794723
* Expose mlir::parseType to bindingsAlex Zinenko2019-10-155-79/+62
| | | | | | | | | | | | | | Python bindings currently currently provide a makeScalarType function that constructs one of the predefined types. It was implemented in the bindings directly to circumvent the absence of standalone type parsing function. Now that mlir::parseType has been made available, rely on the core parsing procedure to construct types from strings in the bindings. This changes includes a library reshuffling that splits out "CoreAPIs" implementing the binding helper APIs into a separate library and makes that dependent on the Parser library. PiperOrigin-RevId: 274794516
* AsmPrinter: avoid unused-variable warningAlex Zinenko2019-10-151-1/+1
| | | | | | | | The value defined in a loop was not being used and the function producing it re-evaluated instead. Use the value to avoid both the warning and the re-evaluation. PiperOrigin-RevId: 274794459
* Merge Ch3 of the Toy tutorial into chapter 2.River Riddle2019-10-1410-211/+1002
| | | | | | This effectively rewrites Ch.2 to introduce dialects, operations, and registration instead of deferring to Ch.3. This allows for introducing the best practices up front(using ODS, registering operations, etc.), and limits the opaque API to the chapter document instead of the code. PiperOrigin-RevId: 274724289
* NFC: Replace usages of Value::getKind with explicit isa/casts.River Riddle2019-10-142-29/+23
| | | | | | It is more idiomatic to use the llvm::cast infrastructure for checking the type of a value. PiperOrigin-RevId: 274684945
* Allowing replacing non-root operations in DialectConversion.River Riddle2019-10-144-4/+47
| | | | | | When dealing with regions, or other patterns that need to generate temporary operations, it is useful to be able to replace other operations than the root op being matched. Before this PR, these operations would still be considered for legalization meaning that the conversion would either fail, erroneously need to mark these ops as legal, or add unnecessary patterns. PiperOrigin-RevId: 274598513
* Use single quotes to wrap '@HOST_LDFLAGS@' in LIT config fileMehdi Amini2019-10-141-1/+2
| | | | | | ldflags can contain double-quoted paths, so must use single quotes here. PiperOrigin-RevId: 274581983
* Fix linalg.subview behavior in (partially) static cases.Nicolas Vasilache2019-10-146-52/+97
| | | | | | | | | | | | | | | | | | | | | When the implementation of the strided memref [RFC](https://groups.google.com/a/tensorflow.org/forum/#!msg/mlir/MaL8m2nXuio/1scRqZa6AQAJ) landed, linalg started using this type instead of the now retired !linalg.view. As static and partially static cases appear, the stride information needs to be maintained properly. In particular, the result type of the subview op was generally incorrect. This CL fixes the issue by computing a return type that: 1. always has dynamic sizes, which is generally the only correct way to construct a subview in the absence of data padding and/or code versioning. 2. has the same strides as the base strided memref. Point 1. above can be further refined but will needs further analysis and canonicalization to optimize the particular case where: 1. The base memref has static size along a given dimension. 2. The subview size can be statically derived (e.g. after canonicalization). 3. *And* the subview size is an even divisor of the base memref. This 3rd constraint is well-known in the case of tiled layouts that don't assume implicit padding: the boundary tile may be only partial and has size given by `problem_size % tile_size`. Tests are updated as appropriate. PiperOrigin-RevId: 274578624
* Add lowering of VectorOps dialect to LLVM to the Linalg LLVM lowering passNicolas Vasilache2019-10-142-0/+44
| | | | | | | | | This fixes an omission that prevents Linalg to lower generic ops regions operating on ops in the VectorOps dialect. To achieve this we simply need to `populateVectorToLLVMConversionPatterns` in the conversion. Relevant tests are added. PiperOrigin-RevId: 274577325
* Add LLVM IR dialect hooks for FP128 and X86_FP80 typesEric Schweitz2019-10-113-1/+19
| | | | | | | Closes tensorflow/mlir#184 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/184 from schweitzpgi:more-float-types ca27d00510a86ffc9c79c65fb3a0193b5ea097a0 PiperOrigin-RevId: 274288813
* Emit LLVM IR equivalent of sizeof when lowering alloc operationsAlex Zinenko2019-10-113-26/+41
| | | | | | | | | | | | | | | | | Originally, the lowering of `alloc` operations has been computing the number of bytes to allocate when lowering based on the properties of MLIR type. This does not take into account type legalization that happens when compiling LLVM IR down to target assembly. This legalization can widen the type, potentially leading to out-of-bounds accesses to `alloc`ed data due to mismatches between address computation that takes the widening into account and allocation that does not. Use the LLVM IR's equivalent of `sizeof` to compute the number of bytes to be allocated: %0 = getelementptr %type* null, %indexType 0 %1 = ptrtoint %type* %0 to %indexType adapted from http://nondot.org/sabre/LLVMNotes/SizeOf-OffsetOf-VariableSizedStructs.txt PiperOrigin-RevId: 274159900
* LLVM Dialect: introduce llvm.mlir.null operationAlex Zinenko2019-10-116-0/+78
| | | | | | | | Similarly to `llvm.mlir.undef`, this auxiliary operation creates an SSA value that corresponds to `null` in LLVM IR. This operation is necessary to model sizeof(<...>) behavior when allocating memory. PiperOrigin-RevId: 274158760
* Drop obsolete code from std to llvm memref loweringUday Bondhugula2019-10-111-22/+11
| | | | | | | | | | | | - dropping what looks like outdated code post some of the previous updates Signed-off-by: Uday Bondhugula <uday@polymagelabs.com> Closes tensorflow/mlir#179 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/179 from bondhugula:llfix 2a72ea441fe1b3924802273ffbe9870afeb90f91 PiperOrigin-RevId: 274158273
* Rename LLVM::exp and LLVM::fmuladd to LLVM::ExpOP and LLVM::FMulAddOp.Alexander Belyaev2019-10-113-4/+4
| | | | PiperOrigin-RevId: 274154655
* Add unary ops and ExpOp to Standard Dialect.Alexander Belyaev2019-10-117-36/+167
| | | | PiperOrigin-RevId: 274152154
* LLVM conversion: harden a test to check for LLVM funcs rather than any funcsAlex Zinenko2019-10-111-10/+10
| | | | | | | | | This test was not updated in the original commit that switched to using LLVM functions since it wasn't broken by that change. FileCheck was able to match the `func` part of `llvm.func` to the expected pattern and continue as usual. Make sure the `llvm.` dialect prefix is included in the expected output. PiperOrigin-RevId: 274127281
* NFC: Print the generic op form after pass failure.River Riddle2019-10-101-8/+9
| | | | | | On failure, the IR is likely to be in an invalid state, meaning the custom printer for some operations may now crash. Using the generic op form prevents this from happening. PiperOrigin-RevId: 274104146
* Add support for generating reproducers on pass crash and failure.River Riddle2019-10-106-4/+158
| | | | | | | | | | | | | | | This cl adds support for generating a .mlir file containing a reproducer for crashes and failures that happen during pass execution. The reproducer contains a comment detailing the configuration of the pass manager(e.g. the textual description of the pass pipeline that the pass manager was executing), along with the original input module. Example Output: // configuration: -pass-pipeline='func(cse, canonicalize), inline' // note: verifyPasses=false module { ... } PiperOrigin-RevId: 274088134
* NFC: Initialize pass manager option fields inline instead of the class ↵River Riddle2019-10-101-51/+31
| | | | | | constructor. PiperOrigin-RevId: 274087577
* Standard-to-LLVM conversion: check that operands have LLVM typesAlex Zinenko2019-10-102-1/+18
| | | | | | | | | | | | In Standard to LLVM dialect conversion, the binary op conversion pattern implicitly assumed some operands were of LLVM IR dialect type. This is not necessarily true, for example if the Ops that produce those operands did not match the existing convresion patterns. Check if all operands are of LLVM IR dialect type and if not, fail to patch the binary op pattern. Closes tensorflow/mlir#168 PiperOrigin-RevId: 274063207
* Translation to LLVM: check the validity of module-level OpsAlex Zinenko2019-10-102-0/+15
| | | | | | | | | | | Translation to LLVM expects the entry module to have only specific types of ops that correspond to LLVM IR entities allowed in a module. Currently those are restricted to functions and globals. Introduce an additional check at the module level. Inside individual functions, the check for supported Ops is already performed, but it accepts all LLVM dialect Ops and wouldn't be immediately applicable at the module level. PiperOrigin-RevId: 274058651
* Add lowering of constant ops to SPIR-V.Mahesh Ravishankar2019-10-103-6/+81
| | | | | | | | | | | The lowering is specified as a pattern and is done only if the result is a SPIR-V scalar type or vector type. Handling ConstantOp with index return type needs special handling since SPIR-V dialect does not have index types. Based on the bitwidth of the attribute value, either i32 or i64 is chosen. Other constant lowerings are left as a TODO. PiperOrigin-RevId: 274056805
* Add trait for specified shapes matchingGeoffrey Martin-Noble2019-10-103-0/+31
| | | | PiperOrigin-RevId: 274046434
* Add support for canonicalizing callable regions during inlining.River Riddle2019-10-107-35/+197
| | | | | | This will allow for inlining newly devirtualized calls, as well as give a more accurate cost model(when we have one). Currently canonicalization will only run for nodes that have no child edges, as the child nodes may be erased during canonicalization. We can support this in the future, but it requires more intricate deletion tracking. PiperOrigin-RevId: 274011386
* Remove the need to convert operations in regions of operations that have ↵River Riddle2019-10-104-14/+59
| | | | | | | | been replaced. When an operation with regions gets replaced, we currently require that all of the remaining nested operations are still converted even though they are going to be replaced when the rewrite is finished. This cl adds a tracking for a minimal set of operations that are known to be "dead". This allows for ignoring the legalization of operations that are won't survive after conversion. PiperOrigin-RevId: 274009003
* Python bindings: export index_castAlex Zinenko2019-10-102-0/+14
| | | | | | | | We are now properly enforcing the absence of index elements in memrefs and tensors. Instead, users are expected to store sized integers and cast them to index type if necessary. Expose the respective operation to Python bindings. PiperOrigin-RevId: 273985856
* Mark GPU dialect as illegal when lowering to NVVM.Christian Sigg2019-10-102-1/+4
| | | | PiperOrigin-RevId: 273948293
* NFC: Cleanup of type checking testsGeoffrey Martin-Noble2019-10-103-133/+144
| | | | | | | | | 1. Rename test ops referencing operand to index from 0 consistent with how we index elsewhere. 2. Don't limit type checking that functions for all shaped types to only tensors. 3. Don't limit (element) type checking functions and add tests for scalars. 4. Remove SSA values that don't do anything. PiperOrigin-RevId: 273917608
* Use llvm.func to define functions with wrapped LLVM IR function typeAlex Zinenko2019-10-1029-307/+324
| | | | | | | | | | | | | | 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
* Add test for fix to tablegen for custom folders for ops that return a singleParker Schuh2019-10-093-0/+22
| | | | | | | | | variadic result. Add missing test for single line fix to `void OpEmitter::genFolderDecls()` entitled "Fold away reduction over 0 dimensions." PiperOrigin-RevId: 273880337
* Fix typo in QuantizedType method namesKazuaki Ishizaki2019-10-093-8/+8
| | | | | | | Closes tensorflow/mlir#172 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/172 from kiszk:quantops e27b57eac8f4c6ef7ee6a6f7b497d3e2f56f6798 PiperOrigin-RevId: 273879164
* Pre-allocate space for results from a regex match that uses 3 match strings.MLIR Team2019-10-091-1/+1
| | | | | | | That space is 4 StringRefs, not 3, because element 0 of the match always contains the entire source string. PiperOrigin-RevId: 273875606
* minor spelling tweaksKazuaki Ishizaki2019-10-0938-69/+69
| | | | | | | | | | | | -- f93661f2c25aab6cc5bf439606b0a1312998a575 by Kazuaki Ishizaki <ishizaki@jp.ibm.com>: address @River707's comment Closes tensorflow/mlir#176 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/176 from kiszk:spelling_tweaks_include_tools f93661f2c25aab6cc5bf439606b0a1312998a575 PiperOrigin-RevId: 273830689
* Add ::printAsTextualPipeline to Pass and OpPassManager.MLIR Team2019-10-096-10/+53
| | | | | | | | Allow printing out pipelines in a format that is as close as possible to the textual pass pipeline format. Individual passes can override the print function in order to format any options that may have been used to construct that pass. PiperOrigin-RevId: 273813627
* Guard rewriter insertion point during signature conversion.Christian Sigg2019-10-091-0/+1
| | | | | | Avoid unexpected side effect in rewriter insertion point. PiperOrigin-RevId: 273785794
* Make SPIR-V lowering infrastructure follow Vulkan SPIR-V validation.Mahesh Ravishankar2019-10-095-128/+258
| | | | | | | | | | | | | | | | | | | | | | The lowering infrastructure needs to be enhanced to lower into a spv.Module that is consistent with the SPIR-V spec. The following changes are needed 1) The Vulkan/SPIR-V validation rules dictates entry functions to have signature of void(void). This requires changes to the function signature conversion infrastructure within the dialect conversion framework. When an argument is dropped from the original function signature, a function can be specified that when invoked will return the value to use as a replacement for the argument from the original function. 2) Some changes to the type converter to make the converted type consistent with the Vulkan/SPIR-V validation rules, a) Add support for converting dynamically shaped tensors to spv.rtarray type. b) Make the global variable of type !spv.ptr<!spv.struct<...>> 3) Generate the entry point operation for the kernel functions and automatically compute all the interface variables needed PiperOrigin-RevId: 273784229
* Fix Windows linkage errorNicolas Vasilache2019-10-091-10/+10
| | | | | | | This CL fixes bad macro names usage in mlir_runner_utils.h. The macro mlir_runner_utils_EXPORTS now matches what is defined in CMakeLists.txt. PiperOrigin-RevId: 273773931
* Add support for some multi-store cases in affine fusionDiego Caballero2019-10-092-34/+141
| | | | | | | | | | | | | | This PR is a stepping stone towards supporting generic multi-store source loop nests in affine loop fusion. It extends the algorithm to support fusion of multi-store loop nests that: 1. have only one store that writes to a function-local live out, and 2. the remaining stores are involved in loop nest self dependences or no dependences within the function. Closes tensorflow/mlir#162 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/162 from dcaballe:dcaballe/multi-output-fusion 7fb7dec6fe8b45f5ce176f018bfe37b256420c45 PiperOrigin-RevId: 273773907
* Update the usage and comments in define_inst.sh.MLIR Team2019-10-091-3/+6
| | | | PiperOrigin-RevId: 273723108
* Add exp operation to LLVMOPs.td.Alexander Belyaev2019-10-092-3/+23
| | | | PiperOrigin-RevId: 273718958
* Change to doxygen comments. NFC.Christian Sigg2019-10-091-63/+63
| | | | PiperOrigin-RevId: 273707610
* Assert that region is not cloned into itself.Christian Sigg2019-10-091-0/+1
| | | | PiperOrigin-RevId: 273707291
* NFC: Fully qualify use of std::string.River Riddle2019-10-081-3/+3
| | | | PiperOrigin-RevId: 273668957
* Allow dynamic but ranked types in ops with SameOperandsAndResultShape and ↵Smit Hinsu2019-10-087-52/+73
| | | | | | | | | | SameOperandsAndResultType traits Currently SameOperandsAndResultShape trait allows operands to have tensor<*xf32> and tensor<2xf32> but doesn't allow tensor<?xf32> and tensor<10xf32>. Also, use the updated shape compatibility helper function in TensorCastOp::areCastCompatible method. PiperOrigin-RevId: 273658336
* Update the symbol utility methods to handle the case of unknown operations.River Riddle2019-10-084-61/+147
| | | | | | This enhances the symbol table utility methods to handle the case where an unknown operation may define a symbol table. When walking symbols, we now collect all symbol uses before allowing the user to iterate. This prevents the user from assuming that all symbols are actually known before performing a transformation. PiperOrigin-RevId: 273651963
* Add Instance Specific Pass Options.MLIR Team2019-10-088-96/+403
| | | | | | | | | | | | | | | | This allows individual passes to define options structs and for these options to be parsed per instance of the pass while building the pass pipeline from the command line provided textual specification. The user can specify these per-instance pipeline options like so: ``` struct MyPassOptions : public PassOptions<MyPassOptions> { Option<int> exampleOption{*this, "flag-name", llvm::cl::desc("...")}; List<int> exampleListOption{*this, "list-flag-name", llvm::cl::desc("...")}; }; static PassRegistration<MyPass, MyPassOptions> pass("my-pass", "description"); ``` PiperOrigin-RevId: 273650140
OpenPOWER on IntegriCloud