summaryrefslogtreecommitdiffstats
path: root/mlir
Commit message (Collapse)AuthorAgeFilesLines
...
* Add verification for dimension attribute on GPUDialect index operations.Stephan Herhut2019-08-283-1/+46
| | | | PiperOrigin-RevId: 266073204
* Add vim scripts for indent/syntaxUday Bondhugula2019-08-286-51/+192
| | | | | | | | | | | - some of it has been adapted from LLVM's vim utils Signed-off-by: Uday Bondhugula <uday@polymagelabs.com> Closes tensorflow/mlir#90 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/90 from bondhugula:vim 22b1c958818c4b09de0ec8e1d7a4893171a03dbf PiperOrigin-RevId: 266071752
* Fix the equality check of two floating point valuesFeng Liu2019-08-281-3/+5
| | | | PiperOrigin-RevId: 266022088
* Generalize the analysis manager framework to work on any operation at any ↵River Riddle2019-08-286-175/+193
| | | | | | | | nesting. The pass manager is moving towards being able to run on operations at arbitrary nesting. An operation may have both parent and child operations, and the AnalysisManager must be able to handle this generalization. The AnalysisManager class now contains generic 'getCachedParentAnalysis' and 'getChildAnalysis/getCachedChildAnalysis' functions to query analyses on parent/child operations. This removes the hard coded nesting relationship between Module/Function. PiperOrigin-RevId: 266003636
* Tweak to the pretty type parser to recognize that `->` is a special token.Eric Schweitz2019-08-284-0/+18
| | | | | | | | | | | Tweak to the pretty type parser to recognize that `->` is a special token that shouldn't be split into two characters. This change allows dialect types to wrap function types as in `!my.ptr_type<(i32) -> i32>`. Closes tensorflow/mlir#105 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/105 from schweitzpgi:parse-arrow 8b2d768053f419daae5a1a864121a44c4319acbe PiperOrigin-RevId: 265986240
* Add implementation for tensor_load and tensor_store operations.Stephan Herhut2019-08-288-7/+234
| | | | | | This change adds definitions, parsing and verification for both ops. PiperOrigin-RevId: 265954051
* Port mlir-cuda-runner to use dialect conversion framework.Stephan Herhut2019-08-284-91/+134
| | | | | | | | | Instead of lowering the program in two steps (Standard->LLVM followed by GPU->NVVM), leading to invalid IR inbetween, the runner now uses one pattern based rewrite step to go directly from Standard+GPU to LLVM+NVVM. PiperOrigin-RevId: 265861934
* Refactor / improve replaceAllMemRefUsesWithUday Bondhugula2019-08-275-192/+270
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Refactor replaceAllMemRefUsesWith to split it into two methods: the new method does the replacement on a single op, and is used by the existing one. - make the methods return LogicalResult instead of bool - Earlier, when replacement failed (due to non-deferencing uses of the memref), the set of ops that had already been processed would have been replaced leaving the IR in an inconsistent state. Now, a pass is made over all ops to first check for non-deferencing uses, and then replacement is performed. No test cases were affected because all clients of this method were first checking for non-deferencing uses before calling this method (for other reasons). This isn't true for a use case in another upcoming PR (scalar replacement); clients can now bail out with consistent IR on failure of replaceAllMemRefUsesWith. Add test case. - multiple deferencing uses of the same memref in a single op is possible (we have no such use cases/scenarios), and this has always remained unsupported. Add an assertion for this. - minor fix to another test pipeline-data-transfer case. Signed-off-by: Uday Bondhugula <uday@polymagelabs.com> Closes tensorflow/mlir#87 PiperOrigin-RevId: 265808183
* Update Ch.2 of the Toy tutorial.River Riddle2019-08-277-339/+328
| | | | | | | | The code and documentation for this chapter of the tutorial have been updated to follow the new flow. The toy 'array' type has been replaced by usages of the MLIR tensor type. The code has also been cleaned up and modernized. Closes tensorflow/mlir#101 PiperOrigin-RevId: 265744086
* Add 3 additional intrinsic ops to NVVM dialect, in preparation to implement ↵MLIR Team2019-08-275-35/+159
| | | | | | block-wide reduce. PiperOrigin-RevId: 265720077
* [spirv] Fix the entry block to start with OpLabelLei Zhang2019-08-274-8/+82
| | | | | | | | Each basic block in SPIR-V must start with an OpLabel instruction. We don't support control flow yet, so this CL just makes sure that the entry block follows this rule and is valid. PiperOrigin-RevId: 265718841
* Enhance GPU To SPIR-V conversion to support builtins and load/store ops.Mahesh Ravishankar2019-08-278-27/+437
| | | | | | | | | | | | | | | | | To support a conversion of a simple load-compute-store kernel from GPU dialect to SPIR-V dialect, the conversion of operations like "gpu.block_dim", "gpu.thread_id" which allow threads to get the launch conversion is needed. In SPIR-V these are specified as global variables with builin attributes. This CL adds support to specify builtin variables in SPIR-V conversion framework. This is used to convert the relevant operations from GPU dialect to SPIR-V dialect. Also add support for conversion of load/store operation in Standard dialect to SPIR-V dialect. To simplify the conversion add a method to build a spv.AccessChain operation that automatically determines the return type based on the base pointer type and the indices provided. PiperOrigin-RevId: 265718525
* [spirv] Add Block decoration for spv.struct.Denis Khalikov2019-08-274-0/+165
| | | | | | | | Add Block decoration for top-level spv.struct. Closes tensorflow/mlir#102 PiperOrigin-RevId: 265716241
* NFC: Remove the explicit context from Operation::create and OperationState.River Riddle2019-08-268-27/+23
| | | | | | The context can easily be recovered from the Location in these situations. PiperOrigin-RevId: 265578574
* Add FPToSI/FPExt/FPTrunc cast ops to the LLVM dialect.Eric Schweitz2019-08-262-0/+13
| | | | | | Closes tensorflow/mlir#99 PiperOrigin-RevId: 265538731
* NFC: Remove unnecessary context parameters from several Location getters.River Riddle2019-08-263-20/+16
| | | | | | The context can be recovered by other means in these methods and doesn't need to be passed explicitly. PiperOrigin-RevId: 265532956
* Update documentation for custom rewrite specs.MLIR Team2019-08-261-5/+7
| | | | PiperOrigin-RevId: 265485862
* Support folding of ops with inner ops in GreedyPatternRewriteDriver.Andy Ly2019-08-264-16/+53
| | | | | | This fixes a bug when folding ops with inner ops and inner ops are still being visited. PiperOrigin-RevId: 265475780
* NFC: Add doc for id-punctAlina Sbirlea2019-08-231-0/+1
| | | | PiperOrigin-RevId: 265190168
* NFC: Update Ch.1 of the Toy tutorial.River Riddle2019-08-233-19/+23
| | | | | | Change the use of 'array' to 'tensor' to reflect the new flow that the tutorial will follow. Also tidy up some of the documentation, code comments, and fix a few out-dated links. PiperOrigin-RevId: 265174676
* Lower linalg.copy to LLVM dialect in the presence of transposes.Nicolas Vasilache2019-08-233-15/+95
| | | | | | | | | | Add an extra RewritePattern that does not convert types to rewrite a CopyOp that has non-identity permutations into a sequence of TransposeOp followed by a CopyOp without such permutations. This RewitePattern is made to fail in the non-permutation case so that the conversion pattern can kick in to lower to LLVM. This is an instance of A->A->B lowering where A->A is done by a RewritePattern in case_1 and A->B is done by a ConversionPatternRewriter when not(case_1). PiperOrigin-RevId: 265171380
* Lower linalg.transpose to LLVM dialectNicolas Vasilache2019-08-233-4/+141
| | | | | | | | | | | | Add a conversion pattern that transforms a linalg.transpose op into: 1. A function entry `alloca` operation to allocate a ViewDescriptor. 2. A load of the ViewDescriptor from the pointer allocated in 1. 3. Updates to the ViewDescriptor to introduce the data ptr, offset, size and stride. Size and stride are permutations of the original values. 4. A store of the resulting ViewDescriptor to the alloca'ed pointer. The linalg.transpose op is replaced by the alloca'ed pointer. PiperOrigin-RevId: 265169112
* Add a linalg.transpose opNicolas Vasilache2019-08-234-10/+96
| | | | | | | | | | | | | | A linalg.transpose op is a pure metadata operation that takes a view + permutation map and produces another view of the same underlying data, with a different reindexing. This is a pure metadata operation that does not touch the underlying data. Example: ``` %t = linalg.transpose %v (i, j) -> (j, i) : !linalg.view<?x?xf32> ``` PiperOrigin-RevId: 265139429
* NFC: Add a note to 'applyPatternsGreedily' that it also performs folding/dce.River Riddle2019-08-232-3/+4
| | | | | | Fixes tensorflow/mlir#72 PiperOrigin-RevId: 265097597
* Add lowering of linalg.copy to an external C++ library and a test.Nicolas Vasilache2019-08-234-8/+59
| | | | | | This CL extends support for lowering of linalg to external C++ libraries with CopyOp. Currently this can only work when the permutation maps in the copies are identity. Future support for permutations will be added later. PiperOrigin-RevId: 265093025
* Update Linalg slice and subview documentation - NFCNicolas Vasilache2019-08-231-15/+17
| | | | PiperOrigin-RevId: 265092922
* [spirv] NFC: move SPIR-V control flow ops to a separate fileLei Zhang2019-08-235-120/+155
| | | | | | This CL is also purely moving code around for better file organization. PiperOrigin-RevId: 265092566
* Introduce the ability for "isolated from above" ops to introduce shadowingChris Lattner2019-08-235-11/+85
| | | | | | names for the basic block arguments in their body. PiperOrigin-RevId: 265084627
* NFC: Update in-code documentation. Make the two grammar definitions of ↵MLIR Team2019-08-231-3/+5
| | | | | | static-dimension-list consistent. PiperOrigin-RevId: 265084348
* [spirv] NFC: move arithmetic and logical ops to separate filesLei Zhang2019-08-238-1144/+1217
| | | | | | This is purely moving code around for better file organization. PiperOrigin-RevId: 265082517
* Fix BufferAllocOp builder.Nicolas Vasilache2019-08-231-1/+4
| | | | | | One of the BufferAllocOp builders was improperly specified which triggered infinite recursion. This CL fixes it. PiperOrigin-RevId: 265080371
* NFC: Move the operation, region, and block sections to after the dialect ↵River Riddle2019-08-231-297/+275
| | | | | | | | section. Operations/Regions/Blocks represent the core IR building blocks and should be introduced before types and attributes. PiperOrigin-RevId: 265079103
* Add I32ElementsAttr to OpBaseMLIR Team2019-08-223-0/+41
| | | | PiperOrigin-RevId: 264969142
* Add iterator support to ElementsAttr and SparseElementsAttr.River Riddle2019-08-224-35/+309
| | | | | | This will allow iterating the values of a non-opaque ElementsAttr, with all of the types currently supported by DenseElementsAttr. This should help reduce the amount of specialization on DenseElementsAttr. PiperOrigin-RevId: 264968151
* NFC: Cleanup the Attribute section in the LangRef.River Riddle2019-08-221-50/+116
| | | | | | | | * Add a section on dialect attribute values and attribute aliases * Move FloatAttr into its alphabetically correct place * Add a "Standard Attribute Values" section PiperOrigin-RevId: 264959306
* NFC: Cleanup the type system section of the LangRef.River Riddle2019-08-221-166/+163
| | | | | | | | * Alphabetize the type definitions * Make 'Dialect specific types' a type-system subsection * Merge Builtin types and Standard types PiperOrigin-RevId: 264947721
* [spirv] Add support for extension (de)serializationLei Zhang2019-08-226-19/+128
| | | | | | | Only a few important KHR extensions are registered to the SPIR-V dialect for now. PiperOrigin-RevId: 264939428
* NFC: Rework and cleanup the High-Level structure and Dialect sections.River Riddle2019-08-221-110/+105
| | | | | | Both sections are out-of-date and need to be updated. The dialect section is particularly bad in that it never actually mentions what a 'Dialect' is. PiperOrigin-RevId: 264937905
* NFC: Remove mentions of the TensorFlow dialect from the langref.River Riddle2019-08-221-44/+4
| | | | PiperOrigin-RevId: 264904489
* Avoid overflow when lowering linalg.sliceNicolas Vasilache2019-08-223-34/+66
| | | | | | | | linalg.subview used to lower to a slice with a bounded range resulting in correct bounded accesses. However linalg.slice could still index out of bounds. This CL moves the bounding to linalg.slice. LLVM select and cmp ops gain a more idiomatic builder. PiperOrigin-RevId: 264897125
* NFC: Avoid reconstructing the OpInterface methods.River Riddle2019-08-221-16/+8
| | | | PiperOrigin-RevId: 264881293
* [spirv] Add support for capability (de)serializationLei Zhang2019-08-226-20/+312
| | | | | | | This CL pulls in capabilities defined in the spec and adds support for (de)serialize capabilities of a spv.module. PiperOrigin-RevId: 264877413
* Add Positive{I32,I64}Attr and HasAnyRankOfPredLogan Chien2019-08-224-0/+98
| | | | | | | | This commit adds `PositiveI32Attr` and `PositiveI64Attr` to match positive integers but not zero nor negative integers. This commit also adds `HasAnyRankOfPred` to match tensors with the specified ranks. PiperOrigin-RevId: 264867046
* Split out parsing location into separate functions per instanceJacques Pienaar2019-08-221-107/+127
| | | | | | Split out method into specialized instances + add an early exit. Should be NFC, but simplifies reading the logic slightly IMHO. PiperOrigin-RevId: 264855529
* Let LLVMOpLowering specify a PatternBenefit - NFCNicolas Vasilache2019-08-222-4/+4
| | | | | | Currently the benefit is always set to 1 which limits the ability to do A->B->C lowering PiperOrigin-RevId: 264854146
* NFC: Fix path of LinalgLibraryOpInterfaces inc files.River Riddle2019-08-222-2/+2
| | | | PiperOrigin-RevId: 264827908
* Add support for generating operation interfaces from the ODS framework.River Riddle2019-08-219-154/+437
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Operation interfaces generally require a bit of boilerplate code to connect all of the pieces together. This cl introduces mechanisms in the ODS to allow for generating operation interfaces via the 'OpInterface' class. Providing a definition of the `OpInterface` class will auto-generate the c++ classes for the interface. An `OpInterface` includes a name, for the c++ class, along with a list of interface methods. There are two types of methods that can be used with an interface, `InterfaceMethod` and `StaticInterfaceMethod`. They are both comprised of the same core components, with the distinction that `StaticInterfaceMethod` models a static method on the derived operation. An `InterfaceMethod` is comprised of the following components: * ReturnType - A string corresponding to the c++ return type of the method. * MethodName - A string corresponding to the desired name of the method. * Arguments - A dag of strings that correspond to a c++ type and variable name respectively. * MethodBody (Optional) - An optional explicit implementation of the interface method. def MyInterface : OpInterface<"MyInterface"> { let methods = [ // A simple non-static method with no inputs. InterfaceMethod<"unsigned", "foo">, // A new non-static method accepting an input argument. InterfaceMethod<"Value *", "bar", (ins "unsigned":$i)>, // Query a static property of the derived operation. StaticInterfaceMethod<"unsigned", "fooStatic">, // Provide the definition of a static interface method. // Note: `ConcreteOp` corresponds to the derived operation typename. StaticInterfaceMethod<"Operation *", "create", (ins "OpBuilder &":$builder, "Location":$loc), [{ return builder.create<ConcreteOp>(loc); }]>, // Provide a definition of the non-static method. // Note: `op` corresponds to the derived operation variable. InterfaceMethod<"unsigned", "getNumInputsAndOutputs", (ins), [{ return op.getNumInputs() + op.getNumOutputs(); }]>, ]; PiperOrigin-RevId: 264754898
* Avoid assigning to an unchecked Error.River Riddle2019-08-211-10/+14
| | | | | | Fixes tensorflow/mlir#97 PiperOrigin-RevId: 264743395
* Point to spv.AccessChain when reporting spv.AccessChain errorsLei Zhang2019-08-212-9/+8
| | | | PiperOrigin-RevId: 264742130
* Remove dead getLLVMLibraryCallImplDefinition in Linalg's ↵Nicolas Vasilache2019-08-211-27/+4
| | | | | | LowerToLLVMDialect.cpp - NFC PiperOrigin-RevId: 264740014
OpenPOWER on IntegriCloud