summaryrefslogtreecommitdiffstats
path: root/mlir/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* 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-112-2/+2
| | | | PiperOrigin-RevId: 274154655
* Add unary ops and ExpOp to Standard Dialect.Alexander Belyaev2019-10-112-27/+96
| | | | PiperOrigin-RevId: 274152154
* 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-102-2/+100
| | | | | | | | | | | | | | | 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-101-0/+6
| | | | | | | | | | | | 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-101-0/+8
| | | | | | | | | | | 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-102-6/+67
| | | | | | | | | | | 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 support for canonicalizing callable regions during inlining.River Riddle2019-10-103-28/+164
| | | | | | 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-102-12/+46
| | | | | | | | 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
* Mark GPU dialect as illegal when lowering to NVVM.Christian Sigg2019-10-101-0/+1
| | | | PiperOrigin-RevId: 273948293
* Use llvm.func to define functions with wrapped LLVM IR function typeAlex Zinenko2019-10-1011-179/+184
| | | | | | | | | | | | | | 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
* Fix typo in QuantizedType method namesKazuaki Ishizaki2019-10-092-6/+6
| | | | | | | 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
* Add ::printAsTextualPipeline to Pass and OpPassManager.MLIR Team2019-10-091-0/+23
| | | | | | | | 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-092-102/+191
| | | | | | | | | | | | | | | | | | | | | | 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
* Add support for some multi-store cases in affine fusionDiego Caballero2019-10-091-34/+66
| | | | | | | | | | | | | | 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
* 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
* Allow dynamic but ranked types in ops with SameOperandsAndResultShape and ↵Smit Hinsu2019-10-083-43/+40
| | | | | | | | | | 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-081-24/+68
| | | | | | 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-082-46/+110
| | | | | | | | | | | | | | | | 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
* Add support for parsing/printing non bare-identifier SymbolRefs.River Riddle2019-10-089-30/+103
| | | | | | The restriction that symbols can only have identifier names is arbitrary, and artificially limits the names that a symbol may have. This change adds support for parsing and printing symbols that don't fit in the 'bare-identifier' grammar by printing the reference in quotes, e.g. @"0_my_reference" can now be used as a symbol name. PiperOrigin-RevId: 273644768
* [ROCm] Fix the return type for the device function calls from i32 to i64.Deven Desai2019-10-081-1/+1
| | | | | | | | | This is matching what the runtime library is expecting. Closes tensorflow/mlir#171 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/171 from deven-amd:deven-rocdl-device-func-i64 80762629a8c34e844ebdc542b34dd783990db9db PiperOrigin-RevId: 273640767
* [spirv] Add a pass to decorate the composite types with layout info.Denis Khalikov2019-10-084-3/+334
| | | | | | | | | | | Add a pass to decorate the composite types used by composite objects in the StorageBuffer, PhysicalStorageBuffer, Uniform, and PushConstant storage classes with layout information. Closes tensorflow/mlir#156 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/156 from denis0x0D:sandbox/layout_info_decoration 7c50840fd38ca169a2da7ce9886b52b50c868b84 PiperOrigin-RevId: 273634140
* Add a PatternRewriter hook for cloning a region into another.River Riddle2019-10-082-54/+121
| | | | | | This is similar to the `inlineRegionBefore` hook, except the original blocks are unchanged. The region to be cloned *must* not have been modified during the conversion process at the point of cloning, i.e. it must belong an operation that has yet to be converted, or the operation that is currently being converted. PiperOrigin-RevId: 273622533
* unroll and jam: fix order of jammed bodiesUday Bondhugula2019-10-081-2/+2
| | | | | | | | | | | | | | - bodies would earlier appear in the order (i, i+3, i+2, i+1) instead of (i, i+1, i+2, i+3) for example for factor 4. - clean up hardcoded test cases Signed-off-by: Uday Bondhugula <uday@polymagelabs.com> Closes tensorflow/mlir#170 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/170 from bondhugula:ujam b66b405b2b1894a03b376952e32a9d0292042665 PiperOrigin-RevId: 273613131
* Add support for walking the uses of a symbol.River Riddle2019-10-081-0/+157
| | | | | | MLIR uses symbol references to model references to many global entities, such as functions/variables/etc. Before this change, there is no way to actually reason about the uses of such entities. This change provides a walker for symbol references(via SymbolTable::walkSymbolUses), as well as 'use_empty' support(via SymbolTable::symbol_use_empty). It also resolves some deficiencies in the LangRef definition of SymbolRefAttr, namely the restrictions on where a SymbolRefAttr can be stored, ArrayAttr and DictionaryAttr, and the relationship with operations containing the SymbolTable trait. PiperOrigin-RevId: 273549331
* NFC: Remove unused default cl::opt value.River Riddle2019-10-081-2/+1
| | | | | | The default value is never used as the value of the elide option is only used if it has an occurrence. PiperOrigin-RevId: 273545143
* 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
* GPUToCUDA: attach CUBIN to the nested module rather than to the functionAlex Zinenko2019-10-082-46/+38
| | | | | | | | | | | Originally, we were attaching attributes containing CUBIN blobs to the kernel function called by `gpu.launch_func`. This kernel is now contained in a nested module that is used as a compilation unit. Attach compiled CUBIN blobs to the module rather than to the function since we were compiling the module. This also avoids duplication of the attribute on multiple kernels within the same module. PiperOrigin-RevId: 273497303
* GPUToCUDA: emit addressof directly instead of wrapping it into a getter functionAlex Zinenko2019-10-081-65/+13
| | | | | | | | | | | | | Originally, the CUBIN getter function was introduced as a mechanism to circumvent the absence of globals in the LLVM dialect. It would allocate memory and populate it with the CUBIN data. LLVM dialect now supports globals and they are already used to store CUBIN data, making the getter function a trivial address computation of a global. Emit the address computation directly at the place of `gpu.launch_func` instead of putting it in a function and calling it. This simplifies the conversion flow and prepares it for using the DialectConversion infrastructure. PiperOrigin-RevId: 273496221
* Fuse GenerateCubinAccessors pass into LaunchFunctToCudaAlex Zinenko2019-10-083-141/+58
| | | | | | | | | | | Now that the accessor function is a trivial getter of the global variable, it makes less sense to have the getter generation as a separate pass. Move the getter generation into the lowering of `gpu.launch_func` to CUDA calls. This change is mostly code motion, but the process can be simplified further by generating the addressof inplace instead of using a call. This is will be done in a follow-up. PiperOrigin-RevId: 273492517
* Use named modules for gpu.launch_funcAlex Zinenko2019-10-085-80/+161
| | | | | | | | | | | | | | | | | | The kernel function called by gpu.launch_func is now placed into an isolated nested module during the outlining stage to simplify separate compilation. Until recently, modules did not have names and could not be referenced. This limitation was circumvented by introducing a stub kernel at the same name at the same nesting level as the module containing the actual kernel. This relation is only effective in one direction: from actual kernel function to its launch_func "caller". Leverage the recently introduced symbol name attributes on modules to refer to a specific nested module from `gpu.launch_func`. This removes the implicit connection between the identically named stub and kernel functions. It also enables support for `gpu.launch_func`s to call different kernels located in the same module. PiperOrigin-RevId: 273491891
* Update upgrade some uses of mlir::interleave API to take container argument ↵Jing Pu2019-10-072-7/+3
| | | | | | directly. PiperOrigin-RevId: 273446814
* Add a flag to the AsmPrinter for eliding large ElementsAttrs.River Riddle2019-10-071-2/+42
| | | | | | Some modules may have extremely large ElementsAttrs, which makes debugging involving IR dumping extremely slow and painful. This change adds a flag that will elide ElementsAttrs with a "large"(as defined by the user) number of elements by printing "..." instead of the element data. PiperOrigin-RevId: 273413100
* Print result types when dumping graphviz.Jing Pu2019-10-071-0/+6
| | | | PiperOrigin-RevId: 273406833
* Expose `fuseProducerOf` in Linalg/Utils/Utils.h.MLIR Team2019-10-071-11/+6
| | | | PiperOrigin-RevId: 273384063
* Do not add spirv::BitcastOp for cast from signed to unsigned type.Mahesh Ravishankar2019-10-071-0/+75
| | | | | | | | | Since MLIR integer types don't make a distinction between signed vs unsigned integers, during deserialization of SPIR-V binaries, the OpBitcast might result in a cast from/to the same type. Do not add a spv.Bitcast operation to the spv.module in these cases. PiperOrigin-RevId: 273381887
* Add a new class, OpPrintingFlags, to enable programmatic control of ↵River Riddle2019-10-071-22/+64
| | | | | | | | Operation::print behavior. This allows for controlling the behavior of the AsmPrinter programmatically, instead of relying exclusively on cl::opt flags. This will also allow for more fine-tuned control of printing behavior per callsite, instead of being applied globally. PiperOrigin-RevId: 273368361
* Update UndefOp (de)serialization to generate OpUndef at module level.Mahesh Ravishankar2019-10-072-0/+55
| | | | | | | | | | | | | The SPIR-V spec recommends all OpUndef instructions be generated at module level. For the SPIR-V dialect its better for UndefOp to produce an SSA value for use with other instructions. If UndefOp is to be used at module level, it cannot produce an SSA value (use of this SSA value within FuncOp would need implicit capture). To satisfy needs of the SPIR-V spec while making it simpler to represent UndefOp in the SPIR-V dialect, the serialization is updated to create OpUndef instruction at module scope. PiperOrigin-RevId: 273355526
* [spirv] Fix function entry block erase after moving to spv.selectionLei Zhang2019-10-072-34/+58
| | | | | | | | | | | | | | | | The structured selection/loop's entry block does not have arguments. If the function's header block is also part of the structured control flow, we cannot just simply erase it because it may contain arguments matching the function signature and used by the cloned blocks. Instead, turn it into a block only containing a spv.Branch op. Also, we can directly emit instructions for the spv.selection header block to the block containing the spv.selection op. This eliminates unnecessary branches in the SPIR-V blob. Added a test for nested spv.loop. PiperOrigin-RevId: 273351424
* fix simplify-affine-structures bugUday Bondhugula2019-10-071-3/+10
| | | | | | | | | Signed-off-by: Uday Bondhugula <uday@polymagelabs.com> Closes tensorflow/mlir#157 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/157 from bondhugula:quickfix bd1fcd79825fc0bd5b4a3e688153fa0993ab703d PiperOrigin-RevId: 273316498
* Change Block::getParent() to be a const function. This is only necessary ↵Christian Sigg2019-10-071-1/+3
| | | | | | because ilist_node_with_parent specifically requires a 'getParent() const' method. If/When ilist_node removes this constraint we should drop the const to fit the rest of the MLIR const model. PiperOrigin-RevId: 273316153
* Support AllocOp terminal in Linalg::AliasAnalysis.Nicolas Vasilache2019-10-072-0/+6
| | | | | | | | Now that linalg.view and strided memrefs are unified, there is no reason to disallow AllocOp in alias analysis. This CLs adds support for AllocOp which allows writing shorter tests that do not require explicitly creating a view for each operation. PiperOrigin-RevId: 273303060
* Add DialectType and generate docs for dialect typesJacques Pienaar2019-10-072-8/+19
| | | | | | Add new `typeDescription` (description was already used by base constraint class) field to type to allow writing longer descriptions about a type being defined. This allows for providing additional information/rationale for a defined type. This currently uses `description` as the heading/name for the type in the generated documentation. PiperOrigin-RevId: 273299332
* Add OpaqueLoc to MLIR locations.MLIR Team2019-10-074-1/+58
| | | | | | | | | See RFC: https://groups.google.com/a/tensorflow.org/forum/#!topic/mlir/xE2IzfhE3Wg. Opaque location stores two pointers, one of them points to some data structure that is external to MLIR, and the other one is unique for each type and represents type id of that data structure. OpaqueLoc also stores an optional location that can be used if the first one is not suitable. OpaqueLoc is managed similar to FileLineColLoc. It is passed around by MLIR transformations and can be used in compound locations like CallSiteLoc. PiperOrigin-RevId: 273266510
* Support reduction of partial warps.Christian Sigg2019-10-071-88/+159
| | | | | | gpu.all_reduce now supports block sizes that are not multiple of 32. PiperOrigin-RevId: 273255204
OpenPOWER on IntegriCloud