summaryrefslogtreecommitdiffstats
path: root/mlir
Commit message (Collapse)AuthorAgeFilesLines
...
* Apply operation rewrites before updating arguments.River Riddle2019-06-011-2/+2
| | | | | | -- PiperOrigin-RevId: 249678839
* Decouple running a conversion from the DialectConversion class. The ↵River Riddle2019-06-018-69/+89
| | | | | | | | DialectConversion class is only necessary for type signature changes(block arguments or function arguments). This isn't always desired when performing a dialect conversion. This allows for those conversions without this need to run per function instead of per module. -- PiperOrigin-RevId: 249657549
* Fix Linalg lowering to loopsNicolas Vasilache2019-06-015-48/+90
| | | | | | | | | | | | | | | | | | | | | This CL makes lowering to loops always be a: ``` %D = linalg.dim %view, constant : !linalg.view<...> affine.for %ix = %c0 to %D { ... } ``` This form composes correctly with tiling and is also the proper way to emit loops from views that across function boundaries. The previous version that would extract the range_min/max/step was composing incorrectly with tiling (i.e. would shift by range_min both in the loop bounds and in the slice) and would not work across function boundaries. The relevant tests are updated and a new test `dot_view`---which lowers to loops from views passed as function parameters---is added. When additional context is available, the linalg.dim operations should be folded away but this is left for a future CL. -- PiperOrigin-RevId: 249634712
* Automated rollback of changelist 247713812.Thomas Joerg2019-06-017-4/+232
| | | | PiperOrigin-RevId: 249605627
* Add LLVM::IntToPtrOp and LLVM::PtrToIntOp to LLVM dialect.Stephan Herhut2019-06-015-52/+40
| | | | | | -- PiperOrigin-RevId: 249604199
* Automated rollback of changelist 249538085.Rob Suderman2019-06-012-221/+0
| | | | PiperOrigin-RevId: 249550805
* Added the ability to run a mapping function across the values of an elementsRob Suderman2019-06-012-0/+221
| | | | | | | | | attr. This supports both the SplatElementsAttr and DenseElementsAttr for both float and integer inputs / outputs. -- PiperOrigin-RevId: 249538085
* Add thread-safe utilities to LLVMType to allow constructing llvm types ↵River Riddle2019-06-018-223/+343
| | | | | | | | in a multi-threaded environment. The LLVMContext is not thread-safe and directly constructing a raw llvm::Type can create situations where the LLVMContext is modified by multiple threads at the same time. -- PiperOrigin-RevId: 249526233
* Refactor FunctionAttr to hold the internal function reference by name ↵River Riddle2019-06-0132-454/+130
| | | | | | | | | | | | | | | | instead of pointer. The one downside to this is that the function reference held by a FunctionAttr needs to be explicitly looked up from the parent module. This provides several benefits though: * There is no longer a need to explicitly remap function attrs. - This removes a potentially expensive call from the destructor of Function. - This will enable some interprocedural transformations to now run intraprocedurally. - This wasn't scalable and forces dialect defined attributes to override a virtual function. * Replacing a function is now a trivial operation. * This is a necessary first step to representing functions as operations. -- PiperOrigin-RevId: 249510802
* Return nullptr on ↵Mehdi Amini2019-06-011-2/+0
| | | | | | | | | | | | Region::getContainingOperation()/getContainingFunction() instead of asserting This avoids crashing when trying to dump an operation nested in a region that isn't yet attached to an operation, which is quite useful when debugging. This alone won't be enough to print an unlink Operation, it'll display `<<UNLINKED INSTRUCTION>>`. -- PiperOrigin-RevId: 249496388
* Make EDSC builder test more robust to the order of evaluationAlex Zinenko2019-06-014-33/+37
| | | | | | | | | | | | | | EDSC builder test uses FileCheck to match the IR produced by EDSC in the textual order. For mathematical operations, EDSC relies on overloaded operators. Since they are essentially function calls, the order of evaluation of their operands is unspecified and differs between compilers. Do not rely on a specific order of operands and just check they are all emitted before the last operation. Give names to matched SSA values in order to make sure the right operands are used in relevant places. -- PiperOrigin-RevId: 249494995
* Refactor DialectConversion to operate on functions in-place *without* ↵River Riddle2019-06-013-162/+201
| | | | | | | | any cloning. This works by caching all of the requested pattern rewrite operations, e.g. replace operation, and only applying them on a completely successful conversion. -- PiperOrigin-RevId: 249490306
* Update Attribute::getDialect/Type::getDialect to return a non-const ↵River Riddle2019-06-017-17/+16
| | | | | | | | dialect reference. -- PiperOrigin-RevId: 249467245
* NFC: Fix the name of a comment header block in Diagnostics.cpp.River Riddle2019-06-011-1/+1
| | | | | | -- PiperOrigin-RevId: 249466645
* Add a new interleaveComma that allows specifying a unary function for ↵River Riddle2019-06-011-2/+7
| | | | | | | | the container elements. -- PiperOrigin-RevId: 249349269
* Make static shape tensor container match other container typesGeoffrey Martin-Noble2019-06-011-5/+5
| | | | | | | | Suffix with Of and take a list of types. Also give a better description that includes the element type information. -- PiperOrigin-RevId: 249341159
* Simplify container type definitionsGeoffrey Martin-Noble2019-06-011-14/+25
| | | | | | | | | | The passed element type description is usually unnecessary, and it's just as valid to want to pass a description for the entire container. In either case there's an alternative (Separate element type def or a TypeAlias) and we don't need to pollute the main API. To allow for this, I cleaned up the TF op definitions and added some additional utilities. -- PiperOrigin-RevId: 249340979
* Make the ParallelDiagnosticHandler used by the pass manager publicly ↵River Riddle2019-06-014-130/+203
| | | | | | | | available in Diagnostics.h. This provides a common utility for deterministically handling diagnostics in a multi-threaded environment. -- PiperOrigin-RevId: 249325937
* Fix a bug in toy LateLowering where a type conversion was using 'cast' ↵River Riddle2019-06-011-1/+1
| | | | | | | | instead of 'dyn_cast'. -- PiperOrigin-RevId: 249325111
* Clean up container type names in OpBaseGeoffrey Martin-Noble2019-06-015-55/+58
| | | | | | | | | | | Establish the following convention: 1. Container class types end in "Of" (e.g. TensorOf) and take a list of allowed types. 2. An X container where only a single type is allowed is called TypeX (e.g. I32Tensor). 3. An X container where any type is allowed is called AnyX (e.g. AnyTensor). -- PiperOrigin-RevId: 249281018
* CMake build: force-link SDBM lib into SDBM unit testsAlex Zinenko2019-06-011-0/+1
| | | | | | | | | Otherwise, GCC < 7 does not link in the dialect registration, fails to look up the dialect in the context and cannot construct SDBM objects. -- PiperOrigin-RevId: 249259758
* Move SDBM uniquer into the SDBM dialectAlex Zinenko2019-06-0110-120/+148
| | | | | | | | | | | | | | MLIRContext does not have to be aware of the SDBM unique data structures directly. Move the SDBM storage uniquer from MLIRContext to the SDBM dialect instance. Expressions that previously required a context to be constructed now require an instance of the dialect in order to access the uniquer. While they could look up the dialect in the context, it would have introduced a rather expensive lookup into each construction. Instead, the caller is expected to obtain the dialect instance and cache it. -- PiperOrigin-RevId: 249245199
* Move SDBM infrastructure into a new SDBM dialectAlex Zinenko2019-06-0117-13/+106
| | | | | | | | | | | We now have sufficient extensibility in dialects to move attribute components such as SDBM out of the core IR into a dedicated dialect and make them optional. Introduce an SDBM dialect and move the code. This is a mostly non-functional change. -- PiperOrigin-RevId: 249244802
* SDBMExpr: factor uniqu'ing out of MLIRContext.cppAlex Zinenko2019-06-015-136/+175
| | | | | | | | | | | | | SDBM expressions are designed as components of an attribute, similarly to affine expressions. As such, they need to be unique'd in the MLIRContext. When SDBM expressions were implemented, uniqu'ing objects in a context required to modify MLIRContext implementation. This is no longer the case as generic StorageUniquer has been introduced. Port the SDBMExpr uniqu'ing to use a newly introduced uniquer and remove SDBM construction from MLIRContext.cpp. -- PiperOrigin-RevId: 249244739
* Fix -Wsign-compare in OperationSupportTest.cppAlex Zinenko2019-06-011-5/+5
| | | | | | | | | A couple of warnings was produced when compiling this test due to comaprisons with a signed literal. Used unsigned literals instead. -- PiperOrigin-RevId: 249242970
* Linalg: avoid deriving from MultiOperandTraitBase multiple timesLei Zhang2019-06-011-2/+3
| | | | | | | | | | The Op Definition Generator will automatically insert the VariadicOperands trait if an op has variadic operands or results. It already derives from MultiOperandTraitBase. -- PiperOrigin-RevId: 249227268
* Small cleanup.Thomas Joerg2019-06-011-8/+8
| | | | | | | | | * Use `cast` rather than `dyn_cast` to get an assertion failure rather than a segfault in case of a type mismatch. * Use stream operators to `emitOpError`s. -- PiperOrigin-RevId: 249208135
* AffineExpr: factor uniqu'ing out of MLIRContext.cppAlex Zinenko2019-06-017-360/+346
| | | | | | | | | | | | | Affine expressions are designed as components of an attribute and are unique'd in the MLIRContext. When affine expressions were implemented, uniqu'ing objects in a context required to modify MLIRContext implementation. This is no longer the case as generic StorageUniquer has been introduced. Port the AffineExpr construction to use the new infrastructure by introducing an affineUniquer into the MLIRContext. -- PiperOrigin-RevId: 249207539
* Drop AffineExpr::NullAlex Zinenko2019-06-012-5/+3
| | | | | | | | | | | Similarly to other value-type wrappers, the default constructor of AffineExpr constructs a null object and removes the need for an explicit ::Null constructor. Drop it and remove the only user which can trivially rely on the default constructor. -- PiperOrigin-RevId: 249207502
* Change getParent() to be a const function. This is only necessary ↵Youlong Cheng2019-06-011-2/+6
| | | | | | | | 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: 249193257
* Upstream the Quantizer tool (part 4).Stella Laurenzo2019-06-0113-8/+685
| | | | | | | | | | | | This adds the basic passes needed and ties them into mlir-opt. Also adds two specific unit tests that exercise them. Next step is a standalone quantizer tool and additional cleanup. Tested: ninja check-mlir -- PiperOrigin-RevId: 249167690
* When changing the type of a Function, also update the type of the ↵River Riddle2019-06-014-0/+14
| | | | | | | | respective FunctionAttr. -- PiperOrigin-RevId: 249137558
* [LoopFusion] Don't count terminator op in compute cost.MLIR Team2019-06-012-196/+36
| | | | | | -- PiperOrigin-RevId: 249124895
* Use lambdas for nesting edsc constructs.Nicolas Vasilache2019-05-2018-163/+150
| | | | | | | | | | | Using ArrayRef introduces issues with the order of evaluation between a constructor and the arguments of the subsequent calls to the `operator()`. As a consequence the order of captures is not well-defined can go wrong with certain compilers (e.g. gcc-6.4). This CL fixes the issue by using lambdas in lieu of ArrayRef. -- PiperOrigin-RevId: 249114775
* Fix MacOS test: use %shlibext in lit command line to expand to .dylib on ↵Mehdi Amini2019-05-202-2/+3
| | | | | | | | MacOS and .so on Linux -- PiperOrigin-RevId: 249113478
* Define a string join tablegen utilityGeoffrey Martin-Noble2019-05-201-9/+10
| | | | | | -- PiperOrigin-RevId: 249083600
* Add CMakeLists.txt entry for Linalg/Transforms/LowerToLoopsNicolas Vasilache2019-05-201-0/+1
| | | | | | -- PiperOrigin-RevId: 249080647
* Fix automatic description for AnyTypeOfGeoffrey Martin-Noble2019-05-201-1/+1
| | | | | | | | Unfortunately, this now gives a segfault if you pass it an empty list, similar to stringify. Given how fiddly this is, we should probably have a string join helper. I'll fix both of these using better tablegen helpers in a follow-up. -- PiperOrigin-RevId: 249076849
* Rename "AnyOf" and "AllOf" combined predicates to "Or" and "And", ↵Geoffrey Martin-Noble2019-05-204-36/+36
| | | | | | | | | | respectively. This reduces conflict between these and other type names, where we're moving towards "Of" indicating a container type containing certain types. It also better matches the "Neg" predicate modifier and generally is pretty understandable/readable for predicates. -- PiperOrigin-RevId: 249076508
* Delete IntegerBase and FloatBase tablegen classesGeoffrey Martin-Noble2019-05-201-9/+5
| | | | | | | | These don't have any behavior and just delegate to Type. The only references are in OpBase.td Since the tablegen type hierarchy is not realized in the generated C++ these also aren't providing value for examining the type hierarchy -- PiperOrigin-RevId: 249073939
* [ODS] Allow dialect to specify C++ namespacesLei Zhang2019-05-2018-54/+255
| | | | | | | | | | | Previously we force the C++ namespaces to be `NS` if `SomeOp` is defined as `NS_SomeOp`. This is too rigid as it does not support nested namespaces well. This CL adds a "namespace" field into the Dialect class to allow flexible namespaces. -- PiperOrigin-RevId: 249064981
* Fix Linalg/llvm_ir testNicolas Vasilache2019-05-201-1/+1
| | | | | | -- PiperOrigin-RevId: 249057043
* Fix stride computation bug when lowering linalg.view to llvmNicolas Vasilache2019-05-204-5/+18
| | | | | | -- PiperOrigin-RevId: 249053115
* Add lowering of LinalgLibraryOps to linalg.load + linalg.store.Nicolas Vasilache2019-05-209-80/+339
| | | | | | | | | | This CL adds a pass to lower out of dot,matvec,matmul etc and into a combination of affine.for, linalg.load and linalg.store operations. Such operations can then later lowered to LLVM. This CL essentially performs op expansion using EDSCs and factors out a few common utils from Tiling.cpp. -- PiperOrigin-RevId: 249049518
* Use FileCheck to test SDBMAlex Zinenko2019-05-204-128/+172
| | | | | | | | | | | | | SDBM has an output format representing the unterlying matrix and stripe expressions. Move the SDBM tests from unit testing framework to FileCheck-based tests, printing them to the standard output and using FileCheck to test the output. Tests that check the API proper (e.g. that SDBM expressions have a specific subtype) and that rely on non-syntatic properties (equality of the set of constraints) are not ported. -- PiperOrigin-RevId: 249006055
* ExecutionEngine: drop PassManager integrationAlex Zinenko2019-05-207-63/+41
| | | | | | | | | | | | | | | Originally, ExecutionEngine was created before MLIR had a proper pass management infrastructure or an LLVM IR dialect (using the LLVM target directly). It has been running a bunch of lowering passes to convert the input IR from Standard+Affine dialects to LLVM IR and, later, to the LLVM IR dialect. This is no longer necessary and is even undesirable for compilation flows that perform their own conversion to the LLVM IR dialect. Drop this integration and make ExecutionEngine accept only the LLVM IR dialect. Users of the ExecutionEngine can call the relevant passes themselves. -- PiperOrigin-RevId: 249004676
* Fix debug build: static constexpr data member must have a definition ↵Mehdi Amini2019-05-201-0/+2
| | | | | | | | (until C++17) -- PiperOrigin-RevId: 248990338
* Add support for streaming an OperationName into a Diagnostic.River Riddle2019-05-204-3/+14
| | | | | | -- PiperOrigin-RevId: 248987646
* NFC: Tidy up DialectConversion.cpp and rename DialectOpConversion to ↵River Riddle2019-05-2011-67/+81
| | | | | | | | DialectConversionPattern. -- PiperOrigin-RevId: 248980810
* Refactor the DialectConversion process to clone each function and then ↵River Riddle2019-05-203-128/+202
| | | | | | | | | | operate in-place, as opposed to incrementally constructing a new function. This is crucial to allowing the use of non type-conversion patterns(normal RewritePatterns) as part of the conversion process. The converter now works by inserting fake producer operations when replacing the results of an existing operation with values of a different, now legal, type. These fake operations are guaranteed to never escape the converter. -- PiperOrigin-RevId: 248969130
OpenPOWER on IntegriCloud