summaryrefslogtreecommitdiffstats
path: root/mlir
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix maskAndClamp in gpu.all_reduce.Christian Sigg2019-12-131-2/+5
| | | | | | The clamp value determines the returned predicate. Previously, the clamp value was fixed to 31 and the predicate was therefore always true. This is incorrect for partial warp reductions, but went unnoticed because the returned values happened to be zero (but it could be anything). PiperOrigin-RevId: 285343160
* NFC: Cleanup the various Op::print methods.River Riddle2019-12-1211-281/+175
| | | | | | 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
* Fix logic on when to emit collective type but separate arg builderJacques Pienaar2019-12-123-16/+8
| | | | | | Got the comment right but the code wrong :/ PiperOrigin-RevId: 285270561
* [VectorOps] Add lowering of vector.shuffle to LLVM IRAart Bik2019-12-122-220/+329
| | | | | | | | | | | | | | | | | | | | | | | | | | | For example, a shuffle %1 = vector.shuffle %arg0, %arg1 [0 : i32, 1 : i32] : vector<2xf32>, vector<2xf32> becomes a direct LLVM shuffle 0 = llvm.shufflevector %arg0, %arg1 [0 : i32, 1 : i32] : !llvm<"<2 x float>">, !llvm<"<2 x float>"> but %1 = vector.shuffle %a, %b[1 : i32, 0 : i32, 2: i32] : vector<1x4xf32>, vector<2x4xf32> becomes the more elaborate (note the index permutation that drives argument selection for the extract operations) %0 = llvm.mlir.undef : !llvm<"[3 x <4 x float>]"> %1 = llvm.extractvalue %arg1[0] : !llvm<"[2 x <4 x float>]"> %2 = llvm.insertvalue %1, %0[0] : !llvm<"[3 x <4 x float>]"> %3 = llvm.extractvalue %arg0[0] : !llvm<"[1 x <4 x float>]"> %4 = llvm.insertvalue %3, %2[1] : !llvm<"[3 x <4 x float>]"> %5 = llvm.extractvalue %arg1[1] : !llvm<"[2 x <4 x float>]"> %6 = llvm.insertvalue %5, %4[2] : !llvm<"[3 x <4 x float>]"> PiperOrigin-RevId: 285268164
* Add type inference variant for separate params builder generatedJacques Pienaar2019-12-123-98/+108
| | | | | | Add variant that does invoke infer type op interface where defined. Also add entry function that invokes that different separate argument builders for wrapped, unwrapped and inference variant. PiperOrigin-RevId: 285220709
* Retire !linalg.buffer type - NFCNicolas Vasilache2019-12-125-141/+7
| | | | | | 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
* [Linalg] Add test for fusion of GenericOp with IndexedGenericOp.Alexander Belyaev2019-12-121-1/+56
| | | | PiperOrigin-RevId: 285211797
* Added lowering of `std.tanh` to llvm function call to `tanh` and `tanhf`.Ehsan Toosi2019-12-122-1/+74
| | | | | | | Closes tensorflow/mlir#312 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/312 from dfki-ehna:tanh 9e89b072ff91ff390ad739501745114feb3ac856 PiperOrigin-RevId: 285205674
* Move cpu runner utils templates to .hNicolas Vasilache2019-12-123-159/+175
| | | | | | | | This allows reusing the implementation in various places by just including and permits more easily writing test functions without explicit template instantiations. This also modifies UnrankedMemRefType to take a template type parameter since it cannot be type agnostic atm. PiperOrigin-RevId: 285187711
* Automated rollback of commit f68ac464d818629e0fe10c23b44ac782d64a12d2Christian Sigg2019-12-128-34/+34
| | | | PiperOrigin-RevId: 285162061
* Switch from shfl.bfly to shfl.down.Christian Sigg2019-12-128-34/+34
| | | | | | | 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
* Make OpBuilder::insert virtual instead of OpBuilder::createOperation.River Riddle2019-12-116-57/+33
| | | | | | It is sometimes useful to create operations separately from the builder before insertion as it may be easier to erase them in isolation if necessary. One example use case for this is folding, as we will only want to insert newly generated constant operations on success. This has the added benefit of fixing some silent PatternRewriter failures related to cloning, as the OpBuilder 'clone' methods don't call createOperation. PiperOrigin-RevId: 285086242
* Add std.log* and llvm.intr.log* that correspond to the LLVMIR intrinsicsNicolas Vasilache2019-12-114-0/+91
| | | | PiperOrigin-RevId: 285073483
* Add missing CMake dependency for MLIRTestIR.Mahesh Ravishankar2019-12-111-0/+3
| | | | PiperOrigin-RevId: 285039153
* Fix OSS buildNicolas Vasilache2019-12-111-4/+4
| | | | PiperOrigin-RevId: 285036782
* Expose a convenience function to add interface attributes to a function.Mahesh Ravishankar2019-12-113-13/+26
| | | | PiperOrigin-RevId: 285036647
* [spirv] Add lowering for std.fdiv, std.frem, std.fsubDenis Khalikov2019-12-112-0/+31
| | | | | | | Closes tensorflow/mlir#313 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/313 from denis0x0D:sandbox/lowering_std_farith 41715070a74d13bfa9401957478978c1bb8006c0 PiperOrigin-RevId: 285023586
* Continue refactoring StructuredOps utilitiesNicolas Vasilache2019-12-1117-251/+369
| | | | | | | 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
* NFC: Fix naming inconsistency: FuncOpLowering -> GPUFuncOpLowering.Christian Sigg2019-12-111-7/+3
| | | | | | Remove nested anonymous namespace. PiperOrigin-RevId: 284987357
* Roll-forward initial liveness analysis including test cases.Alexander Belyaev2019-12-116-0/+774
| | | | | | Fix the usage of the map size when appending to the map with []. PiperOrigin-RevId: 284985916
* Automated rollback of commit 98fbf41044d3364dbaf18db81b9e8d9520d14761Alexander Belyaev2019-12-116-774/+0
| | | | PiperOrigin-RevId: 284979684
* Add a function to get lowering patterns from GPU to NVVM.Stephan Herhut2019-12-112-13/+22
| | | | | | This enables combining the patterns with other patterns into larger lowerings. PiperOrigin-RevId: 284979271
* [Linalg] Add tiling for IndexedGenericOp with a region.Alexander Belyaev2019-12-112-9/+217
| | | | PiperOrigin-RevId: 284949355
* Add initial liveness analysis including test cases.Marcel Koester2019-12-116-0/+774
| | | | | | Closes tensorflow/mlir#255 PiperOrigin-RevId: 284935454
* [VectorOps] Add lowering of vector.insert to LLVM IRAart Bik2019-12-102-24/+153
| | | | | | | | | | | | | | | | | | | | | | | | | For example, an insert %0 = vector.insert %arg0, %arg1[3 : i32] : f32 into vector<4xf32> becomes %0 = llvm.mlir.constant(3 : i32) : !llvm.i32 %1 = llvm.insertelement %arg0, %arg1[%0 : !llvm.i32] : !llvm<"<4 x float>"> A more elaborate example, inserting an element in a higher dimension vector %0 = vector.insert %arg0, %arg1[3 : i32, 7 : i32, 15 : i32] : f32 into vector<4x8x16xf32> becomes %0 = llvm.extractvalue %arg1[3 : i32, 7 : i32] : !llvm<"[4 x [8 x <16 x float>]]"> %1 = llvm.mlir.constant(15 : i32) : !llvm.i32 %2 = llvm.insertelement %arg0, %0[%1 : !llvm.i32] : !llvm<"<16 x float>"> %3 = llvm.insertvalue %2, %arg1[3 : i32, 7 : i32] : !llvm<"[4 x [8 x <16 x float>]]"> PiperOrigin-RevId: 284882443
* Add VectorOp transform pattern which splits vector TransferReadOps to target ↵Andy Davis2019-12-106-7/+149
| | | | | | vector unroll size. PiperOrigin-RevId: 284880592
* More affine expr simplifications for floordiv and modUday Bondhugula2019-12-105-14/+48
| | | | | | | | | | | | | | | | | | | | | | Add one more simplification for floordiv and mod affine expressions. Examples: (2*d0 + 1) floordiv 2 is simplified to d0 (8*d0 + 4*d1 + d2) floordiv 4 simplified to 4*d0 + d1 + d2 floordiv 4. etc. Similarly, (4*d1 + 1) mod 2 is simplified to 1, (2*d0 + 8*d1) mod 8 simplified to 2*d0 mod 8. Change getLargestKnownDivisor to return int64_t to be consistent and to avoid casting at call sites (since the return value is used in expressions of int64_t/index type). Signed-off-by: Uday Bondhugula <uday@polymagelabs.com> Closes tensorflow/mlir#202 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/202 from bondhugula:affine b13fcb2f1c00a39ca5434613a02408e085a80e77 PiperOrigin-RevId: 284866710
* Move gpu.launch_func to ODS. NFCAlex Zinenko2019-12-105-130/+158
| | | | | | | | | 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
* Fold TestLinalgTilePermutePatterns into TestLinalgTransformPatterns - NFCNicolas Vasilache2019-12-107-200/+95
| | | | | | Centralize all patterns that test Linalg transforms in a single pass. PiperOrigin-RevId: 284835938
* Refactor the various operand/result/type iterators to use ↵River Riddle2019-12-1010-263/+279
| | | | | | | | | | | | | | 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-107-14/+138
| | | | | | | | | | | | | | | 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-1010-49/+71
| | | | | | 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
* Add Py API for composing an affine expression with a map. Also allows ↵MLIR Team2019-12-102-0/+30
| | | | | | extracting constant values for const expressions. PiperOrigin-RevId: 284809623
* More convenience build methods for SPIR-V ops.Mahesh Ravishankar2019-12-104-62/+93
| | | | | | | | | | | | 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
* Add a doc on guidelines for contributing a new dialect to the MLIR core repoMehdi Amini2019-12-101-0/+54
| | | | | | Closes tensorflow/mlir#263 PiperOrigin-RevId: 284760931
* Drop Markdown style annotationsAlex Zinenko2019-12-1029-390/+388
| | | | | | | These come from a non-standard extenion that is not available on Github, so it only clutters the documentation source with {.mlir} or {.ebnf} tags. PiperOrigin-RevId: 284733003
* Fix build breakage on gcc-5Jacques Pienaar2019-12-091-4/+4
| | | | | | Avoid `error: could not convert ?(const char*)"reduction"? from ?const char*? to ?llvm::StringLiteral?`. Tested with gcc-5.5. PiperOrigin-RevId: 284677810
* [VectorOps] Add a ShuffleOp to the VectorOps dialectAart Bik2019-12-095-19/+211
| | | | | | | | | | 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-092-2/+16
| | | | PiperOrigin-RevId: 284652653
* Refactor the Block support classes.River Riddle2019-12-093-157/+177
| | | | | | Each of the support classes for Block are now moved into a new header BlockSupport.h. The successor iterator class is also reimplemented as an indexed_accessor_range. This makes the class more efficient, and expands on its available functionality. PiperOrigin-RevId: 284646792
* Add new indexed_accessor_range_base and indexed_accessor_range classes that ↵River Riddle2019-12-098-141/+206
| | | | | | | | simplify defining index-able ranges. Many ranges want similar functionality from a range type(e.g. slice/drop_front/operator[]/etc.), so these classes provide a generic implementation that may be used by many different types of ranges. This removes some code duplication, and also empowers many of the existing range types in MLIR(e.g. result type ranges, operand ranges, ElementsAttr ranges, etc.). This change only updates RegionRange and ValueRange, more ranges will be updated in followup commits. PiperOrigin-RevId: 284615679
* Fix minor spelling tweaks.shanshanpt2019-12-096-6/+6
| | | | | | | Closes tensorflow/mlir#306 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/306 from shanshanpt:master 11430c2131281d84a432f45e854e29917b336e8d PiperOrigin-RevId: 284613648
* [spirv] Add CompositeConstruct operation.Denis Khalikov2019-12-095-15/+193
| | | | | | | 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-093-5/+193
| | | | | | | 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-093-15/+61
| | | | | | 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
* ODS: Generate named accessors for raw attributesJacques Pienaar2019-12-094-42/+65
| | | | | | | | | | | | | | Currently named accessors are generated for attributes returning a consumer friendly type. But sometimes the attributes are used while transforming an existing op and then the returned type has to be converted back into an attribute or the raw `getAttr` needs to be used. Generate raw named accessor for attributes to reference the raw attributes without having to use the string interface for better compile time verification. This allows calling `blahAttr()` instead of `getAttr("blah")`. Raw here refers to returning the underlying storage attribute. PiperOrigin-RevId: 284583426
* Add lowering for module with gpu.kernel_module attribute.Mahesh Ravishankar2019-12-096-43/+148
| | | | | | | | | | | 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-093-423/+227
| | | | | | | 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
* Minor spelling tweaksKazuaki Ishizaki2019-12-0940-49/+49
| | | | | | Closes tensorflow/mlir#304 PiperOrigin-RevId: 284568358
* [StructuredOps][Linalg] Add a primitive pattern to rewrite the ↵Nicolas Vasilache2019-12-099-6/+168
| | | | | | | | | | | linalg.generic form of matmul to vector form. This CL uses the newly expanded matcher support to easily detect when a linalg.generic has a multiply-accumulate body. A linalg.generic with such a body is rewritten as a vector contraction. This CL additionally limits the rewrite to the case of matrix multiplication on contiguous and statically shaped memrefs for now. Before expanding further, we should harden the infrastructure for expressing custom ops with the structured ops abstraction. PiperOrigin-RevId: 284566659
OpenPOWER on IntegriCloud