summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
| * 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
| * Add RegionRange for when need to abstract over different region iterationJacques Pienaar2019-12-096-12/+80
| | | | | | | | | | | | | | | | | | | | | | | | Follows ValueRange in representing a generic abstraction over the different ways to represent a range of Regions. This wrapper is not as ValueRange and only considers the current cases of interest: MutableArrayRef<Region> and ArrayRef<std::unique_ptr<Region>> as occurs during op construction vs op region querying. Note: ArrayRef<std::unique_ptr<Region>> allows for unset regions, so this range returns a pointer to a Region instead of a Region. PiperOrigin-RevId: 284563229
| * Post-submit cleanups in RecursiveMatchersNicolas Vasilache2019-12-093-30/+46
| | | | | | | | | | | | | | This CL addresses leftover cleanups and adds a test mixing RecursiveMatchers and m_Constant that captures properly. PiperOrigin-RevId: 284551567
| * Replace spurious SmallVector constructions with ValueRangeUday Bondhugula2019-12-096-14/+12
| | | | | | | | | | | | | | | | | | Signed-off-by: Uday Bondhugula <uday@polymagelabs.com> Closes tensorflow/mlir#305 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/305 from bondhugula:value_range 21d1fae73f549e3c8e72b60876eff1b864cea39c PiperOrigin-RevId: 284541027
| * Add a layer of recursive matchers that compose.Nicolas Vasilache2019-12-084-17/+279
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL adds support for building matchers recursively. The following matchers are provided: 1. `m_any()` can match any value 2. `m_val(Value *)` binds to a value and must match it 3. `RecursivePatternMatcher<OpType, Matchers...>` n-arity pattern that matches `OpType` and whose operands must be matched exactly by `Matchers...`. This allows building expression templates for patterns, declaratively, in a very natural fashion. For example pattern `p9` defined as follows: ``` auto mul_of_muladd = m_Op<MulFOp>(m_Op<MulFOp>(), m_Op<AddFOp>()); auto mul_of_anyadd = m_Op<MulFOp>(m_any(), m_Op<AddFOp>()); auto p9 = m_Op<MulFOp>(m_Op<MulFOp>( mul_of_muladd, m_Op<MulFOp>()), m_Op<MulFOp>(mul_of_anyadd, mul_of_anyadd)); ``` Successfully matches `%6` in: ``` %0 = addf %a, %b: f32 %1 = addf %a, %c: f32 // matched %2 = addf %c, %b: f32 %3 = mulf %a, %2: f32 // matched %4 = mulf %3, %1: f32 // matched %5 = mulf %4, %4: f32 // matched %6 = mulf %5, %5: f32 // matched ``` Note that 0-ary matchers can be used as leaves in place of n-ary matchers. This alleviates from passing explicit `m_any()` leaves. In the future, we may add extra patterns to specify that operands may be matched in any order. PiperOrigin-RevId: 284469446
| * NFC: Expose constFoldBinaryOp via a headerLei Zhang2019-12-082-48/+83
| | | | | | | | | | | | | | This allows other dialects to reuse the logic to support constant folding binary operations and reduces code duplication. PiperOrigin-RevId: 284428721
| * Update the builder API to take ValueRange instead of ArrayRef<Value *>River Riddle2019-12-0734-189/+204
| | | | | | | | | | | | This allows for users to provide operand_range and result_range in builder.create<> calls, instead of requiring an explicit copy into a separate data structure like SmallVector/std::vector. PiperOrigin-RevId: 284360710
| * Add a new ValueRange class.River Riddle2019-12-0614-62/+143
| | | | | | | | | | | | | | | | This class represents a generic abstraction over the different ways to represent a range of Values: ArrayRef<Value *>, operand_range, result_range. This class will allow for removing the many instances of explicit SmallVector<Value *, N> construction. It has the same memory cost as ArrayRef, and only suffers cost from indexing(if+elsing the different underlying representations). This change only updates a few of the existing usages, with more to be changed in followups; e.g. 'build' API. PiperOrigin-RevId: 284307996
| * Improve Linalg documentation following the Structured Ops presentation.Nicolas Vasilache2019-12-063-46/+130
| | | | | | | | PiperOrigin-RevId: 284291653
| * Add a flag to the IRPrinter instrumentation to only print after a pass if ↵River Riddle2019-12-065-17/+152
| | | | | | | | | | | | | | | | there is a change to the IR. This adds an additional filtering mode for printing after a pass that checks to see if the pass actually changed the IR before printing it. This "change" detection is implemented using a SHA1 hash of the current operation and its children. PiperOrigin-RevId: 284291089
| * NFC - update doc, comments, vim syntax fileUday Bondhugula2019-12-066-16/+35
| | | | | | | | | | | | | | | | | | | | | | - for the symbol rules, the code was updated but the doc wasn't. Signed-off-by: Uday Bondhugula <uday@polymagelabs.com> Closes tensorflow/mlir#284 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/284 from bondhugula:doc 9aad8b8a715559f7ce61265f3da3f8a3c11b45ea PiperOrigin-RevId: 284283712
| * Fix langref code snippet - NFCnmostafa2019-12-061-11/+19
| | | | | | | | | | | | Closes tensorflow/mlir#294 PiperOrigin-RevId: 284281172
| * NFC: Separate implementation and definition in ConvertStandardToSPIRV.cppMahesh Ravishankar2019-12-061-140/+188
| | | | | | | | PiperOrigin-RevId: 284274326
| * Change inferReturnTypes to return LogicalResult and valuesJacques Pienaar2019-12-065-27/+34
| | | | | | | | | | | | | | | | Previously the error case was using a sentinel in the error case which was bad. Also make the one `build` invoke the other `build` to reuse verification there. And follow up on suggestion to use formatv which I missed during previous review. PiperOrigin-RevId: 284265762
| * Replace custom getBody method with an ODS-generated in gpu::LaunchOpAlex Zinenko2019-12-064-31/+26
| | | | | | | | PiperOrigin-RevId: 284262981
| * During serialization do a walk of ops in module to find spv.module.Mahesh Ravishankar2019-12-061-4/+5
| | | | | | | | | | | | | | | | During lowering, spv.module might be within other modules (for example gpu kernel module). Walk the module op to find spirv module to serialize. PiperOrigin-RevId: 284262550
| * Move GPU::LaunchOp to ODS. NFC.Alex Zinenko2019-12-064-168/+175
| | | | | | | | | | | | | | | | Move the definition of the GPU launch opreation from hand-rolled C++ code to ODS framework. This only does the moves, a follow-up is necessary to clean up users of custom functions that could be auto-generated by ODS. PiperOrigin-RevId: 284261856
| * Use named traits in the ODS definition of LLVMFuncOpAlex Zinenko2019-12-061-3/+1
| | | | | | | | | | | | | | | | The "FunctionLike" and "IsIsolatedFromAbove" op traits are now defined as named records in base ODS file. Use those instead of NativeOpTrait referring to the C++ class name in the ODS definition of LLVMFuncOp. NFC. PiperOrigin-RevId: 284260891
| * [VecOps] Rename vector.[insert|extract]element to just vector.[insert|extract]Aart Bik2019-12-066-78/+72
| | | | | | | | | | | | | | Since these operations lower to [insert|extract][element|value] at LLVM dialect level, neither element nor value would correctly reflect the meaning. PiperOrigin-RevId: 284240727
| * LLVM::GlobalOp: take address space as builder argumentAlex Zinenko2019-12-063-9/+8
| | | | | | | | | | | | | | | | | | Accept the address space of the global as a builder argument when constructing an LLVM::GlobalOp instance. This decreases the reliance of LLVM::GlobalOp users on the internal name of the attribute used for this purpose. Update several uses of the address space in GPU to NVVM conversion. PiperOrigin-RevId: 284233254
OpenPOWER on IntegriCloud