Skip to content
  1. Oct 27, 2020
    • River Riddle's avatar
      [mlir][Pattern] Add a new FrozenRewritePatternList class · 3fffffa8
      River Riddle authored
      This class represents a rewrite pattern list that has been frozen, and thus immutable. This replaces the uses of OwningRewritePatternList in pattern driver related API, such as dialect conversion. When PDL becomes more prevalent, this API will allow for optimizing a set of patterns once without the need to do this per run of a pass.
      
      Differential Revision: https://reviews.llvm.org/D89104
      3fffffa8
    • River Riddle's avatar
      [mlir][NFC] Move around the code related to PatternRewriting to improve layering · b6eb26fd
      River Riddle authored
      There are several pieces of pattern rewriting infra in IR/ that really shouldn't be there. This revision moves those pieces to a better location such that they are easier to evolve in the future(e.g. with PDL). More concretely this revision does the following:
      
      * Create a Transforms/GreedyPatternRewriteDriver.h and move the apply*andFold methods there.
      The definitions for these methods are already in Transforms/ so it doesn't make sense for the declarations to be in IR.
      
      * Create a new lib/Rewrite library and move PatternApplicator there.
      This new library will be focused on applying rewrites, and will also include compiling rewrites with PDL.
      
      Differential Revision: https://reviews.llvm.org/D89103
      b6eb26fd
    • River Riddle's avatar
      [mlir][Pattern] Refactor the Pattern class into a "metadata only" class · b99bd771
      River Riddle authored
      The Pattern class was originally intended to be used for solely matching operations, but that use never materialized. All of the pattern infrastructure uses RewritePattern, and the infrastructure for pure matching(Matchers.h) is implemented inline. This means that this class isn't a useful abstraction at the moment, so this revision refactors it to solely encapsulate the "metadata" of a pattern. The metadata includes the various state describing a pattern; benefit, root operation, etc. The API on PatternApplicator is updated to now operate on `Pattern`s as nothing special from `RewritePattern` is necessary.
      
      This refactoring is also necessary for the upcoming use of PDL patterns alongside C++ rewrite patterns.
      
      Differential Revision: https://reviews.llvm.org/D86258
      b99bd771
    • River Riddle's avatar
      [mlir] Add a conversion pass between PDL and the PDL Interpreter Dialect · 8a1ca2cd
      River Riddle authored
      The conversion between PDL and the interpreter is split into several different parts.
      ** The Matcher:
      
      The matching section of all incoming pdl.pattern operations is converted into a predicate tree and merged. Each pattern is first converted into an ordered list of predicates starting from the root operation. A predicate is composed of three distinct parts:
      * Position
        - A position refers to a specific location on the input DAG, i.e. an
          existing MLIR entity being matched. These can be attributes, operands,
          operations, results, and types. Each position also defines a relation to
          its parent. For example, the operand `[0] -> 1` has a parent operation
          position `[0]` (the root).
      * Question
        - A question refers to a query on a specific positional value. For
        example, an operation name question checks the name of an operation
        position.
      * Answer
        - An answer is the expected result of a question. For example, when
        matching an operation with the name "foo.op". The question would be an
        operation name question, with an expected answer of "foo.op".
      
      After the predicate lists have been created and ordered(based on occurrence of common predicates and other factors), they are formed into a tree of nodes that represent the branching flow of a pattern match. This structure allows for efficient construction and merging of the input patterns. There are currently only 4 simple nodes in the tree:
      * ExitNode: Represents the termination of a match
      * SuccessNode: Represents a successful match of a specific pattern
      * BoolNode/SwitchNode: Branch to a specific child node based on the expected answer to a predicate question.
      
      Once the matcher tree has been generated, this tree is walked to generate the corresponding interpreter operations.
      
       ** The Rewriter:
      The rewriter portion of a pattern is generated in a very straightforward manor, similarly to lowerings in other dialects. Each PDL operation that may exist within a rewrite has a mapping into the interpreter dialect. The code for the rewriter is generated within a FuncOp, that is invoked by the interpreter on a successful pattern match. Referenced values defined in the matcher become inputs the generated rewriter function.
      
      An example lowering is shown below:
      
      ```mlir
      // The following high level PDL pattern:
      pdl.pattern : benefit(1) {
        %resultType = pdl.type
        %inputOperand = pdl.input
        %root, %results = pdl.operation "foo.op"(%inputOperand) -> %resultType
        pdl.rewrite %root {
          pdl.replace %root with (%inputOperand)
        }
      }
      
      // is lowered to the following:
      module {
        // The matcher function takes the root operation as an input.
        func @matcher(%arg0: !pdl.operation) {
          pdl_interp.check_operation_name of %arg0 is "foo.op" -> ^bb2, ^bb1
        ^bb1:
          pdl_interp.return
        ^bb2:
          pdl_interp.check_operand_count of %arg0 is 1 -> ^bb3, ^bb1
        ^bb3:
          pdl_interp.check_result_count of %arg0 is 1 -> ^bb4, ^bb1
        ^bb4:
          %0 = pdl_interp.get_operand 0 of %arg0
          pdl_interp.is_not_null %0 : !pdl.value -> ^bb5, ^bb1
        ^bb5:
          %1 = pdl_interp.get_result 0 of %arg0
          pdl_interp.is_not_null %1 : !pdl.value -> ^bb6, ^bb1
        ^bb6:
          // This operation corresponds to a successful pattern match.
          pdl_interp.record_match @rewriters::@rewriter(%0, %arg0 : !pdl.value, !pdl.operation) : benefit(1), loc([%arg0]), root("foo.op") -> ^bb1
        }
        module @rewriters {
          // The inputs to the rewriter from the matcher are passed as arguments.
          func @rewriter(%arg0: !pdl.value, %arg1: !pdl.operation) {
            pdl_interp.replace %arg1 with(%arg0)
            pdl_interp.return
          }
        }
      }
      ```
      
      Differential Revision: https://reviews.llvm.org/D84580
      8a1ca2cd
    • Duncan P. N. Exon Smith's avatar
      SourceManager: Use the same fake SLocEntry whenever it fails to load · aab50af8
      Duncan P. N. Exon Smith authored
      Instead of putting a fake `SLocEntry` at `LoadedSLocEntryTable[Index]`
      when it fails to load in `SourceManager::loadSLocEntry`, allocate a fake
      one. Unless someone is sniffing the address of the returned `SLocEntry`
      (doubtful), this won't be a functionality change. Note that
      `SLocEntryLoaded[Index]` wasn't being set to `true` either before or
      after this change so no accessor is every going to look at
      `LoadedSLocEntryTable[Index]`.
      
      As a side effect, drop the `mutable` from `LoadedSLocEntryTable`.
      
      Differential Revision: https://reviews.llvm.org/D89748
      aab50af8
    • Gaurav Jain's avatar
      17cdba61
    • Zequan Wu's avatar
      [lldb][NativePDB] fix test load-pdb.cpp · 779deb97
      Zequan Wu authored
      779deb97
    • Nathan James's avatar
      [clang][NFC] Rearrange Comment Token and Lexer fields to reduce padding · b698ad00
      Nathan James authored
      Rearrange the fields to reduce the size of the classes
      
      Reviewed By: gribozavr2
      
      Differential Revision: https://reviews.llvm.org/D90127
      b698ad00
    • Richard Smith's avatar
      Fix checking for C++98 ICEs in C++11-and-later mode to not consider use · a5c7b468
      Richard Smith authored
      of a reference to be acceptable.
      a5c7b468
    • Amy Kwan's avatar
      [PowerPC] Implement Set Boolean Condition Instructions · 803cc3af
      Amy Kwan authored
      This patch implements the set boolean condition instructions introduced in
      POWER10.
      
      The set boolean condition instructions (set[n]bc[r]) are used during
      the following situations:
      - sign/zero/any extending i1 to an i32 or i64,
      - reg+reg, reg+imm or floating point comparisons being sign/zero extended to i32 or i64,
      - spilling CR bits (using the setnbc instruction)
      
      Differential Revision: https://reviews.llvm.org/D87705
      803cc3af
    • Vedant Kumar's avatar
      [profile] Suppress spurious 'expected profile to require unlock' warning · a77a739a
      Vedant Kumar authored
      In %c (continuous sync) mode, avoid attempting to unlock an
      already-unlocked profile.
      
      The profile is only locked when profile merging is enabled.
      a77a739a
    • Adrian Prantl's avatar
      [DebugInfo] Expose Fortran array debug info attributes through DIBuilder. · 5b3bf8b4
      Adrian Prantl authored
      The support of a few debug info attributes specifically for Fortran
      arrays have been added to LLVM recently, but there's no way to take
      advantage of them through DIBuilder. This patch extends
      DIBuilder::createArrayType to enable the settings of those attributes.
      
      Patch by Chih-Ping Chen!
      
      Differential Revision: https://reviews.llvm.org/D89817
      5b3bf8b4
    • MaheshRavishankar's avatar
      [mlir][Linalg] Miscalleneous enhancements to cover more fusion cases. · 78f37b74
      MaheshRavishankar authored
      Adds support for
      - Dropping unit dimension loops for indexed_generic ops.
      - Folding consecutive folding (or expanding) reshapes when the result
        (or src) is a scalar.
      - Fixes to indexed_generic -> generic fusion when zero-dim tensors are
        involved.
      
      Differential Revision: https://reviews.llvm.org/D90118
      78f37b74
    • Rahman Lavaee's avatar
      Explicitly check for entry basic block, rather than relying on MachineBasicBlock::pred_empty. · 0b2f4cdf
      Rahman Lavaee authored
      Sometimes in unoptimized code, we have dangling unreachable basic blocks with no predecessors. Basic block sections should be emitted for those as well. Without this patch, the included test fails with a fatal error in `AsmPrinter::emitBasicBlockEnd`.
      
      Reviewed By: tmsriram
      
      Differential Revision: https://reviews.llvm.org/D89423
      0b2f4cdf
    • Stanislav Mekhanoshin's avatar
      Fixed release build after D89170 · d176e13c
      Stanislav Mekhanoshin authored
      d176e13c
  2. Oct 26, 2020
Loading