summaryrefslogtreecommitdiffstats
path: root/mlir
Commit message (Collapse)AuthorAgeFilesLines
...
* Relax the restriction that Modules cannot contain operations producing results.River Riddle2019-07-094-32/+18
| | | | | | This was an arbitrary restriction caused by the way that modules were printed. Now that that has been fixed, this restriction can be removed. PiperOrigin-RevId: 257240329
* Standardize the value numbering in the AsmPrinter.River Riddle2019-07-0949-2578/+2608
| | | | | | Change the AsmPrinter to number values breadth-first so that values in adjacent regions can have the same name. This allows for ModuleOp to contain operations that produce results. This also standardizes the special name of region entry arguments to "arg[0-9+]" now that Functions are also operations. PiperOrigin-RevId: 257225069
* Add parentheses around boolean operators in an assertion inAlex Zinenko2019-07-091-4/+2
| | | | | | Linalg/Transforms/Tiling.cpp. This fixes a warning. PiperOrigin-RevId: 257191302
* Fix a test broken on some systems due to a mis-rebase.Alex Zinenko2019-07-093-2/+2
| | | | PiperOrigin-RevId: 257190161
* Implement parametric tiling on standard for loopsAlex Zinenko2019-07-098-13/+336
| | | | | | | | | | | | | | | | | | Parametric tiling can be used to extract outer loops with fixed number of iterations. This in turn enables mapping to GPU kernels on a fixed grid independently of the range of the original loops, which may be unknown statically, making the kernel adaptable to different sizes. Provide a utility function that also computes the parametric tile size given the range of the loop. Exercise the utility function through a simple pass that applies it to all top-level loop nests. Permutability or parallelism checks must be performed before calling this utility function in actual passes. Note that parametric tiling cannot be implemented in a purely affine way, although it can be encoded using semi-affine maps. The choice to implement it on standard loops is guided by them being the common representation between Affine loops, Linalg and GPU kernels. PiperOrigin-RevId: 257180251
* Extend AffineToGPU to support Linalg loopsAlex Zinenko2019-07-0913-288/+462
| | | | | | | | | | | | | | | | Extend the utility that converts affine loop nests to support other types of loops by abstracting away common behavior through templates. This also slightly simplifies the existing Affine to GPU conversion by always passing in the loop step as an additional kernel argument even though it is a known constant. If it is used, it will be propagated into the loop body by the existing canonicalization pattern and can be further constant-folded, otherwise it will be dropped by canonicalization. This prepares for the common loop abstraction that will be used for converting to GPU kernels, which is conceptually close to Linalg loops, while maintaining the existing conversion operational. PiperOrigin-RevId: 257172216
* NFC: Change a usage of StringLiteral to StringRef.River Riddle2019-07-091-3/+1
| | | | | | This matches the result type of other functions returning c-string, and fixes a build failure where some compilers fail to construct the StringLiteral. PiperOrigin-RevId: 257139513
* Generalize the symbol table functionality of ModuleOp into a trait ↵River Riddle2019-07-086-83/+160
| | | | | | | | 'OpTrait::SymbolTable'. Operations must only contain a single region. Once attached, all operations that contain a 'mlir::SymbolTable::getSymbolAttrName()' StringAttr attribute within the child region will be verified to ensure that the names are uniqued. Operations using this trait also gain access to the 'SymbolTable' class, which can be used to manage the symbol table of the operation. This class also provides constant-time lookup of symbols by name, and will automatically rename symbols on insertion. PiperOrigin-RevId: 257123573
* NFC: Remove `Module::getFunctions` in favor of a general `getOps<T>`.River Riddle2019-07-0820-38/+39
| | | | | | Modules can now contain more than just Functions, this just updates the iteration API to reflect that. The 'begin'/'end' methods have also been updated to iterate over opaque Operations. PiperOrigin-RevId: 257099084
* NFC: Make the 'disable-pass-threading' flag a PassManagerOption.River Riddle2019-07-084-12/+35
| | | | | | This also adds the ability to programmatically disable threading. PiperOrigin-RevId: 257051809
* Remove dead code.Jacques Pienaar2019-07-081-12/+0
| | | | PiperOrigin-RevId: 257050780
* Add dependencies for standard ops to SPIR-V conversionLei Zhang2019-07-082-1/+5
| | | | PiperOrigin-RevId: 257026374
* Add missing override.Jacques Pienaar2019-07-081-1/+2
| | | | PiperOrigin-RevId: 257024265
* NFC: Remove the various "::getFunction" methods.River Riddle2019-07-0821-95/+52
| | | | | | 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
* NFC: Add AbstractOperation as a friend of 'Op'.River Riddle2019-07-081-0/+3
| | | | | | This allows for accessing the hidden overload of 'Op::hasTrait'. PiperOrigin-RevId: 257018255
* Add Ops in SPIR-V Dialect corresponding to OpEntryPoint and OpExecutionModeMahesh Ravishankar2019-07-089-21/+548
| | | | PiperOrigin-RevId: 257013183
* Remove dead code.Jacques Pienaar2019-07-081-7/+0
| | | | PiperOrigin-RevId: 257012369
* Add 'hasTrait' support to Operation.River Riddle2019-07-084-3/+32
| | | | | | | | | This is accomplished by adding a new callback to AbstractOperation that takes a ClassID for a given trait type and compares that against the ClassIDs for the traits used when registering an operation. This allows for opaquely querying if an operation was registered with a given trait, e.g: Operation *op = ...; bool singleResult = op->hasTrait<OpTrait::OneResult>(); PiperOrigin-RevId: 257007710
* [spirv] NFC: Remove functions wrapping spv.module in testsLei Zhang2019-07-082-95/+60
| | | | | | | | Now both functions and modules are just general ops and we do not require top-level entities in a module's block to be the old builtin functions any more. Removing the wrapping functions to simplify the tests. PiperOrigin-RevId: 257003572
* Add missing overrides.Jacques Pienaar2019-07-082-6/+6
| | | | PiperOrigin-RevId: 256995548
* Remove std::move of trivially-copyable type.Jacques Pienaar2019-07-081-1/+1
| | | | | | | | Address ClangTidy finding: * std::move of the expression of the trivially-copyable type 'mlir::Module' (aka 'mlir::ModuleOp') has no effect; remove std::move() PiperOrigin-RevId: 256981849
* Include missing header.Jacques Pienaar2019-07-081-0/+2
| | | | | | This target was failing to build with newer version of libc++. PiperOrigin-RevId: 256979592
* LinalgOp::Model: add missing override specifiersAlex Zinenko2019-07-081-9/+11
| | | | | | | | | | All non-static functions in LinalgOp::Model override pure virtual functions from LinalgOp::Concept, but only some of them have the `override` specifier. This may lead one to erroneously believe the functions without the specified are not overrides or virtual functions. Add the specifier to all relevant functions. PiperOrigin-RevId: 256948453
* 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
* Migrate NativeCodeCall and AllAttrConstraintsOf tests to use TestDialectLei Zhang2019-07-055-83/+78
| | | | PiperOrigin-RevId: 256685260
* Migrate pattern attribute matching tests to use TestDialectLei Zhang2019-07-053-81/+91
| | | | | | | This CL also reorders op definitions and tests a bit to make them group more logically. PiperOrigin-RevId: 256682105
* Move StdForOp to ODS ForOpNicolas Vasilache2019-07-057-154/+89
| | | | PiperOrigin-RevId: 256657155
* Add a standard if opNicolas Vasilache2019-07-055-11/+194
| | | | | | | | | 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
* Simplify launch_func rewrite pattern in mlir-cuda-runnerAlex Zinenko2019-07-051-6/+2
| | | | | | | Use the bulk setOperands on the cloned operation, no need to cast or iterate over the operand list. PiperOrigin-RevId: 256643496
* ODS: provide a flag to skip generation of default build methodsAlex Zinenko2019-07-055-2/+34
| | | | | | | | | | | | | | | | | | | 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
* Add ODS accessors for named regions.Nicolas Vasilache2019-07-052-0/+17
| | | | PiperOrigin-RevId: 256639471
* Trivial typo in comment fix.Chris Lattner2019-07-041-1/+1
| | | | PiperOrigin-RevId: 256616187
* NFC: Remove Region::getContainingFunction as Functions are now Operations.River Riddle2019-07-049-34/+21
| | | | PiperOrigin-RevId: 256579717
* Fix another incorrect forward declaration of LogicalResultAlex Zinenko2019-07-041-1/+1
| | | | | | | LogicalResult is a struct and the Windows build is unhappy about it being forward-declared as class. PiperOrigin-RevId: 256578230
* Forward-declare LogicalResult as structAlex Zinenko2019-07-042-2/+2
| | | | | | | LogicalResult is a struct but some headers forward-declare it as a class, which breaks Windows builds. Forward-delcare as a struct instead. PiperOrigin-RevId: 256565699
* Make TranslateFromMLIRFunction type return LogicalResult instead of boolAlex Zinenko2019-07-045-13/+14
| | | | | | This interface was created before MLIR introduced LogicalResult. PiperOrigin-RevId: 256554557
* Add an mlir-cuda-runner tool.Stephan Herhut2019-07-0415-16/+428
| | | | | | | | 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-042-9/+79
| | | | | | | | | | | 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-0312-295/+263
| | | | | | Class Attribute parsing PiperOrigin-RevId: 256471248
* [TableGen] Support creating multi-result ops in result patternsLei Zhang2019-07-036-48/+240
| | | | | | | | | | This CL introduces a new syntax for creating multi-result ops and access their results in result patterns. Specifically, if a multi-result op is unbound or bound to a name without a trailing `__N` suffix, it will act as a value pack and expand to all its values. If a multi-result op is bound to a symbol with `__N` suffix, only the N-th result will be extracted and used. PiperOrigin-RevId: 256465208
* Replace the implementation of Function and Module with FuncOp and ModuleOp.River Riddle2019-07-0356-1482/+694
| | | | | | 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-0342-1581/+1588
| | | | | | | | | | | 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-039-125/+243
| | | | | | 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-035-1/+310
| | | | | | 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: Allow clearing the functions of a Module and splicing the functions ↵River Riddle2019-07-031-0/+5
| | | | | | from other modules. PiperOrigin-RevId: 256280543
* Add support for getting and setting the dialect attributes of an operation.River Riddle2019-07-032-0/+61
| | | | | | This allows for handling dialect attributes, those with names starting with a dialect prefix, to be handled explicitly. PiperOrigin-RevId: 256279728
* Add a 'getOps<>' method to Block to only iterate operations of a certain kind.River Riddle2019-07-031-0/+50
| | | | PiperOrigin-RevId: 256277436
* NFC: Move Standard to SPIR-V conversion to lib/ConversionLei Zhang2019-07-037-8/+8
| | | | PiperOrigin-RevId: 256271759
OpenPOWER on IntegriCloud