Skip to content
  1. Jun 07, 2021
  2. Jun 04, 2021
  3. Jun 02, 2021
  4. May 25, 2021
  5. May 23, 2021
    • Chris Lattner's avatar
      [IR] Add a Location to BlockArgument · 81467f50
      Chris Lattner authored
      This adds the ability to specify a location when creating BlockArguments.
      Notably Value::getLoc() will return this correctly, which makes diagnostics
      more precise (e.g. the example in test-legalize-type-conversion.mlir).
      
      This is currently optional to avoid breaking any existing code - if
      absent, the BlockArgument defaults to using the location of its enclosing
      operation (preserving existing behavior).
      
      The bulk of this change is plumbing location tracking through the parser
      and printer to make sure it can round trip (in -mlir-print-debuginfo
      mode).  This is complete for generic operations, but requires manual
      adoption for custom ops.
      
      I added support for function-like ops to round trip their argument
      locations - they print correctly, but when parsing the locations are
      dropped on the floor.  I intend to fix this, but it will require more
      invasive plumbing through "function_like_impl" stuff so I think it
      best to split it out to its own patch.
      
      This is a reapply of the patch here: https://reviews.llvm.org/D102567
      with an additional change: we now never defer block argument locations,
      guaranteeing that we can round trip correctly.
      
      This isn't required in all cases, but allows us to hill climb here and
      works around unrelated bugs like https://bugs.llvm.org/show_bug.cgi?id=50451
      
      Differential Revision: https://reviews.llvm.org/D102991
      81467f50
  6. May 19, 2021
    • River Riddle's avatar
      [Reland] [mlir] Speed up Lexer::getEncodedSourceLocation · 3b432260
      River Riddle authored
      Reland Note: This was accidentally reverted in 80d981ed, but is an important improvement even outside of the driving motivator in D102567.
      
      We currently use SourceMgr::getLineAndColumn to get the line and column for an SMLoc, but this includes a call to StringRef::find_last_of that ends up dominating compile time. In D102567, we start creating locations from the input file for block arguments which resulted in an extreme performance regression for modules with very large amounts of block arguments. This revision switches to just using a pointer offset from the beginning of the line to calculate the column(all MLIR files are simple ascii), resulting in a compile time reduction from 4700 seconds (1 hour and 18 minutes) to 8 seconds.
      3b432260
    • Richard Smith's avatar
      Revert "[IR] Add a Location to BlockArgument." and follow-on commit · 80d981ed
      Richard Smith authored
      "[mlir] Speed up Lexer::getEncodedSourceLocation"
      
      This reverts commit 3043be9d and commit
      861d69a5.
      
      This change resulted in printing textual MLIR that can't be parsed; see
      review thread https://reviews.llvm.org/D102567 for details.
      80d981ed
    • River Riddle's avatar
      [mlir] Speed up Lexer::getEncodedSourceLocation · 861d69a5
      River Riddle authored
      We currently use SourceMgr::getLineAndColumn to get the line and column for an SMLoc, but this includes a call to StringRef::find_last_of that ends up dominating compile time. In D102567, we start creating locations from the input file for block arguments which resulted in an extreme performance regression for modules with very large amounts of block arguments. This revision switches to just using a pointer offset from the beginning of the line to calculate the column(all MLIR files are simple ascii), resulting in a compile time reduction from 4700 seconds (1 hour and 18 minutes) to 8 seconds.
      
      Differential Revision: https://reviews.llvm.org/D102734
      861d69a5
  7. May 18, 2021
    • Chris Lattner's avatar
      [IR] Add a Location to BlockArgument. · 3043be9d
      Chris Lattner authored
      This adds the ability to specify a location when creating BlockArguments.
      Notably Value::getLoc() will return this correctly, which makes diagnostics
      more precise (e.g. the example in test-legalize-type-conversion.mlir).
      
      This is currently optional to avoid breaking any existing code - if
      absent, the BlockArgument defaults to using the location of its enclosing
      operation (preserving existing behavior).
      
      The bulk of this change is plumbing location tracking through the parser
      and printer to make sure it can round trip (in -mlir-print-debuginfo
      mode).  This is complete for generic operations, but requires manual
      adoption for custom ops.
      
      I added support for function-like ops to round trip their argument
      locations - they print correctly, but when parsing the locations are
      dropped on the floor.  I intend to fix this, but it will require more
      invasive plumbing through "function_like_impl" stuff so I think it
      best to split it out to its own patch.
      
      Differential Revision: https://reviews.llvm.org/D102567
      3043be9d
  8. May 12, 2021
  9. May 11, 2021
    • Chris Lattner's avatar
      [OpAsmParser] Refactor parseOptionalInteger to support wide integers, NFC. · 2b09a89d
      Chris Lattner authored
      OpAsmParser (and DialectAsmParser) supports a pair of
      parseInteger/parseOptionalInteger methods, which allow parsing a bare
      integer into a C type of your choice (e.g. int8_t) using templates.  It
      was implemented in terms of a virtual method call that is hard coded to
      int64_t because "that should be big enough".
      
      Change the virtual method hook to return an APInt instead.  This allows
      asmparsers for custom ops to parse large integers if they want to, without
      changing any of the clients of the fixed size C API.
      
      Differential Revision: https://reviews.llvm.org/D102120
      2b09a89d
  10. May 08, 2021
    • River Riddle's avatar
      [mlir] Add hover support to mlir-lsp-server · 5c84195b
      River Riddle authored
      This provides information when the user hovers over a part of the source .mlir file. This revision adds the following hover behavior:
      * Operation:
        - Shows the generic form.
      * Operation Result:
        - Shows the parent operation name, result number(s), and type(s).
      * Block:
        - Shows the parent operation name, block number, predecessors, and successors.
      * Block Argument:
        - Shows the parent operation name, parent block, argument number, and type.
      
      Differential Revision: https://reviews.llvm.org/D101113
      5c84195b
  11. Apr 29, 2021
    • Alex Zinenko's avatar
      [mlir] support max/min lower/upper bounds in affine.parallel · 6841e6af
      Alex Zinenko authored
      This enables to express more complex parallel loops in the affine framework,
      for example, in cases of tiling by sizes not dividing loop trip counts perfectly
      or inner wavefront parallelism, among others. One can't use affine.max/min
      and supply values to the nested loop bounds since the results of such
      affine.max/min operations aren't valid symbols. Making them valid symbols
      isn't an option since they would introduce selection trees into memref
      subscript arithmetic as an unintended and undesired consequence. Also
      add support for converting such loops to SCF. Drop some API that isn't used in
      the core repo from AffineParallelOp since its semantics becomes ambiguous in
      presence of max/min bounds. Loop normalization is currently unavailable for
      such loops.
      
      Depends On D101171
      
      Reviewed By: bondhugula
      
      Differential Revision: https://reviews.llvm.org/D101172
      6841e6af
  12. Apr 27, 2021
  13. Apr 23, 2021
  14. Apr 21, 2021
  15. Apr 14, 2021
  16. Apr 12, 2021
    • Aart Bik's avatar
      [mlir] introduce "encoding" attribute to tensor type · 7714b405
      Aart Bik authored
      This CL introduces a generic attribute (called "encoding") on tensors.
      The attribute currently does not carry any concrete information, but the type
      system already correctly determines that tensor<8xi1,123> != tensor<8xi1,321>.
      The attribute will be given meaning through an interface in subsequent CLs.
      
      See ongoing discussion on discourse:
      
      [RFC] Introduce a sparse tensor type to core MLIR
      https://llvm.discourse.group/t/rfc-introduce-a-sparse-tensor-type-to-core-mlir/2944
      
      A sparse tensor will look something like this:
      
      ```
      // named alias with all properties we hold dear:
      #CSR = {
        // individual named attributes
      }
      
      // actual sparse tensor type:
      tensor<?x?xf64, #CSR>
      ```
      
      I see the following rough 5 step plan going forward:
      
      (1) introduce this format attribute in this CL, currently still empty
      (2) introduce attribute interface that gives it "meaning", focused on sparse in first phase
      (3) rewrite sparse compiler to use new type, remove linalg interface and "glue"
      (4) teach passes to deal with new attribute, by rejecting/asserting on non-empty attribute as simplest solution, or doing meaningful rewrite in the longer run
      (5) add FE support, document, test, publicize new features, extend "format" meaning to other domains if useful
      
      Reviewed By: stellaraccident, bondhugula
      
      Differential Revision: https://reviews.llvm.org/D99548
      7714b405
  17. Apr 08, 2021
    • Tobias Gysi's avatar
      [mlir] add support for index type in vectors. · b614ada0
      Tobias Gysi authored
      The patch enables the use of index type in vectors. It is a prerequisite to support vectorization for indexed Linalg operations. This refactoring became possible due to the newly introduced data layout infrastructure. The data layout of a module defines the bitwidth of the index type needed to verify bitcasts and similar vector operations.
      
      Reviewed By: nicolasvasilache
      
      Differential Revision: https://reviews.llvm.org/D99948
      b614ada0
  18. Apr 03, 2021
  19. Mar 25, 2021
    • Mehdi Amini's avatar
      Define a `NoTerminator` traits that allows operations with a single block... · 973ddb7d
      Mehdi Amini authored
      Define a `NoTerminator` traits that allows operations with a single block region to not provide a terminator
      
      In particular for Graph Regions, the terminator needs is just a
      historical artifact of the generalization of MLIR from CFG region.
      Operations like Module don't need a terminator, and before Module
      migrated to be an operation with region there wasn't any needed.
      
      To validate the feature, the ModuleOp is migrated to use this trait and
      the ModuleTerminator operation is deleted.
      
      This patch is likely to break clients, if you're in this case:
      
      - you may iterate on a ModuleOp with `getBody()->without_terminator()`,
        the solution is simple: just remove the ->without_terminator!
      - you created a builder with `Builder::atBlockTerminator(module_body)`,
        just use `Builder::atBlockEnd(module_body)` instead.
      - you were handling ModuleTerminator: it isn't needed anymore.
      - for generic code, a `Block::mayNotHaveTerminator()` may be used.
      
      Differential Revision: https://reviews.llvm.org/D98468
      973ddb7d
  20. Mar 23, 2021
  21. Mar 17, 2021
  22. Mar 12, 2021
  23. Mar 10, 2021
    • Vladislav Vinogradov's avatar
      [mlir] Model MemRef memory space as Attribute · f3bf5c05
      Vladislav Vinogradov authored
      Based on the following discussion:
      https://llvm.discourse.group/t/rfc-memref-memory-shape-as-attribute/2229
      
      The goal of the change is to make memory space property to have more
      expressive representation, rather then "magic" integer values.
      
      It will allow to have more clean ASM form:
      
      ```
      gpu.func @test(%arg0: memref<100xf32, "workgroup">)
      
      // instead of
      
      gpu.func @test(%arg0: memref<100xf32, 3>)
      ```
      
      Explanation for `Attribute` choice instead of plain `string`:
      
      * `Attribute` classes allow to use more type safe API based on RTTI.
      * `Attribute` classes provides faster comparison operator based on
        pointer comparison in contrast to generic string comparison.
      * `Attribute` allows to store more complex things, like structs or dictionaries.
        It will allows to have more complex memory space hierarchy.
      
      This commit preserve old integer-based API and implements it on top
      of the new one.
      
      Depends on D97476
      
      Reviewed By: rriddle, mehdi_amini
      
      Differential Revision: https://reviews.llvm.org/D96145
      f3bf5c05
  24. Mar 08, 2021
  25. Mar 04, 2021
    • River Riddle's avatar
      [mlir] Add a DialectAsmParser::getChecked method · 6bc767cd
      River Riddle authored
      This function simplifies calling the getChecked methods on Attributes and Types from within the parser, and removes any need to use `getEncodedSourceLocation` for these methods (by using an SMLoc instead). This is much more efficient than using an mlir::Location, as the encoding process to produce an mlir::Location is inefficient and undesirable for parsing (locations used during parsing should not persist afterwards unless otherwise necessary).
      
      Differential Revision: https://reviews.llvm.org/D97900
      6bc767cd
  26. Mar 03, 2021
  27. Feb 27, 2021
  28. Feb 23, 2021
    • River Riddle's avatar
      [mlir][IR] Refactor the `getChecked` and `verifyConstructionInvariants` methods on Attributes/Types · 06e25d56
      River Riddle authored
      `verifyConstructionInvariants` is intended to allow for verifying the invariants of an attribute/type on construction, and `getChecked` is intended to enable more graceful error handling aside from an assert. There are a few problems with the current implementation of these methods:
      * `verifyConstructionInvariants` requires an mlir::Location for emitting errors, which is prohibitively costly in the situations that would most likely use them, e.g. the parser.
      This creates an unfortunate code duplication between the verifier code and the parser code, given that the parser operates on llvm::SMLoc and it is an undesirable overhead to pre-emptively convert from that to an mlir::Location.
      * `getChecked` effectively requires duplicating the definition of the `get` method, creating a quite clunky workflow due to the subtle different in its signature.
      
      This revision aims to talk the above problems by refactoring the implementation to use a callback for error emission. Using a callback allows for deferring the costly part of error emission until it is actually necessary.
      
      Due to the necessary signature change in each instance of these methods, this revision also takes this opportunity to cleanup the definition of these methods by:
      * restructuring the signature of `getChecked` such that it can be generated from the same code block as the `get` method.
      * renaming `verifyConstructionInvariants` to `verify` to match the naming scheme of the rest of the compiler.
      
      Differential Revision: https://reviews.llvm.org/D97100
      06e25d56
  29. Feb 09, 2021
    • River Riddle's avatar
      [mlir][IR] Remove the concept of `OperationProperties` · fe7c0d90
      River Riddle authored
      These properties were useful for a few things before traits had a better integration story, but don't really carry their weight well these days. Most of these properties are already checked via traits in most of the code. It is better to align the system around traits, and improve the performance/cost of traits in general.
      
      Differential Revision: https://reviews.llvm.org/D96088
      fe7c0d90
  30. Feb 08, 2021
  31. Jan 15, 2021
  32. Jan 11, 2021
Loading