1. May 21, 2020
  2. May 20, 2020
    • Matt Arsenault's avatar
      AMDGPU/GlobalISel: Fix splitting 64-bit extensions · e8f6b0e5
      Matt Arsenault authored
      This was replicating the low bits into the high bits for G_ZEXT,
      rather than using 0.
      e8f6b0e5
    • Nicolas Vasilache's avatar
      [mlir][Vector] Add option to fully unroll for VectorTransfer to SCF lowering · 7c3c5b11
      Nicolas Vasilache authored
      Summary:
      Previously, the only support partial lowering from vector transfers to SCF was
      going through loops. This requires a dedicated allocation and extra memory
      roundtrips because LLVM aggregates cannot be indexed dynamically (for more
      details see the [deep-dive](https://mlir.llvm.org/docs/Dialects/Vector/#deeperdive)).
      
      This revision allows specifying full unrolling which removes this additional roundtrip.
      This should be used carefully though because full unrolling will spill, negating the
      benefits of removing the interim alloc in the first place.
      
      Proper heuristics are left for a later time.
      
      Differential Revision: https://reviews.llvm.org/D80100
      7c3c5b11
    • Alexey Bataev's avatar
    • Alex Zinenko's avatar
      [mlir] ensureRegionTerminator: take OpBuilder · 3ccf4a5b
      Alex Zinenko authored
      The SingleBlockImplicitTerminator op trait provides a function
      `ensureRegionTerminator` that injects an appropriate terminator into the block
      if necessary, which is used during operation constructing and parsing.
      Currently, this function directly modifies the IR using low-level APIs on
      Operation and Block. If this function is called from a conversion pattern,
      these manipulations are not reflected in the ConversionPatternRewriter and thus
      cannot be undone or, worse, lead to tricky memory errors and malformed IR.
      Change `ensureRegionTerminator` to take an instance of `OpBuilder` instead of
      `Builder`, and use it to construct the block and the terminator when required.
      Maintain overloads taking an instance of `Builder` and creating a simple
      `OpBuilder` to use in parsers, which don't have an `OpBuilder` and cannot
      interact with the dialect conversion mechanism. This change was one of the
      reasons to make `<OpTy>::build` accept an `OpBuilder`.
      
      Differential Revision: https://reviews.llvm.org/D80138
      3ccf4a5b
    • Alex Zinenko's avatar
      [mlir] SCFToStandard: support any ops in and around the control flow ops · a7d88a90
      Alex Zinenko authored
      Originally, the SCFToStandard conversion only declared Ops from the Standard
      dialect as legal after conversion. This is undesirable as it would fail the
      conversion if the SCF ops contained ops from any other dialect. Furthermore,
      this would be problematic for progressive lowering of `scf.parallel` to
      `scf.for` after `ensureRegionTerminator` is made aware of the pattern rewriting
      infrastructure because it creates temporary `scf.yield` operations declared
      illegal. Change the legalization target to declare any op other than `scf.for`,
      `scf.if` and `scf.parallel` legal.
      
      Differential Revision: https://reviews.llvm.org/D80137
      a7d88a90
    • Alex Zinenko's avatar
      [mlir] Erase or clear blocks through ConversionPatternRewriter when applicable · 57cbeaa8
      Alex Zinenko authored
      Multiple places in the code base were erasing Blocks or operations in them
      using in-place modifications (`Block::erase` or `Block::clear`) unknown to
      ConversionPatternRewriter. These operations could not be undone if the pattern
      failed and could lead to inconsistent in-memory state of the IR with dangling
      pointers. Use `ConversionPatternRewriter::eraseOp` and `::eraseBlock` instead.
      
      Differential Revision: https://reviews.llvm.org/D80136
      57cbeaa8
    • Alex Zinenko's avatar
      [mlir] DialectConversion: support erasing blocks · df48026b
      Alex Zinenko authored
      PatternRewriter has support for erasing a Block from its parent region, but
      this feature has not been implemented for ConversionPatternRewriter that needs
      to keep track of and be able to undo block actions. Introduce support for
      undoing block erasure in the ConversionPatternRewriter by marking all the ops
      it contains for erasure and by detaching the block from its parent region. The
      detached block is stored in the action description and is not actually deleted
      until the rewrites are applied.
      
      Differential Revision: https://reviews.llvm.org/D80135
      df48026b
    • Alex Zinenko's avatar
      [mlir] DialectConversion: avoid double-free when rolling back op creation · 5d5df06a
      Alex Zinenko authored
      Dialect conversion infrastructure may roll back op creation by erasing the
      operations in the reverse order of their creation. While this guarantees uses
      of values will be deleted before their definitions, this does not guarantee
      that a parent operation will not be deleted before its child. (This may happen
      in case of block inlining or if child operations, such as terminators, are
      created in the parent's `build` function before the parent itself.) Handle the
      parent/child relationship between ops by removing all child ops from the blocks
      before erasing the parent. The child ops remain live, detached from a block,
      and will be safely destroyed in their turn, which may come later than that of
      the parent.
      
      Differential Revision: https://reviews.llvm.org/D80134
      5d5df06a
    • Alex Zinenko's avatar
      [mlir] Toy tutorial: insert terminators at the end of the loop during rewrite · a655144f
      Alex Zinenko authored
      When creating temporary `scf.for` loops in `toy.print` lowering, the block
      insertion point was erronously set up to the beginning of the block rather than
      to its end, contradicting the comment just above the insertion point change.
      The code was nevertheless operational because `scf.for` was setting up its
      `scf.yield` terminator in an opaque to the pattern rewriting infrastructure
      way. Now that it is about to change, the problem would have been exposed and
      lead to conversion failures.
      
      Differential Revision: https://reviews.llvm.org/D80133
      a655144f
    • Nicolas Vasilache's avatar
      [mlir][Linalg] NFC - Simplify GenericNestLoop builder · 19e5b2bc
      Nicolas Vasilache authored
      Summary: This revision trims unnecessary complexity.
      
      Differential Revision: https://reviews.llvm.org/D80290
      19e5b2bc
    • Nicolas Vasilache's avatar
      [mlir][Linalg] Refactor linalg tiling · 004a3d4f
      Nicolas Vasilache authored
      Summary:
      This revision refactors the Linalg tiling pass to be written as pattern applications and retires the use of the folder in Linalg tiling.
      In the early days, tiling was written as a pass that would create (partially) folded and canonicalized operations on the fly for better composability.
      As this evolves towards composition of patterns, the pass-specific folder is counter-productive and is retired.
      The tiling options struct evolves to take a tile size creation function which allows materializing tile sizes on the fly (in particular constant tile sizes). This plays better with folding and DCE.
      
      With the folder going away in Tiling, the check on whether subviews are the same in linalg fusion needs to be more robust. This revision also implements such a check.
      
      In the current form, there are still some canonicalizations missing due to  AffineMin/Max ops fed by scf::ForOp. These will be improved at a later time.
      
      Differential Revision: https://reviews.llvm.org/D80267
      004a3d4f
    • Simon Pilgrim's avatar
      MachineMemOperand.h - replace Type.h with full GlobalValue.h include to fix... · f0daf240
      Simon Pilgrim authored
      MachineMemOperand.h - replace Type.h with full GlobalValue.h include to fix -Wundefined-inline warnings.
      f0daf240
    • Simon Pilgrim's avatar
    • Jay Foad's avatar
      [AMDGPU] Add the test from D49097. · 3c843538
      Jay Foad authored
      3c843538
    • Raphael Isemann's avatar
      [lldb][NFC] Minor NamespaceMap refactor · aa04ce76
      Raphael Isemann authored
      aa04ce76