summaryrefslogtreecommitdiffstats
path: root/mlir/lib/Dialect
Commit message (Collapse)AuthorAgeFilesLines
...
* Restructure and update Linalg ODS and documentation - NFCNicolas Vasilache2019-12-194-10/+10
| | | | | | | | This CL allows specifying an additional name for specifying the .td file that is used to generate the doc for a dialect. This is necessary for a dialect like Linalg which has different "types" of ops that are used in different contexts. This CL also restructures the Linalg documentation and renames LinalgLibraryOps -> LinalgStructuredOps but is otherwise NFC. PiperOrigin-RevId: 286450414
* [VectorOps] Add vector ReshapeOp to the VectorOps dialect.Andy Davis2019-12-191-0/+117
| | | | | | Adds vector ReshapeOp to the VectorOps dialect. An aggregate vector reshape operation, which aggregates multiple hardware vectors, can enable optimizations during decomposition (e.g. loading one input hardware vector and performing multiple rotate and scatter store operations to the vector output). PiperOrigin-RevId: 286440658
* LLVMFuncOp: implement addEntryBlockAlex Zinenko2019-12-191-1/+15
| | | | | | | | | This function has been declared as a part of the LLVMFuncOp interface but never implemented. Closes tensorflow/mlir#325. PiperOrigin-RevId: 286439619
* [VectorOps] minor cleanup: vector dialect "subscripts" are i32Aart Bik2019-12-191-3/+12
| | | | | | | | Introduces some centralized methods to move towards consistent use of i32 as vector subscripts. Note: sizes/strides/offsets attributes are still i64 PiperOrigin-RevId: 286434133
* [VectorOps] Add vector.print definition, with lowering supportAart Bik2019-12-181-0/+17
| | | | | | | | | | | | | | | | Examples: vector.print %f : f32 vector.print %x : vector<4xf32> vector.print %y : vector<3x4xf32> vector.print %z : vector<2x3x4xf32> LLVM lowering replaces these with fully unrolled calls into a small runtime support library that provides some basic printing operations (single value, opening closing bracket, comma, newline). PiperOrigin-RevId: 286230325
* Update code block designationsJacques Pienaar2019-12-181-1/+1
| | | | | | | | | | | | | '```mlir' is used to indicate the code block is MLIR code/should use MLIR syntax highlighting, while '{.mlir}' was a markdown extension that used a style file to color the background differently of the code block. The background color extension was a custom one that we can retire given we have syntax highlighting. Also change '```td' to '```tablegen' to match chroma syntax highlighting designation. PiperOrigin-RevId: 286222976
* NFC: Cleanup non-conforming usages of namespaces.River Riddle2019-12-184-43/+31
| | | | | | | * Fixes use of anonymous namespace for static methods. * Uses explicit qualifiers(mlir::) instead of wrapping the definition with the namespace. PiperOrigin-RevId: 286222654
* Introduce prefetch op: affine -> std -> llvm intrinsicUday Bondhugula2019-12-182-0/+186
| | | | | | | | | | | | | | | | | | | Introduce affine.prefetch: op to prefetch using a multi-dimensional subscript on a memref; similar to affine.load but has no effect on semantics, but only on performance. Provide lowering through std.prefetch, llvm.prefetch and map to llvm's prefetch instrinsic. All attributes reflected through the lowering - locality hint, rw, and instr/data cache. affine.prefetch %0[%i, %j + 5], false, 3, true : memref<400x400xi32> Signed-off-by: Uday Bondhugula <uday@polymagelabs.com> Closes tensorflow/mlir#225 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/225 from bondhugula:prefetch 4c3b4e93bc64d9a5719504e6d6e1657818a2ead0 PiperOrigin-RevId: 286212997
* NFC: Remove unnecessary 'llvm::' prefix from uses of llvm symbols declared ↵River Riddle2019-12-1820-71/+65
| | | | | | | | in `mlir` namespace. Aside from being cleaner, this also makes the codebase more consistent. PiperOrigin-RevId: 286206974
* Harden the requirements to memory attribution types in gpu.funcAlex Zinenko2019-12-181-0/+22
| | | | | | | | | | When memory attributions are present in `gpu.func`, require that they are of memref type and live in memoryspaces 3 and 5 for workgroup and private memory attributions, respectively. Adapt the conversion from the GPU dialect to the NVVM dialect to drop the private memory space from attributions as NVVM is able to model them as local `llvm.alloca`s in the default memory space. PiperOrigin-RevId: 286161763
* NFC: Use this-> to appease GCC bug related to template lambda.River Riddle2019-12-171-1/+2
| | | | | | | GCC is unable to properly implicitly capture 'this' in generic lambdas. This bug is not fixed until 7.1.0: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67274 PiperOrigin-RevId: 286083427
* NFC: Use TypeSwitch to simplify existing code.River Riddle2019-12-171-45/+25
| | | | PiperOrigin-RevId: 286066371
* Add pattern rewrite which splits a vector TransferWriteOp into slices ↵Andy Davis2019-12-172-30/+98
| | | | | | according to the unrolling/slicing scheme of its InsertSlicesOp operand. PiperOrigin-RevId: 286042578
* Add missing virtual inliner interface method in SPIR-V dialect.Mahesh Ravishankar2019-12-171-0/+11
| | | | | | | | | | | The inline interface uses two methods to check legality of inling: 1) Can a region be inlined into another. 2) Can an operation be inlined into another. Setting the former to true, allows the inliner to use the second for legality checks. Add this method to the SPIR-V dialect inlining interface. PiperOrigin-RevId: 286041734
* Add pattern rewrite to forward vector tuple elements to their users.Andy Davis2019-12-171-1/+34
| | | | | | User(TupleGetOp(ExtractSlicesOp(InsertSlicesOp(TupleOp(Producer))) -> User(Producer) PiperOrigin-RevId: 286020249
* Add pattern rewrite which splits a vector TransferReadOp into slices ↵Andy Davis2019-12-171-34/+44
| | | | | | according to the unrolling/slicing scheme of its ExtractSlicesOp user. PiperOrigin-RevId: 285975613
* Replace code with equivalent satisfiesLLVMModule() function call.Tres Popp2019-12-171-3/+1
| | | | | | This is a general code cleanup and should be a NFC. PiperOrigin-RevId: 285972718
* Update vector op unrolling transformation to generate ExtractSlicesOp and ↵Andy Davis2019-12-172-27/+92
| | | | | | InsertSlicesOp (instead of less structured chain of StridedSliceOps and InsertStridedSliceOps). PiperOrigin-RevId: 285968051
* Add atomic operations to SPIR-V dialect.Mahesh Ravishankar2019-12-162-1/+66
| | | | | | | Some changes to the dialect generation script to allow specification of different base class to derive from in ODS. PiperOrigin-RevId: 285859230
* Add edsc::ops for pointwise, conv and dilated_convNicolas Vasilache2019-12-161-17/+146
| | | | | | | | | This CL adds more Linalg EDSC ops and tests to support building pointwise operations along with conv and dilated_conv. This also fixes a bug in the existing linalg_matmul EDSC and beefs up the test. The current set of ops is already enough to build an interesting, albeit simple, model used internally. PiperOrigin-RevId: 285838012
* Add InsertSlicesOp to the VectorOps dialect.Andy Davis2019-12-161-0/+54
| | | | PiperOrigin-RevId: 285830394
* Plug gpu.func into the GPU lowering pipelinesAlex Zinenko2019-12-163-65/+41
| | | | | | | | | | | | | | This updates the lowering pipelines from the GPU dialect to lower-level dialects (NVVM, SPIRV) to use the recently introduced gpu.func operation instead of a standard function annotated with an attribute. In particular, the kernel outlining is updated to produce gpu.func instead of std.func and the individual conversions are updated to consume gpu.funcs and disallow standard funcs after legalization, if necessary. The attribute "gpu.kernel" is preserved in the generic syntax, but can also be used with the custom syntax on gpu.funcs. The special kind of function for GPU allows one to use additional features such as memory attribution. PiperOrigin-RevId: 285822272
* [Linalg] Expose subview promotion as a declarative patternJose Ignacio Gomez2019-12-162-7/+26
| | | | | | | | | | | | This PR targest issue tensorflow/mlir#295. It exposes the already existing subiew promotion pass as a declarative pattern Change-Id: If901ebef9fb53fcd0b12ecc536f6b174ce320b92 Closes tensorflow/mlir#315 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/315 from tetuante:issue295 8e5f268b6d85f31015c33505329dbd7a4db97ac5 PiperOrigin-RevId: 285801463
* [VectorOps] Add [insert/extract]element definition together with lowering to ↵Aart Bik2019-12-161-0/+74
| | | | | | | | | | | | | | LLVM Similar to insert/extract vector instructions but (1) work on 1-D vectors only (2) allow for a dynamic index %c3 = constant 3 : index %0 = vector.insertelement %arg0, %arg1[%c : index] : vector<4xf32> %1 = vector.extractelement %arg0[%c3 : index] : vector<4xf32> PiperOrigin-RevId: 285792205
* Adds ExtractSlicesOp to the VectorOps dialect.Andy Davis2019-12-161-6/+201
| | | | | | | ExtractSlicesOp extracts slices of its vector operand and with a specified tiling scheme. This operation centralizes the tiling scheme around a single op, which simplifies vector op unrolling and subsequent pattern rewrite transformations. PiperOrigin-RevId: 285761129
* Remove LLVM dependency on mlir::Module and instead check Traits.Tres Popp2019-12-161-3/+13
| | | | PiperOrigin-RevId: 285724678
* Apply a level of sugaring to the linalg.generic EDSC - NFCNicolas Vasilache2019-12-131-20/+75
| | | | | | Make the declarative C++ builder API simpler to use so we can start chaining these ops together. PiperOrigin-RevId: 285496266
* Refactor various canonicalization patterns as in-place folds.River Riddle2019-12-133-229/+169
| | | | | | This is more efficient, and allows for these to fire in more situations: e.g. createOrFold, DialectConversion, etc. PiperOrigin-RevId: 285476837
* Add a layer of EDSC for linalg.GenericOpNicolas Vasilache2019-12-134-2/+77
| | | | | | | | This will be evolved into a simple programming model for custom ops and custom layers in followup CLs. This CL also deletes the obsolete tablegen's reference-impl.td that was using EDSCs. PiperOrigin-RevId: 285459545
* Try to fold operations in DialectConversion when trying to legalize.River Riddle2019-12-133-1/+25
| | | | | | This change allows for DialectConversion to attempt folding as a mechanism to legalize illegal operations. This also expands folding support in OpBuilder::createOrFold to generate new constants when folding, and also enables it to work in the context of a PatternRewriter. PiperOrigin-RevId: 285448440
* NFC: Cleanup the various Op::print methods.River Riddle2019-12-129-279/+146
| | | | | | This cleans up the implementation of the various operation print methods. This is done via a combination of code cleanup, adding new streaming methods to the printer(e.g. operand ranges), etc. PiperOrigin-RevId: 285285181
* Retire !linalg.buffer type - NFCNicolas Vasilache2019-12-122-100/+2
| | | | | | This type is not used anymore now that Linalg view and subview have graduated to std and that alignment is supported on alloc. PiperOrigin-RevId: 285213424
* Automated rollback of commit f68ac464d818629e0fe10c23b44ac782d64a12d2Christian Sigg2019-12-121-2/+2
| | | | PiperOrigin-RevId: 285162061
* Switch from shfl.bfly to shfl.down.Christian Sigg2019-12-121-2/+2
| | | | | | | Both work for the current use case, but the latter allows implementing prefix sums and is a little easier to understand for partial warps. PiperOrigin-RevId: 285145287
* Expose a convenience function to add interface attributes to a function.Mahesh Ravishankar2019-12-111-6/+13
| | | | PiperOrigin-RevId: 285036647
* Continue refactoring StructuredOps utilitiesNicolas Vasilache2019-12-113-12/+39
| | | | | | | This CL adds more common information to StructuredOpsUtils.h The n_view attribute is retired in favor of args_in + args_out but the CL is otherwise NFC. PiperOrigin-RevId: 285000621
* [Linalg] Add tiling for IndexedGenericOp with a region.Alexander Belyaev2019-12-111-9/+115
| | | | PiperOrigin-RevId: 284949355
* Add VectorOp transform pattern which splits vector TransferReadOps to target ↵Andy Davis2019-12-102-6/+78
| | | | | | vector unroll size. PiperOrigin-RevId: 284880592
* Move gpu.launch_func to ODS. NFCAlex Zinenko2019-12-101-14/+14
| | | | | | | | | Move the definition of gpu.launch_func operation from hand-rolled C++ implementation to the ODS framework. Also move the documentation. This only performs the move and remains a non-functional change, a follow-up will clean up the custom functions that can be auto-generated using ODS. PiperOrigin-RevId: 284842252
* Refactor the various operand/result/type iterators to use ↵River Riddle2019-12-101-3/+3
| | | | | | | | | | | | | | indexed_accessor_range. This has several benefits: * The implementation is much cleaner and more efficient. * The ranges now have support for many useful operations: operator[], slice, drop_front, size, etc. * Value ranges can now directly query a range for their types via 'getTypes()': e.g: void foo(Operation::operand_range operands) { auto operandTypes = operands.getTypes(); } PiperOrigin-RevId: 284834912
* [Linalg] Add a Linalg iterator permutation transformationJose Ignacio Gomez2019-12-102-9/+38
| | | | | | | | | | | | | | | This patch closes issue tensorflow/mlir#272 We add a standalone iterator permutation transformation to Linalg. This transformation composes a permutation map with the maps in the "indexing_maps" attribute. It also permutes "iterator_types" accordingly. Change-Id: I7c1e693b8203aeecc595a7c012e738ca1100c857 Closes tensorflow/mlir#307 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/307 from tetuante:issue272 f7908d58792f4111119721885e247045104f1131 PiperOrigin-RevId: 284824102
* Uniformize Vector transforms as patterns on the model of Linalg - NFCNicolas Vasilache2019-12-102-24/+1
| | | | | | This reorganizes the vector transformations to be more easily testable as patterns and more easily composable into fused passes in the future. PiperOrigin-RevId: 284817474
* More convenience build methods for SPIR-V ops.Mahesh Ravishankar2019-12-102-61/+85
| | | | | | | | | | | | Add some convenience build methods to SPIR-V ops and update the lowering to use these methods where possible. For SPIRV::CompositeExtractOp move the method to deduce type of element based on base and indices into a convenience function. Some additional functionality needed to handle differences between parsing and verification methods. PiperOrigin-RevId: 284794404
* [VectorOps] Add a ShuffleOp to the VectorOps dialectAart Bik2019-12-091-0/+86
| | | | | | | | | | For example %0 = vector.shuffle %x, %y [3 : i32, 2 : i32, 1 : i32, 0 : i32] : vector<2xf32>, vector<2xf32> yields a vector<4xf32> result with a permutation of the elements of %x and %y PiperOrigin-RevId: 284657191
* [VectorOps] Fix off-by-one error in insert/extract validationAart Bik2019-12-091-2/+2
| | | | PiperOrigin-RevId: 284652653
* [spirv] Add CompositeConstruct operation.Denis Khalikov2019-12-091-0/+67
| | | | | | | Closes tensorflow/mlir#308 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/308 from denis0x0D:sandbox/composite_construct 9ef7180f77f9374bcd05afc4f9e6c1d2d72d02b7 PiperOrigin-RevId: 284613617
* [spirv] Add spv.IAdd, spv.ISub, and spv.IMul foldersLei Zhang2019-12-091-5/+36
| | | | | | | The patterns to be folded away can be commonly generated during lowering to SPIR-V. PiperOrigin-RevId: 284604855
* Factor out commonly reusable names across structured ops dialectsNicolas Vasilache2019-12-091-3/+5
| | | | | | This CL starts extracting commonalities between dialects that use the structured ops abstractions. Also fixes an OSS build issue where StringRef were incorrectly used with constexpr. PiperOrigin-RevId: 284591114
* Add lowering for module with gpu.kernel_module attribute.Mahesh Ravishankar2019-12-092-9/+42
| | | | | | | | | | | The existing GPU to SPIR-V lowering created a spv.module for every function with gpu.kernel attribute. A better approach is to lower the module that the function lives in (which has the attribute gpu.kernel_module) to a spv.module operation. This better captures the host-device separation modeled by GPU dialect and simplifies the lowering as well. PiperOrigin-RevId: 284574688
* Unify vector op unrolling transformation.Andy Davis2019-12-091-394/+175
| | | | | | | Unifies vector op unrolling transformation, by using the same unrolling implementation for contraction and elementwise operations. Removes fakefork/join operations which are non longer needed now that we have the InsertStridedSlice operation. PiperOrigin-RevId: 284570784
OpenPOWER on IntegriCloud