Skip to content
  1. Nov 21, 2019
  2. Nov 20, 2019
    • Andy Davis's avatar
      Add VectorContractionOp to the VectorOps dialect. · d6a70b31
      Andy Davis authored
      PiperOrigin-RevId: 281605471
      d6a70b31
    • Mahesh Ravishankar's avatar
      Verify subview op result has dynamic shape, when sizes are specified. · 1145cebd
      Mahesh Ravishankar authored
      If the sizes are specified as arguments to the subview op, then the
      shape must be dynamic as well.
      
      PiperOrigin-RevId: 281591608
      1145cebd
    • Sean Silva's avatar
      Add multi-level DCE pass. · e4f83c6c
      Sean Silva authored
      This is a simple multi-level DCE pass that operates pretty generically on
      the IR. Its key feature compared to the existing peephole dead op folding
      that happens during canonicalization is being able to delete recursively
      dead cycles of the use-def graph, including block arguments.
      
      PiperOrigin-RevId: 281568202
      e4f83c6c
    • Mahesh Ravishankar's avatar
      Changes to SubViewOp to make it more amenable to canonicalization. · 19212105
      Mahesh Ravishankar authored
      The current SubViewOp specification allows for either all offsets,
      shape and stride to be dynamic or all of them to be static. There are
      opportunities for more fine-grained canonicalization based on which of
      these are static. For example, if the sizes are static, the result
      memref is of static shape. The specification of SubViewOp is modified
      to allow on or more of offsets, shapes and strides to be statically
      specified. The verification is updated to ensure that the result type
      of the subview op is consistent with which of these are static and
      which are dynamic.
      
      PiperOrigin-RevId: 281560457
      19212105
    • Nicolas Vasilache's avatar
      Implement unrolling of vector ops to finer-grained vector ops as a pattern. · fa14d4f6
      Nicolas Vasilache authored
      This CL uses the pattern rewrite infrastructure to implement a simple VectorOps -> VectorOps legalization strategy to unroll coarse-grained vector operations into finer grained ones.
      The transformation is written using local pattern rewrites to allow composition with other rewrites. It proceeds by iteratively introducing fake cast ops and cleaning canonicalizing or lowering them away where appropriate.
      
      This is an example of writing transformations as compositions of local pattern rewrites that should enable us to make them significantly more declarative.
      
      PiperOrigin-RevId: 281555100
      fa14d4f6
    • River Riddle's avatar
      Add a new OpAsmOpInterface to allow for ops to directly hook into the AsmPrinter. · eb418559
      River Riddle authored
      This interface provides more fine-grained hooks into the AsmPrinter than the dialect interface, allowing for operations to define the asm name to use for results directly on the operations themselves. The hook is also expanded to enable defining named result "groups". Get a special name to use when printing the results of this operation.
      The given callback is invoked with a specific result value that starts a
      result "pack", and the name to give this result pack. To signal that a
      result pack should use the default naming scheme, a None can be passed
      in instead of the name.
      
      For example, if you have an operation that has four results and you want
      to split these into three distinct groups you could do the following:
      
        setNameFn(getResult(0), "first_result");
        setNameFn(getResult(1), "middle_results");
        setNameFn(getResult(3), ""); // use the default numbering.
      
      This would print the operation as follows:
      
        %first_result, %middle_results:2, %0 = "my.op" ...
      
      PiperOrigin-RevId: 281546873
      eb418559
    • Nicolas Vasilache's avatar
      Add StridedMemRef<>::operator[] - NFC · 3c055957
      Nicolas Vasilache authored
      This operator is used for internal debugging purposes.
      
      PiperOrigin-RevId: 281544152
      3c055957
    • Alexander Belyaev's avatar
      Fix 'the the' typo. · e5026165
      Alexander Belyaev authored
      PiperOrigin-RevId: 281501234
      e5026165
    • Stephan Herhut's avatar
      Extend kernel outlining to also consider dim worth inlining. · abb62668
      Stephan Herhut authored
      PiperOrigin-RevId: 281483447
      abb62668
  3. Nov 19, 2019
    • Christian Sigg's avatar
      Make type and rank explicit in mcuMemHostRegister function. · f868adaf
      Christian Sigg authored
      Fix registered size of indirect MemRefType kernel arguments.
      
      PiperOrigin-RevId: 281362940
      f868adaf
    • Nicolas Vasilache's avatar
      Add VectorOps.StridedSliceOp · ee95f6f2
      Nicolas Vasilache authored
      The `vector.strided_slice` takes an n-D vector, k-D `offsets` integer array attribute, a
      k-D `sizes` integer array attribute, a k-D `strides` integer array attribute and extracts
      the n-D subvector at the proper offset.
      
      Returns an n-D vector where the first k-D dimensions match the `sizes` attribute.
      The returned subvector contains the elements starting at offset `offsets` and ending at
      `offsets + sizes`.
      
      Example:
      ```
        %1 = vector.strided_slice %0
            {offsets : [0, 2], sizes : [2, 4], strides : [1, 1]}:
          vector<4x8x16xf32> // returns a vector<2x4x16xf32>
      ```
      
      This op will be useful for progressive lowering within the VectorOp dialect.
      
      PiperOrigin-RevId: 281352749
      ee95f6f2
    • Nicolas Vasilache's avatar
      Fix pretty printer corner case in mlir_runner_utils.cpp. · 3732ba4d
      Nicolas Vasilache authored
      In the particular case where the size of a memref dimension is 1, double printing would happen because printLast was called unconditionally.
      This CL fixes the print and updates an incorrect test that should have caught this in the first place.
      
      PiperOrigin-RevId: 281345142
      3732ba4d
    • Diego Caballero's avatar
      Add getRemappedValue to ConversionPatternRewriter · dd5a7cb4
      Diego Caballero authored
      This method is needed for N->1 conversion patterns to retrieve remapped
      Values used in the original N operations.
      
      Closes tensorflow/mlir#237
      
      COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/237 from dcaballe:dcaballe/getRemappedValue 1f64fadcf2b203f7b336ff0c5838b116ae3625db
      PiperOrigin-RevId: 281321881
      dd5a7cb4
    • Alex Zinenko's avatar
      Change conversion CLI flag from -lower-to-llvm to -convert-std-to-llvm · 8961d8e3
      Alex Zinenko authored
      The command-line flag name `lower-to-llvm` for the pass performing dialect
      conversion from the Standard dialect to the LLVM dialect is misleading and
      inconsistent with most of the conversion passses. It leads the user to believe
      that there are no restrictions on what can be converted, while in fact only a
      subset of the Standard dialect can be converted (with operations from other
      dialects converted by separate passes). Use `convert-std-to-llvm` that better
      reflects what the pass does and is consistent with most other conversions.
      
      PiperOrigin-RevId: 281238797
      8961d8e3
    • Hanhan Wang's avatar
      Support SPIR-V constant op to take DenseElementsAttr as input. · c614c92f
      Hanhan Wang authored
      Iterates each element to build the array. This includes a little refactor to
      combine bool/int/float into a function, since they are similar. The only
      difference is calling different function in the end.
      
      PiperOrigin-RevId: 281210288
      c614c92f
    • Alexander Belyaev's avatar
      Lower linalg.indexed_generic to loops. · 8c6a5233
      Alexander Belyaev authored
      PiperOrigin-RevId: 281169885
      8c6a5233
    • Andy Davis's avatar
      Fix SubViewOp stride calculation in constant folding. · a6a28733
      Andy Davis authored
      Adds unit tests for subview offset and stride argument constant folding.
      
      PiperOrigin-RevId: 281161041
      a6a28733
  4. Nov 18, 2019
  5. Nov 15, 2019
    • Denis Khalikov's avatar
      [spirv] Add bit ops · 68e48ba1
      Denis Khalikov authored
      This CL added op definitions for a few bit operations:
      
      * OpBitFieldInsert
      * OpBitFieldSExtract
      * OpBitFieldUExtract
      
      Closes tensorflow/mlir#233
      
      COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/233 from denis0x0D:sandbox/bit_field_ops e7fd85b00d72d483d7992dc42b9cc4d673903455
      PiperOrigin-RevId: 280691816
      68e48ba1
    • Lei Zhang's avatar
      NFC: Convert CmpIPredicate in StandardOps to use EnumAttr · a0986bf4
      Lei Zhang authored
      This turns several hand-written functions to auto-generated ones.
      
      PiperOrigin-RevId: 280684326
      a0986bf4
    • Lei Zhang's avatar
      Use aggregate-parameter builder for ops having autogen type-deduction builder · 88843ae3
      Lei Zhang authored
      Thus far DRR always invokes the separate-parameter builder (i.e., requiring
      a separate parameter for each result-type/operand/attribute) for creating
      ops, no matter whether we can auto-generate a builder with type-deduction
      ability or not.
      
      This CL changes the path for ops that we can auto-generate type-deduction
      builders, i.e., with SameOperandsAndResultType/FirstAttrDerivedResultType
      traits. Now they are going through a aggregate-parameter builder (i.e.,
      requiring one parameter for all result-types/operands/attributes).
      attributes.)
      
      It is expected this approach will be more friendly for future shape inference
      function autogen and calling those autogen'd shape inference function without
      excessive packing and repacking operand/attribute lists.
      Also, it would enable better support for creating ops with optional attributes
      because we are not required to provide an Attribute() as placeholder for
      an optional attribute anymore.
      
      PiperOrigin-RevId: 280654800
      88843ae3
    • Stephan Herhut's avatar
      Mark std.view as no-sideeffect. · 57bafc67
      Stephan Herhut authored
      The same reasoning as for std.subview applies.
      
      PiperOrigin-RevId: 280639308
      57bafc67
    • Stephan Herhut's avatar
      Mark std.subview as no-sideeffect. · 9c7bceb4
      Stephan Herhut authored
      In essence, std.subview is just an abstract indexing transformation (somewhat
      akin to a gep in llvm) and by itself has no effect. From a practical perspective
      this helps, as it allows to remove dead subview operations.
      
      PiperOrigin-RevId: 280630046
      9c7bceb4
    • Nicolas Vasilache's avatar
      Refactor the LowerVectorTransfers pass to use the RewritePattern infra - NFC · 0b271b7d
      Nicolas Vasilache authored
      This is step 1/n in refactoring infrastructure along the Vector dialect to make it ready for retargetability and composable progressive lowering.
      
      PiperOrigin-RevId: 280529784
      0b271b7d
  6. Nov 14, 2019
    • Andy Davis's avatar
      Adds canonicalizer to SubViewOp which folds constants from base memref and... · a4669cd3
      Andy Davis authored
      Adds canonicalizer to SubViewOp which folds constants from base memref and operands into the subview result memref type.
      Changes SubViewOp to support zero operands case, when offset, strides and sizes are all constant.
      
      PiperOrigin-RevId: 280485075
      a4669cd3
    • Lei Zhang's avatar
      [ODS] Fix operation argument population to avoid crash · 796ca609
      Lei Zhang authored
      The `Operator` class keeps an `arguments` field, which contains pointers
      to `operands` and `attributes` elements. Thus it must be populated after
      `operands` and `attributes` are finalized so to have stable pointers.
      SmallVector may re-allocate when still having new elements added, which
      will invalidate pointers.
      
      PiperOrigin-RevId: 280466896
      796ca609
    • Alex Zinenko's avatar
      Use MemRefDescriptor in Vector-to-LLVM convresion · bf5916e7
      Alex Zinenko authored
      Following up on the consolidation of MemRef descriptor conversion, update
      Vector-to-LLVM conversion to use the helper class that abstracts away the
      implementation details of the MemRef descriptor. This also makes the types of
      the attributes in emitted llvm.insert/extractelement operations consistently
      i64 instead of a mix of index and i64.
      
      PiperOrigin-RevId: 280441451
      bf5916e7
    • Nicolas Vasilache's avatar
      Move VectorOps to Tablegen - (almost) NFC · f2b6ae99
      Nicolas Vasilache authored
      This CL moves VectorOps to Tablegen and cleans up the implementation.
      
      This is almost NFC but 2 changes occur:
        1. an interface change occurs in the padding value specification in vector_transfer_read:
           the value becomes non-optional. As a shortcut we currently use %f0 for all paddings.
           This should become an OpInterface for vectorization in the future.
        2. the return type of vector.type_cast is trivial and simplified to `memref<vector<...>>`
      
      Relevant roundtrip and invalid tests that used to sit in core are moved to the vector dialect.
      
      The op documentation is moved to the .td file.
      
      PiperOrigin-RevId: 280430869
      f2b6ae99
  7. Nov 13, 2019
    • Jacques Pienaar's avatar
      Do not emit aliases when printing local form · d1c99e10
      Jacques Pienaar authored
      Expand local scope printing to skip printing aliases as aliases are printed out at the top of a module and may not be part of the output generated by local scope print.
      
      PiperOrigin-RevId: 280278617
      d1c99e10
    • Nicolas Vasilache's avatar
      Deprecate linalg.subview in favor of std.subview · 0bd6390b
      Nicolas Vasilache authored
      This CL uses the now standard std.subview in linalg.
      Two shortcuts are currently taken to allow this port:
      1. the type resulting from a view is currently degraded to fully dynamic to pass the SubViewOp verifier.
      2. indexing into SubViewOp may access out of bounds since lowering to LLVM does not currently enforce it by construction.
      
      These will be fixed in subsequent commits after discussions.
      
      PiperOrigin-RevId: 280250129
      0bd6390b
    • Sean Silva's avatar
      Add FuncOp::eraseArgument · 486f2122
      Sean Silva authored
      This is a quite complex operation that users are likely to attempt to write
      themselves and get wrong (citation: users=me).
      
      Ideally, we could pull this into FunctionLike, but for now, the
      FunctionType rewriting makes it FuncOp specific. We would need some hook
      for rewriting the function type (which for LLVM's func op, would need to
      rewrite the underlying LLVM type).
      
      PiperOrigin-RevId: 280234164
      486f2122
    • River Riddle's avatar
      NFC: Refactor block signature conversion to not erase the original arguments. · d985c748
      River Riddle authored
      This refactors the implementation of block signature(type) conversion to not insert fake cast operations to perform the type conversion, but to instead create a new block containing the proper signature. This has the benefit of enabling the use of pre-computed analyses that rely on mapping values. It also leads to a much cleaner implementation overall. The major user facing change is that applySignatureConversion will now replace the entry block of the region, meaning that blocks generally shouldn't be cached over calls to applySignatureConversion.
      
      PiperOrigin-RevId: 280226936
      d985c748
    • River Riddle's avatar
      Rename the current parseSymbolName to parseOptionalSymbolName · 6df83699
      River Riddle authored
      The current implementation silently fails if the '@' identifier isn't present, making it similar to the 'optional' parse methods. This change renames the current implementation to 'Optional' and adds a new 'parseSymbolName' that emits an error.
      
      PiperOrigin-RevId: 280214610
      6df83699
    • Hanhan Wang's avatar
      Make VariableOp instructions be in the first block in the function. · 85d7fb33
      Hanhan Wang authored
      Since VariableOp is serialized during processBlock, we add two more fields,
      `functionHeader` and `functionBody`, to collect instructions for a function.
      After all the blocks have been processed, we append them to the `functions`.
      
      Also, fix a bug in processGlobalVariableOp. The global variables should be
      encoded into `typesGlobalValues`.
      
      PiperOrigin-RevId: 280105366
      85d7fb33
  8. Nov 12, 2019
Loading