summaryrefslogtreecommitdiffstats
path: root/mlir/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* Add dependencies for standard ops to SPIR-V conversionLei Zhang2019-07-082-1/+5
| | | | PiperOrigin-RevId: 257026374
* NFC: Remove the various "::getFunction" methods.River Riddle2019-07-0816-77/+38
| | | | | | These methods assume that a function is a valid builtin top-level operation, and removing these methods allows for decoupling FuncOp and IR/. Utility "getParentOfType" methods have been added to Operation/OpState to allow for querying the first parent operation of a given type. PiperOrigin-RevId: 257018913
* Add Ops in SPIR-V Dialect corresponding to OpEntryPoint and OpExecutionModeMahesh Ravishankar2019-07-083-16/+161
| | | | PiperOrigin-RevId: 257013183
* Remove dead code.Jacques Pienaar2019-07-081-7/+0
| | | | PiperOrigin-RevId: 257012369
* Add missing overrides.Jacques Pienaar2019-07-082-6/+6
| | | | PiperOrigin-RevId: 256995548
* Include missing header.Jacques Pienaar2019-07-081-0/+2
| | | | | | This target was failing to build with newer version of libc++. PiperOrigin-RevId: 256979592
* Use isa instead of dyn_cast as cast value isn't used.Jacques Pienaar2019-07-071-1/+1
| | | | | | Avoids unused variable warning. PiperOrigin-RevId: 256874512
* Move StdForOp to ODS ForOpNicolas Vasilache2019-07-053-63/+35
| | | | PiperOrigin-RevId: 256657155
* Add a standard if opNicolas Vasilache2019-07-051-9/+81
| | | | | | | | | This CL adds an "std.if" op to represent an if-then-else construct whose condition is an arbitrary value of type i1. This is necessary to lower all the existing examples from affine and linalg to std.for + std.if. This CL introduces the op and adds the relevant positive and negative unit test. Lowering will be done in a separate followup CL. PiperOrigin-RevId: 256649138
* ODS: provide a flag to skip generation of default build methodsAlex Zinenko2019-07-051-0/+4
| | | | | | | | | | | | | | | | | | | Some operations need to override the default behavior of builders, in particular region-holding operations such as affine.for or tf.graph want to inject default terminators into the region upon construction, which default builders won't do. Provide a flag that disables the generation of default builders so that the custom builders could use the same function signatures. This is an intentionally low-level and heavy-weight feature that requires the entire builder to be implemented, and it should be used sparingly. Injecting code into the end of a default builder would depend on the naming scheme of the default builder arguments that is not visible in the ODS. Checking that the signature of a custom builder conflicts with that of a default builder to prevent emission would require teaching ODG to differentiate between types and (optional) argument names in the generated C++ code. If this flag ends up being used a lot, we should consider adding traits that inject specific code into the default builder. PiperOrigin-RevId: 256640069
* NFC: Remove Region::getContainingFunction as Functions are now Operations.River Riddle2019-07-048-29/+20
| | | | PiperOrigin-RevId: 256579717
* Make TranslateFromMLIRFunction type return LogicalResult instead of boolAlex Zinenko2019-07-044-10/+10
| | | | | | This interface was created before MLIR introduced LogicalResult. PiperOrigin-RevId: 256554557
* Add an mlir-cuda-runner tool.Stephan Herhut2019-07-042-10/+15
| | | | | | | | This tool allows to execute MLIR IR snippets written in the GPU dialect on a CUDA capable GPU. For this to work, a working CUDA install is required and the build has to be configured with MLIR_CUDA_RUNNER_ENABLED set to 1. PiperOrigin-RevId: 256551415
* AllocOp: drop redundant verifier checkAlex Zinenko2019-07-041-9/+0
| | | | | | | | | | The equality check between the rank of a memref and the input size of the layout affine map in AllocOp::verify is subsumed by the well-formedness check of the memref type itself. Drop the redundant check from the verifier since it is never exercised (the type builder does not allow one to construct a type that would not pass the verifier check). PiperOrigin-RevId: 256551247
* Add missing mlir:: namespace in definition of createConvertToLLVMIRPass.Stephan Herhut2019-07-041-2/+2
| | | | PiperOrigin-RevId: 256546769
* Make ConvertStandardToLLVMPass extendable with other patternsAlex Zinenko2019-07-041-7/+43
| | | | | | | | | | | Extend the LLVM lowering pass to accept callbacks that construct an instance of (a subclass of) LLVMTypeConverter and populate a list of conversion patterns. These callbacks will be called when the pass processes a module and their results will be used to set up the dialect conversion infrastructure. Clients can now provide additional conversion patterns to avoid the need of materializing type conversions between LLVM and other types. PiperOrigin-RevId: 256532415
* NFC: Refactoring to remove code bloat in SPIRV due to handling of EnumMahesh Ravishankar2019-07-033-167/+77
| | | | | | Class Attribute parsing PiperOrigin-RevId: 256471248
* Replace the implementation of Function and Module with FuncOp and ModuleOp.River Riddle2019-07-0312-685/+311
| | | | | | This is an important step in allowing for the top-level of the IR to be extensible. FuncOp and ModuleOp contain all of the necessary functionality, while using the existing operation infrastructure. As an interim step, many of the usages of Function and Module, including the name, will remain the same. In the future, many of these will be relaxed to allow for many different types of top-level operations to co-exist. PiperOrigin-RevId: 256427100
* Globally change load/store/dma_start/dma_wait operations over to ↵Andy Davis2019-07-0317-229/+466
| | | | | | | | | | | affine.load/store/dma_start/dma_wait. In most places, this is just a name change (with the exception of affine.dma_start swapping the operand positions of its tag memref and num_elements operands). Significant code changes occur here: *) Vectorization: LoopAnalysis.cpp, Vectorize.cpp *) Affine Transforms: Transforms/Utils/Utils.cpp PiperOrigin-RevId: 256395088
* More general subview calculation in tilingNicolas Vasilache2019-07-034-61/+133
| | | | | | This CL refactors tiling to enable tiling of views that are not just specified by a simple permutation. This allows the tiling of convolutions for which a new example is added. PiperOrigin-RevId: 256346028
* Add a generic loop abstraction to the std dialectNicolas Vasilache2019-07-031-1/+120
| | | | | | This CL is the first step of a refactoring unification of the control flow abstraction used in different dialects. The `std.for` loop accepts unrestricted indices to encode min, max and step and will be used as a common abstraction on the way to lower level dialects. PiperOrigin-RevId: 256331795
* NFC: Move Standard to SPIR-V conversion to lib/ConversionLei Zhang2019-07-035-3/+56
| | | | PiperOrigin-RevId: 256271759
* NFC: Move the Function/Module/Operation::verify methods out-of-line.River Riddle2019-07-024-35/+40
| | | | | | As Functions/Modules becomes operations, these methods will conflict with the 'verify' hook already on derived operation types. PiperOrigin-RevId: 256246112
* Add support for promoting Linalg views into new buffers.Nicolas Vasilache2019-07-021-35/+250
| | | | | | | | | | | | | | | | | | | | | | | | | | | This CL uses the generic CopyOp to promote a subview (constructed during tiling) into a new buffer + copy by: 1. Creating a new buffer for the subview. 2. Taking a view into the buffer and copying into it. 3. Adapting the linalg op to operating on the view from point 2. Tiling is extended with a boolean flag to enable promoting views (all or nothing for now). More specifically, the current implementation creates a buffer that is always of the full size of the ranges of the subview. This produces a buffer whose size may be bigger than the actual size of the `subView` at the boundaries and is related to the full/partial tile problem. In practice, we introduce a `buffer`, a `fullLocalView` and a `partialLocalView` such that: * `buffer` is always the size of the subview in the full tile case. * `fullLocalView` is a dense contiguous view into that buffer. * `partialLocalView` is a dense non-contiguous slice of `fullLocalView` that corresponds to the size of `subView` and accounting for boundary effects. The point of the full tile buffer is that constant static tile sizes are folded and result in a buffer type with statically known size and alignment properties. Padding is introduced on the boundary tiles with a `fill` op followed by a partial `copy` op. These behaviors will be refined later, on a per-need basis. PiperOrigin-RevId: 256237319
* Add support for SPIR-V Struct Types. Current support is limited toMahesh Ravishankar2019-07-023-60/+335
| | | | | | supporting only Offset decorations PiperOrigin-RevId: 256216704
* [spirv] Various small improvementsLei Zhang2019-07-023-16/+28
| | | | | | | | * Added comments * Improved op creation * Used LogicalResult where suitable PiperOrigin-RevId: 256203068
* NFC: Refactor Module to be value typed.River Riddle2019-07-0225-100/+101
| | | | | | As with Functions, Module will soon become an operation, which are value-typed. This eases the transition from Module to ModuleOp. A new class, OwningModuleRef is provided to allow for owning a reference to a Module, and will auto-delete the held module on destruction. PiperOrigin-RevId: 256196193
* Resolving buffer operand of linalg.view doesnt have the informationMahesh Ravishankar2019-07-023-18/+41
| | | | | | | | | | | about the buffer size. This is needed to resolve the operand correctly. Add that information to view op serialization/deserialization Also modify the parsing of buffer type by splitting at 'x' to side-step issues with StringRef number parsing. PiperOrigin-RevId: 256188319
* [ODS] NFC: Rename EnumAttr to StrEnumAttr to be consistent with IntEnumAttrLei Zhang2019-07-021-2/+2
| | | | PiperOrigin-RevId: 256169019
* [spirv] Use I32EnumAttr for enum attributesLei Zhang2019-07-024-61/+132
| | | | | | | | | | | | This saves us the excessive string conversions and comparisons in verification and transformation and scopes them only to parsing and printing, which are meant for I/O so string conversions should be fine. In order to do this, changed the custom assembly format of spv.module regarding addressing model and memory model. PiperOrigin-RevId: 256149856
* NFC: Update the Operation 'walk' methods to use llvm::function_ref instead ↵River Riddle2019-07-024-5/+5
| | | | | | of std::function. PiperOrigin-RevId: 256099638
* EnumsGen: remove dangling assertionLei Zhang2019-07-021-1/+0
| | | | | | | | | StringAttr-backed enum attribute cases changed to allow explicit values, But this assertion was not deleted. Fixes https://github.com/tensorflow/mlir/issues/39 PiperOrigin-RevId: 256090793
* Update variable naming to match LLVM coding style.Jacques Pienaar2019-07-011-6/+6
| | | | | | | | Update to follow enumerators naming style https://llvm.org/docs/CodingStandards.html#name-types-functions-variables-and-enumerators-properly this also avoids the mach/boolean.h macros. PiperOrigin-RevId: 256069831
* gpu::LaunchOp: canonicalize away constant kernel argumentsAlex Zinenko2019-07-012-1/+62
| | | | | | | | | | | | | The GPU Launch operation may take constants as arguments, in particular affine-to-GPU mapping pass automatically forwards potentially constant lower bounds of loops into the kernel. Define a canonicalization pattern for LaunchOp that recreates the constants inside the kernel region instead of accepting them as kernel arguments. This is currently restricted to standard constants but may be extended to other constant operations. Also fix an off-by-one indexing bug in OperandStorage::eraseOperand. PiperOrigin-RevId: 256035437
* Generalize the CFG graph printing for Functions to work on Regions instead.River Riddle2019-07-013-18/+25
| | | | PiperOrigin-RevId: 256029944
* Standardize the definition and usage of getAllArgAttrs between FuncOp and ↵River Riddle2019-07-012-5/+5
| | | | | | Function. PiperOrigin-RevId: 255988352
* NFC: Refactor Function to be value typed.River Riddle2019-07-0157-383/+378
| | | | | | Move the data members out of Function and into a new impl storage class 'FunctionStorage'. This allows for Function to become value typed, which will greatly simplify the transition of Function to FuncOp(given that FuncOp is also value typed). PiperOrigin-RevId: 255983022
* TypeConversion: do not materialize conversion of the type to itselfAlex Zinenko2019-07-011-0/+9
| | | | | | | | | | Type conversion does not necessarily affect all types, some of them may remain untouched. The type conversion tool from the dialect conversion framework will unconditionally insert a temporary cast operation from the type to itself anyway, and will try to materialize it to a real conversion operation if there are remaining uses. Simply use the original value instead. PiperOrigin-RevId: 255975450
* Add affine-to-standard lowerings for affine.load/store/dma_start/dma_wait.Andy Davis2019-07-011-1/+130
| | | | PiperOrigin-RevId: 255960171
* [ODS] Introduce IntEnumAttrLei Zhang2019-07-012-4/+13
| | | | | | | | | | | | | | | | | | | In ODS, right now we use StringAttrs to emulate enum attributes. It is suboptimal if the op actually can and wants to store the enum as a single integer value; we are paying extra cost on storing and comparing the attribute value. This CL introduces a new enum attribute subclass that are backed by IntegerAttr. The downside with IntegerAttr-backed enum attributes is that the assembly form now uses integer values, which is less obvious than the StringAttr-backed ones. However, that can be remedied by defining custom assembly form with the help of the conversion utility functions generated via EnumsGen. Choices are given to the dialect writers to decide which one to use for their enum attributes. PiperOrigin-RevId: 255935542
* Add a folder-based EDSC intrinsics constructor (NFC)Nicolas Vasilache2019-07-014-9/+24
| | | | PiperOrigin-RevId: 255908660
* Expose AffineToGPUPass for use with PassManagerAlex Zinenko2019-07-011-4/+21
| | | | | | | | Originally, AffineToGPUPass was created and registered in the source file mainly for testing purposes. Provide a factory function that constructs AffineToGPU pass to make it usable in pass pipelines. PiperOrigin-RevId: 255902831
* Extract the automatic function renaming and symbol table out of Module.River Riddle2019-07-015-26/+38
| | | | | | This functionality is now moved to a new class, ModuleManager. This class allows for inserting functions into a module, and will auto-rename them on insert to ensure a unique name. This now means that users adding new functions to a module must ensure that the function name is unique, as the Module will no longer do it automatically. This also means that Module::getNamedFunction now operates in O(N) instead of the O(c) time it did before. This simplifies the move of Modules to Operations as the ModuleOp will not be able to have this functionality. PiperOrigin-RevId: 255846088
* Move BufferAllocOp and BufferDeallocOp to ODSNicolas Vasilache2019-07-013-78/+66
| | | | | | This CL also fixes a parsing issue in the BufferType, adds LLVM lowering support for handling the static constant buffer size and a roundtrip test. PiperOrigin-RevId: 255834356
* Internal changeJacques Pienaar2019-06-281-2/+1
| | | | PiperOrigin-RevId: 255700627
* Add new operations affine.dma_start and affine.dma_wait which take affine ↵Andy Davis2019-06-281-2/+216
| | | | | | | | | maps for indexing memrefs by construction. These ops are analogues of the current standard ops dma_start/wait, with the exception that the memref operands are affine expressions of loop IVs and symbols (analogous to affine.load/store). The addition of these operations will enable changes to affine transformation and analysis passes which operate on memory dereferencing operations. PiperOrigin-RevId: 255658382
* [spirv] Move conversion passes to a new libraryLei Zhang2019-06-282-3/+17
| | | | PiperOrigin-RevId: 255648303
* Refactor DialectConversion to use 'materializeConversion' when a type ↵River Riddle2019-06-281-63/+43
| | | | | | | | conversion must persist after the conversion has finished. During conversion, if a type conversion has dangling uses a type conversion must persist after conversion has finished to maintain valid IR. In these cases, we now query the TypeConverter to materialize a conversion for us. This allows for the default case of a full conversion to continue working as expected, but also handle the degenerate cases more robustly. PiperOrigin-RevId: 255637171
* Add buffer size information to Linalg::BufferType. If the size isMahesh Ravishankar2019-06-281-10/+52
| | | | | | | | constant then it is represented as <size x elementType>. If the size is not a compile time constant, then it is represented as <? x elementType>. PiperOrigin-RevId: 255619400
* Respect the user provided type when parsing StringAttr.River Riddle2019-06-271-6/+5
| | | | PiperOrigin-RevId: 255532918
OpenPOWER on IntegriCloud