- Oct 27, 2020
-
-
River Riddle authored
This class represents a rewrite pattern list that has been frozen, and thus immutable. This replaces the uses of OwningRewritePatternList in pattern driver related API, such as dialect conversion. When PDL becomes more prevalent, this API will allow for optimizing a set of patterns once without the need to do this per run of a pass. Differential Revision: https://reviews.llvm.org/D89104
-
River Riddle authored
There are several pieces of pattern rewriting infra in IR/ that really shouldn't be there. This revision moves those pieces to a better location such that they are easier to evolve in the future(e.g. with PDL). More concretely this revision does the following: * Create a Transforms/GreedyPatternRewriteDriver.h and move the apply*andFold methods there. The definitions for these methods are already in Transforms/ so it doesn't make sense for the declarations to be in IR. * Create a new lib/Rewrite library and move PatternApplicator there. This new library will be focused on applying rewrites, and will also include compiling rewrites with PDL. Differential Revision: https://reviews.llvm.org/D89103
-
River Riddle authored
The Pattern class was originally intended to be used for solely matching operations, but that use never materialized. All of the pattern infrastructure uses RewritePattern, and the infrastructure for pure matching(Matchers.h) is implemented inline. This means that this class isn't a useful abstraction at the moment, so this revision refactors it to solely encapsulate the "metadata" of a pattern. The metadata includes the various state describing a pattern; benefit, root operation, etc. The API on PatternApplicator is updated to now operate on `Pattern`s as nothing special from `RewritePattern` is necessary. This refactoring is also necessary for the upcoming use of PDL patterns alongside C++ rewrite patterns. Differential Revision: https://reviews.llvm.org/D86258
-
River Riddle authored
The conversion between PDL and the interpreter is split into several different parts. ** The Matcher: The matching section of all incoming pdl.pattern operations is converted into a predicate tree and merged. Each pattern is first converted into an ordered list of predicates starting from the root operation. A predicate is composed of three distinct parts: * Position - A position refers to a specific location on the input DAG, i.e. an existing MLIR entity being matched. These can be attributes, operands, operations, results, and types. Each position also defines a relation to its parent. For example, the operand `[0] -> 1` has a parent operation position `[0]` (the root). * Question - A question refers to a query on a specific positional value. For example, an operation name question checks the name of an operation position. * Answer - An answer is the expected result of a question. For example, when matching an operation with the name "foo.op". The question would be an operation name question, with an expected answer of "foo.op". After the predicate lists have been created and ordered(based on occurrence of common predicates and other factors), they are formed into a tree of nodes that represent the branching flow of a pattern match. This structure allows for efficient construction and merging of the input patterns. There are currently only 4 simple nodes in the tree: * ExitNode: Represents the termination of a match * SuccessNode: Represents a successful match of a specific pattern * BoolNode/SwitchNode: Branch to a specific child node based on the expected answer to a predicate question. Once the matcher tree has been generated, this tree is walked to generate the corresponding interpreter operations. ** The Rewriter: The rewriter portion of a pattern is generated in a very straightforward manor, similarly to lowerings in other dialects. Each PDL operation that may exist within a rewrite has a mapping into the interpreter dialect. The code for the rewriter is generated within a FuncOp, that is invoked by the interpreter on a successful pattern match. Referenced values defined in the matcher become inputs the generated rewriter function. An example lowering is shown below: ```mlir // The following high level PDL pattern: pdl.pattern : benefit(1) { %resultType = pdl.type %inputOperand = pdl.input %root, %results = pdl.operation "foo.op"(%inputOperand) -> %resultType pdl.rewrite %root { pdl.replace %root with (%inputOperand) } } // is lowered to the following: module { // The matcher function takes the root operation as an input. func @matcher(%arg0: !pdl.operation) { pdl_interp.check_operation_name of %arg0 is "foo.op" -> ^bb2, ^bb1 ^bb1: pdl_interp.return ^bb2: pdl_interp.check_operand_count of %arg0 is 1 -> ^bb3, ^bb1 ^bb3: pdl_interp.check_result_count of %arg0 is 1 -> ^bb4, ^bb1 ^bb4: %0 = pdl_interp.get_operand 0 of %arg0 pdl_interp.is_not_null %0 : !pdl.value -> ^bb5, ^bb1 ^bb5: %1 = pdl_interp.get_result 0 of %arg0 pdl_interp.is_not_null %1 : !pdl.value -> ^bb6, ^bb1 ^bb6: // This operation corresponds to a successful pattern match. pdl_interp.record_match @rewriters::@rewriter(%0, %arg0 : !pdl.value, !pdl.operation) : benefit(1), loc([%arg0]), root("foo.op") -> ^bb1 } module @rewriters { // The inputs to the rewriter from the matcher are passed as arguments. func @rewriter(%arg0: !pdl.value, %arg1: !pdl.operation) { pdl_interp.replace %arg1 with(%arg0) pdl_interp.return } } } ``` Differential Revision: https://reviews.llvm.org/D84580
-
MaheshRavishankar authored
Adds support for - Dropping unit dimension loops for indexed_generic ops. - Folding consecutive folding (or expanding) reshapes when the result (or src) is a scalar. - Fixes to indexed_generic -> generic fusion when zero-dim tensors are involved. Differential Revision: https://reviews.llvm.org/D90118
-
- Oct 26, 2020
-
-
Stephen Neuendorffer authored
Differential Revision: https://reviews.llvm.org/D90197
-
Ulysse Beaugnon authored
Substitues `Type` by `Attribute` in the declaration of AttributeInterface. It looks like the code was written by copy-pasting the definition of TypeInterface, but the substitution of Type by Attribute was missing at some places. Reviewed By: rriddle, ftynse Differential Revision: https://reviews.llvm.org/D90138
-
Alex Zinenko authored
The alignment attribute in the 'alloca' op treats the '0' value as 'unset'. When parsing the custom form of the 'alloca' op, ignore the alignment attribute with if its value is '0' instead of actually creating it and producing a slightly different textually yet equivalent semantically form in the output. Reviewed By: rriddle Differential Revision: https://reviews.llvm.org/D90179
-
Lei Zhang authored
Reviewed By: aartbik Differential Revision: https://reviews.llvm.org/D90164
-
Alexander Belyaev authored
https://llvm.discourse.group/t/rfc-standard-memref-cast-ops/1454/15 Differential Revision: https://reviews.llvm.org/D90033
-
Thomas Raoux authored
Based on discourse discussion, fix the doc string and remove examples with wrong semantic. Also fix insert_map semantic by adding missing operand for vector we are inserting into. Differential Revision: https://reviews.llvm.org/D89563
-
Nicolas Vasilache authored
This revision allows the fusion of the producer of input tensors in the consumer under a tiling transformation (which produces subtensors). Many pieces are still missing (e.g. support init_tensors, better refactor LinalgStructuredOp interface support, try to merge implementations and reuse code) but this still allows getting started. The greedy pass itself is just for testing purposes and will be extracted in a separate test pass. Differential revision: https://reviews.llvm.org/D89491
-
George Mitenkov authored
This patch introduces a SPIR-V runner. The aim is to run a gpu kernel on a CPU via GPU -> SPIRV -> LLVM conversions. This is a first prototype, so more features will be added in due time. - Overview The runner follows similar flow as the other runners in-tree. However, having converted the kernel to SPIR-V, we encode the bind attributes of global variables that represent kernel arguments. Then SPIR-V module is converted to LLVM. On the host side, we emulate passing the data to device by creating in main module globals with the same symbolic name as in kernel module. These global variables are later linked with ones from the nested module. We copy data from kernel arguments to globals, call the kernel function from nested module and then copy the data back. - Current state At the moment, the runner is capable of running 2 modules, nested one in another. The kernel module must contain exactly one kernel function. Also, the runner supports rank 1 integer memref types as arguments (to be scaled). - Enhancement of JitRunner and ExecutionEngine To translate nested modules to LLVM IR, JitRunner and ExecutionEngine were altered to take an optional (default to `nullptr`) function reference that is a custom LLVM IR module builder. This allows to customize LLVM IR module creation from MLIR modules. Reviewed By: ftynse, mravishankar Differential Revision: https://reviews.llvm.org/D86108
-
George Mitenkov authored
This patch introduces a pass for running `mlir-spirv-cpu-runner` - LowerHostCodeToLLVMPass. This pass emulates `gpu.launch_func` call in LLVM dialect and lowers the host module code to LLVM. It removes the `gpu.module`, creates a sequence of global variables that are later linked to the varables in the kernel module, as well as a series of copies to/from them to emulate the memory transfer to/from the host or to/from the device sides. It also converts the remaining Standard dialect into LLVM dialect, emitting C wrappers. Reviewed By: mravishankar Differential Revision: https://reviews.llvm.org/D86112
-
- Oct 24, 2020
-
-
Mehdi Amini authored
This dependency was already existing indirectly, but is now more direct since the registration relies on a inline function. This fixes the link of the tools with BFD.
-
Mehdi Amini authored
This has been deprecated for >1month now and removal was announced in: https://llvm.discourse.group/t/rfc-revamp-dialect-registration/1559/11 Differential Revision: https://reviews.llvm.org/D86356
-
Mehdi Amini authored
Topologically sort the library to link to mlir-cpu-runner which is required with some linkers like BFD (NFC)
-
Mehdi Amini authored
-
- Oct 23, 2020
-
-
Mehdi Amini authored
This reverts commit b22e2e4c. Investigating broken builds
-
Kirsten Lee authored
Differential Revision: https://reviews.llvm.org/D89601
-
MaheshRavishankar authored
The current pattern for vector unrolling takes the native shape to unroll to at pattern instantiation time, but the native shape might defer based on the types of the operand. Introduce a UnrollVectorOptions struct which allows for using a function that will return the native shape based on the operation. Move other options of unrolling like `filterConstraints` into this struct. Differential Revision: https://reviews.llvm.org/D89744
-
Mehdi Amini authored
This has been deprecated for >1month now and removal was announced in: https://llvm.discourse.group/t/rfc-revamp-dialect-registration/1559/11 Differential Revision: https://reviews.llvm.org/D86356
-
Eugene Zhulenev authored
AsyncRuntime must be explicitly linked with LLVM pthreads Reviewed By: mehdi_amini Differential Revision: https://reviews.llvm.org/D89983
-
Thomas Raoux authored
Add folder for the case where ExtractStridedSliceOp source comes from a chain of InsertStridedSliceOp. Also add a folder for the trivial case where the ExtractStridedSliceOp is a no-op. Differential Revision: https://reviews.llvm.org/D89850
-
Thomas Raoux authored
Differential Revision: https://reviews.llvm.org/D89853
-
Sean Silva authored
I just found I needed this in an upcoming patch, and it seems generally useful to have. Differential Revision: https://reviews.llvm.org/D90000
-
Frederik Gossen authored
-
Frederik Gossen authored
Extract buffer alias analysis from buffer placement. Differential Revision: https://reviews.llvm.org/D89902
-
zhanghb97 authored
This patch provides C API for MLIR affine expression. - Implement C API for methods of AffineExpr class. - Implement C API for methods of derived classes (AffineBinaryOpExpr, AffineDimExpr, AffineSymbolExpr, and AffineConstantExpr). Differential Revision: https://reviews.llvm.org/D89856
-
Julian Gross authored
Added optimization pass to convert heap-based allocs to stack-based allocas in buffer placement. Added the corresponding test file. Differential Revision: https://reviews.llvm.org/D89688
-
Christian Sigg authored
[mlir] Fix exiting OpPatternRewriteDriver::simplifyLocally after first iteration that didn't change the op. Before this change, we would run `maxIterations` if the first iteration changed the op. After this change, we exit the loop as soon as an iteration hasn't changed the op. Assuming that we have reached a fixed point when an iteration doesn't change the op, this doesn't affect correctness. Reviewed By: rriddle Differential Revision: https://reviews.llvm.org/D89981
-
- Oct 22, 2020
-
-
Mehdi Amini authored
This reverts commit a8b0ae3b and commit f8fcff5a. The build with SHARED_LIBRARY=ON is broken.
-
Eugene Zhulenev authored
pthreads is not enabled for all builds by default Reviewed By: jpienaar Differential Revision: https://reviews.llvm.org/D89967
-
Christian Sigg authored
Reviewed By: herhut Differential Revision: https://reviews.llvm.org/D89929
-
Eugene Zhulenev authored
Lower from Async dialect to LLVM by converting async regions attached to `async.execute` operations into LLVM coroutines (https://llvm.org/docs/Coroutines.html): 1. Outline all async regions to functions 2. Add LLVM coro intrinsics to mark coroutine begin/end 3. Use MLIR conversion framework to convert all remaining async types and ops to LLVM + Async runtime function calls All `async.await` operations inside async regions converted to coroutine suspension points. Await operation outside of a coroutine converted to the blocking wait operations. Implement simple runtime to support concurrent execution of coroutines. Reviewed By: herhut Differential Revision: https://reviews.llvm.org/D89292
-
Alexander Belyaev authored
Reuse most code for printing/parsing/verification from SubViewOp. https://llvm.discourse.group/t/rfc-standard-memref-cast-ops/1454/15 Differential Revision: https://https://reviews.llvm.org/D89720
-
Alexander Belyaev authored
https://llvm.discourse.group/t/rfc-standard-memref-cast-ops/1454/15 Differential Revision: https://reviews.llvm.org/D89784
- Oct 21, 2020
-
-
rdzhabarov authored
[mlir] Simplify DDR matching patterns with equal operands for operators where it's applicable. Added documentation. This https://reviews.llvm.org/D89254 diff introduced implicit matching between same name operands. Differential Revision: https://reviews.llvm.org/D89598
-
Thomas Raoux authored
Forward missing attributes when creating the new transfer op otherwise the builder would use default values. Differential Revision: https://reviews.llvm.org/D89907
-