Skip to content
  1. Sep 22, 2020
  2. Sep 18, 2020
    • Nicolas Vasilache's avatar
      [mlir][Linalg] Evolve named ops to use assembly form and support linalg on tensors. · 93fd30ba
      Nicolas Vasilache authored
      This revision allows representing a reduction at the level of linalg on tensors for named ops. When a structured op has a reduction and returns tensor(s), new conventions are added and documented.
      
      As an illustration, the syntax for a `linalg.matmul` writing into a buffer is:
      
      ```
        linalg.matmul ins(%a, %b : memref<?x?xf32>, tensor<?x?xf32>)
                     outs(%c : memref<?x?xf32>)
      ```
      
      , whereas the syntax for a `linalg.matmul` returning a new tensor is:
      
      ```
        %d = linalg.matmul ins(%a, %b : tensor<?x?xf32>, memref<?x?xf32>)
                          init(%c : memref<?x?xf32>)
                            -> tensor<?x?xf32>
      ```
      
      Other parts of linalg will be extended accordingly to allow mixed buffer/tensor semantics in the presence of reductions.
      93fd30ba
  3. Sep 17, 2020
    • Jakub Lichman's avatar
      [mlir][Linalg] Convolution tiling added to ConvOp vectorization pass · 347d59b1
      Jakub Lichman authored
      ConvOp vectorization supports now only convolutions of static shapes with dimensions
      of size either 3(vectorized) or 1(not) as underlying vectors have to be of static
      shape as well. In this commit we add support for convolutions of any size as well as
      dynamic shapes by leveraging existing matmul infrastructure for tiling of both input
      and kernel to sizes accepted by the previous version of ConvOp vectorization.
      In the future this pass can be extended to take "tiling mask" as a user input which
      will enable vectorization of user specified dimensions.
      
      Differential Revision: https://reviews.llvm.org/D87676
      347d59b1
  4. Sep 16, 2020
  5. Sep 14, 2020
  6. Sep 11, 2020
  7. Sep 10, 2020
  8. Sep 08, 2020
  9. Sep 07, 2020
  10. Sep 03, 2020
    • Jakub Lichman's avatar
      [mlir][Linalg] Wrong tile size for convolutions fixed · 8d35080e
      Jakub Lichman authored
      Sizes of tiles (subviews) are bigger by 1 than they should. Let's consider
      1D convolution without batches or channels. Furthermore let m iterate over
      the output and n over the kernel then input is accessed with m + n. In tiling
      subview sizes for convolutions are computed by applying requested tile size
      together with kernel size to the above mentioned expression thus let's say
      for tile size of 2 the subview size is 2 + size(n), which is bigger by one
      than it should since we move kernel only once. The problem behind it is that
      range is not turned into closed interval before the composition. This commit
      fixes the problem by turning ranges first into closed intervals by substracting
      1 and after the composition back to half open by adding 1.
      
      Differential Revision: https://reviews.llvm.org/D86638
      8d35080e
  11. Sep 02, 2020
    • Ehsan Toosi's avatar
      [mlir] Extend BufferAssignmentTypeConverter with result conversion callbacks · 39cf83cc
      Ehsan Toosi authored
      In this PR, the users of BufferPlacement can configure
      BufferAssginmentTypeConverter. These new configurations would give the user more
      freedom in the process of converting function signature, and return and call
      operation conversions.
      
      These are the new features:
          - Accepting callback functions for decomposing types (i.e. 1 to N type
          conversion such as unpacking tuple types).
          - Defining ResultConversionKind for specifying whether a function result
          with a certain type should be appended to the function arguments list or
          should be kept as function result. (Usage:
          converter.setResultConversionKind<MemRefType>(AppendToArgumentList))
          - Accepting callback functions for composing or decomposing values (i.e. N
          to 1 and 1 to N value conversion).
      
      Differential Revision: https://reviews.llvm.org/D85133
      39cf83cc
    • Lei Zhang's avatar
      Revert "[mlir] Extend BufferAssignmentTypeConverter with result conversion callbacks" · 1b88bbf5
      Lei Zhang authored
      This reverts commit 94f5d248 because
      of failing the following tests:
      
      MLIR :: Dialect/Linalg/tensors-to-buffers.mlir
      MLIR :: Transforms/buffer-placement-preparation-allowed-memref-results.mlir
      MLIR :: Transforms/buffer-placement-preparation.mlir
      1b88bbf5
    • Ehsan Toosi's avatar
      [mlir] Extend BufferAssignmentTypeConverter with result conversion callbacks · 94f5d248
      Ehsan Toosi authored
      In this PR, the users of BufferPlacement can configure
      BufferAssginmentTypeConverter. These new configurations would give the user more
      freedom in the process of converting function signature, and return and call
      operation conversions.
      
      These are the new features:
          - Accepting callback functions for decomposing types (i.e. 1 to N type
          conversion such as unpacking tuple types).
          - Defining ResultConversionKind for specifying whether a function result
          with a certain type should be appended to the function arguments list or
          should be kept as function result. (Usage:
          converter.setResultConversionKind<MemRefType>(AppendToArgumentList))
          - Accepting callback functions for composing or decomposing values (i.e. N
          to 1 and 1 to N value conversion).
      
      Differential Revision: https://reviews.llvm.org/D85133
      94f5d248
  12. Aug 28, 2020
    • Benjamin Kramer's avatar
      8782c727
    • Hanhan Wang's avatar
      [mlir][Linalg] Enhance Linalg fusion on generic op and tensor_reshape op. · eb4efa88
      Hanhan Wang authored
      The tensor_reshape op was only fusible only if it is a collapsing case. Now we
      propagate the op to all the operands so there is a further chance to fuse it
      with generic op. The pre-conditions are:
      
      1) The producer is not an indexed_generic op.
      2) All the shapes of the operands are the same.
      3) All the indexing maps are identity.
      4) All the loops are parallel loops.
      5) The producer has a single user.
      
      It is possible to fuse the ops if the producer is an indexed_generic op. We
      still can compute the original indices. E.g., if the reshape op collapses the d0
      and d1, we can use DimOp to get the width of d1, and calculate the index
      `d0 * width + d1`. Then replace all the uses with it. However, this pattern is
      not implemented in the patch.
      
      Reviewed By: mravishankar
      
      Differential Revision: https://reviews.llvm.org/D86314
      eb4efa88
  13. Aug 26, 2020
    • River Riddle's avatar
      [mlir][PDL] Add a PDL Interpreter Dialect · d289a97f
      River Riddle authored
      The PDL Interpreter dialect provides a lower level abstraction compared to the PDL dialect, and is targeted towards low level optimization and interpreter code generation. The dialect operations encapsulates low-level pattern match and rewrite "primitives", such as navigating the IR (Operation::getOperand), creating new operations (OpBuilder::create), etc. Many of the operations within this dialect also fuse branching control flow with some form of a predicate comparison operation. This type of fusion reduces the amount of work that an interpreter must do when executing.
      
      An example of this representation 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)
        }
      }
      
      // May be represented in the interpreter dialect as follows:
      module {
        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:
          pdl_interp.record_match @rewriters::@rewriter(%0, %arg0 : !pdl.value, !pdl.operation) : benefit(1), loc([%arg0]), root("foo.op") -> ^bb1
        }
        module @rewriters {
          func @rewriter(%arg0: !pdl.value, %arg1: !pdl.operation) {
            pdl_interp.replace %arg1 with(%arg0)
            pdl_interp.return
          }
        }
      }
      ```
      
      Differential Revision: https://reviews.llvm.org/D84579
      d289a97f
  14. Aug 19, 2020
    • Benjamin Kramer's avatar
      Make helpers static. NFC. · b98e25b6
      Benjamin Kramer authored
      b98e25b6
    • Mehdi Amini's avatar
      Separate the Registration from Loading dialects in the Context · f9dc2b70
      Mehdi Amini authored
      This changes the behavior of constructing MLIRContext to no longer load globally
      registered dialects on construction. Instead Dialects are only loaded explicitly
      on demand:
      - the Parser is lazily loading Dialects in the context as it encounters them
      during parsing. This is the only purpose for registering dialects and not load
      them in the context.
      - Passes are expected to declare the dialects they will create entity from
      (Operations, Attributes, or Types), and the PassManager is loading Dialects into
      the Context when starting a pipeline.
      
      This changes simplifies the configuration of the registration: a compiler only
      need to load the dialect for the IR it will emit, and the optimizer is
      self-contained and load the required Dialects. For example in the Toy tutorial,
      the compiler only needs to load the Toy dialect in the Context, all the others
      (linalg, affine, std, LLVM, ...) are automatically loaded depending on the
      optimization pipeline enabled.
      
      To adjust to this change, stop using the existing dialect registration: the
      global registry will be removed soon.
      
      1) For passes, you need to override the method:
      
      virtual void getDependentDialects(DialectRegistry &registry) const {}
      
      and registery on the provided registry any dialect that this pass can produce.
      Passes defined in TableGen can provide this list in the dependentDialects list
      field.
      
      2) For dialects, on construction you can register dependent dialects using the
      provided MLIRContext: `context.getOrLoadDialect<DialectName>()`
      This is useful if a dialect may canonicalize or have interfaces involving
      another dialect.
      
      3) For loading IR, dialect that can be in the input file must be explicitly
      registered with the context. `MlirOptMain()` is taking an explicit registry for
      this purpose. See how the standalone-opt.cpp example is setup:
      
        mlir::DialectRegistry registry;
        registry.insert<mlir::standalone::StandaloneDialect>();
        registry.insert<mlir::StandardOpsDialect>();
      
      Only operations from these two dialects can be in the input file. To include all
      of the dialects in MLIR Core, you can populate the registry this way:
      
        mlir::registerAllDialects(registry);
      
      4) For `mlir-translate` callback, as well as frontend, Dialects can be loaded in
      the context before emitting the IR: context.getOrLoadDialect<ToyDialect>()
      
      Differential Revision: https://reviews.llvm.org/D85622
      f9dc2b70
    • Mehdi Amini's avatar
      Revert "Separate the Registration from Loading dialects in the Context" · e75bc5c7
      Mehdi Amini authored
      This reverts commit d14cf457.
      The build is broken with GCC-5.
      e75bc5c7
    • Mehdi Amini's avatar
      Separate the Registration from Loading dialects in the Context · d14cf457
      Mehdi Amini authored
      This changes the behavior of constructing MLIRContext to no longer load globally
      registered dialects on construction. Instead Dialects are only loaded explicitly
      on demand:
      - the Parser is lazily loading Dialects in the context as it encounters them
      during parsing. This is the only purpose for registering dialects and not load
      them in the context.
      - Passes are expected to declare the dialects they will create entity from
      (Operations, Attributes, or Types), and the PassManager is loading Dialects into
      the Context when starting a pipeline.
      
      This changes simplifies the configuration of the registration: a compiler only
      need to load the dialect for the IR it will emit, and the optimizer is
      self-contained and load the required Dialects. For example in the Toy tutorial,
      the compiler only needs to load the Toy dialect in the Context, all the others
      (linalg, affine, std, LLVM, ...) are automatically loaded depending on the
      optimization pipeline enabled.
      
      To adjust to this change, stop using the existing dialect registration: the
      global registry will be removed soon.
      
      1) For passes, you need to override the method:
      
      virtual void getDependentDialects(DialectRegistry &registry) const {}
      
      and registery on the provided registry any dialect that this pass can produce.
      Passes defined in TableGen can provide this list in the dependentDialects list
      field.
      
      2) For dialects, on construction you can register dependent dialects using the
      provided MLIRContext: `context.getOrLoadDialect<DialectName>()`
      This is useful if a dialect may canonicalize or have interfaces involving
      another dialect.
      
      3) For loading IR, dialect that can be in the input file must be explicitly
      registered with the context. `MlirOptMain()` is taking an explicit registry for
      this purpose. See how the standalone-opt.cpp example is setup:
      
        mlir::DialectRegistry registry;
        registry.insert<mlir::standalone::StandaloneDialect>();
        registry.insert<mlir::StandardOpsDialect>();
      
      Only operations from these two dialects can be in the input file. To include all
      of the dialects in MLIR Core, you can populate the registry this way:
      
        mlir::registerAllDialects(registry);
      
      4) For `mlir-translate` callback, as well as frontend, Dialects can be loaded in
      the context before emitting the IR: context.getOrLoadDialect<ToyDialect>()
      
      Differential Revision: https://reviews.llvm.org/D85622
      d14cf457
    • Mehdi Amini's avatar
      Revert "Separate the Registration from Loading dialects in the Context" · d84fe55e
      Mehdi Amini authored
      This reverts commit e1de2b75.
      Broke a build bot.
      d84fe55e
  15. Aug 18, 2020
    • Mehdi Amini's avatar
      Separate the Registration from Loading dialects in the Context · e1de2b75
      Mehdi Amini authored
      This changes the behavior of constructing MLIRContext to no longer load globally
      registered dialects on construction. Instead Dialects are only loaded explicitly
      on demand:
      - the Parser is lazily loading Dialects in the context as it encounters them
      during parsing. This is the only purpose for registering dialects and not load
      them in the context.
      - Passes are expected to declare the dialects they will create entity from
      (Operations, Attributes, or Types), and the PassManager is loading Dialects into
      the Context when starting a pipeline.
      
      This changes simplifies the configuration of the registration: a compiler only
      need to load the dialect for the IR it will emit, and the optimizer is
      self-contained and load the required Dialects. For example in the Toy tutorial,
      the compiler only needs to load the Toy dialect in the Context, all the others
      (linalg, affine, std, LLVM, ...) are automatically loaded depending on the
      optimization pipeline enabled.
      
      To adjust to this change, stop using the existing dialect registration: the
      global registry will be removed soon.
      
      1) For passes, you need to override the method:
      
      virtual void getDependentDialects(DialectRegistry &registry) const {}
      
      and registery on the provided registry any dialect that this pass can produce.
      Passes defined in TableGen can provide this list in the dependentDialects list
      field.
      
      2) For dialects, on construction you can register dependent dialects using the
      provided MLIRContext: `context.getOrLoadDialect<DialectName>()`
      This is useful if a dialect may canonicalize or have interfaces involving
      another dialect.
      
      3) For loading IR, dialect that can be in the input file must be explicitly
      registered with the context. `MlirOptMain()` is taking an explicit registry for
      this purpose. See how the standalone-opt.cpp example is setup:
      
        mlir::DialectRegistry registry;
        mlir::registerDialect<mlir::standalone::StandaloneDialect>();
        mlir::registerDialect<mlir::StandardOpsDialect>();
      
      Only operations from these two dialects can be in the input file. To include all
      of the dialects in MLIR Core, you can populate the registry this way:
      
        mlir::registerAllDialects(registry);
      
      4) For `mlir-translate` callback, as well as frontend, Dialects can be loaded in
      the context before emitting the IR: context.getOrLoadDialect<ToyDialect>()
      e1de2b75
    • MaheshRavishankar's avatar
      [mlir][Linalg] Modify callback for getting id/nprocs in · 5ccac05d
      MaheshRavishankar authored
      LinalgDistribution options to allow more general distributions.
      
      Changing the signature of the callback to send in the ranges for all
      the parallel loops and expect a vector with the Value to use for the
      processor-id and number-of-processors for each of the parallel loops.
      
      Differential Revision: https://reviews.llvm.org/D86095
      5ccac05d
    • MaheshRavishankar's avatar
      [mlir][Linalg] Canonicalize tensor_reshape(splat-constant) -> splat-constant. · a65a5054
      MaheshRavishankar authored
      When the operand to the linalg.tensor_reshape op is a splat constant,
      the result can be replaced with a splat constant of the same value but
      different type.
      
      Differential Revision: https://reviews.llvm.org/D86117
      a65a5054
  16. Aug 15, 2020
    • Mehdi Amini's avatar
      Revert "Separate the Registration from Loading dialects in the Context" · 25ee8517
      Mehdi Amini authored
      This reverts commit 20563933.
      
      Build is broken on a few bots
      25ee8517
    • Mehdi Amini's avatar
      Separate the Registration from Loading dialects in the Context · 20563933
      Mehdi Amini authored
      This changes the behavior of constructing MLIRContext to no longer load globally registered dialects on construction. Instead Dialects are only loaded explicitly on demand:
      - the Parser is lazily loading Dialects in the context as it encounters them during parsing. This is the only purpose for registering dialects and not load them in the context.
      - Passes are expected to declare the dialects they will create entity from (Operations, Attributes, or Types), and the PassManager is loading Dialects into the Context when starting a pipeline.
      
      This changes simplifies the configuration of the registration: a compiler only need to load the dialect for the IR it will emit, and the optimizer is self-contained and load the required Dialects. For example in the Toy tutorial, the compiler only needs to load the Toy dialect in the Context, all the others (linalg, affine, std, LLVM, ...) are automatically loaded depending on the optimization pipeline enabled.
      
      Differential Revision: https://reviews.llvm.org/D85622
      20563933
    • Mehdi Amini's avatar
      Revert "Separate the Registration from Loading dialects in the Context" · ba92dadf
      Mehdi Amini authored
      This was landed by accident, will reland with the right comments
      addressed from the reviews.
      Also revert dependent build fixes.
      ba92dadf
  17. Aug 14, 2020
    • Mehdi Amini's avatar
      Separate the Registration from Loading dialects in the Context · ebf521e7
      Mehdi Amini authored
      This changes the behavior of constructing MLIRContext to no longer load globally registered dialects on construction. Instead Dialects are only loaded explicitly on demand:
      - the Parser is lazily loading Dialects in the context as it encounters them during parsing. This is the only purpose for registering dialects and not load them in the context.
      - Passes are expected to declare the dialects they will create entity from (Operations, Attributes, or Types), and the PassManager is loading Dialects into the Context when starting a pipeline.
      
      This changes simplifies the configuration of the registration: a compiler only need to load the dialect for the IR it will emit, and the optimizer is self-contained and load the required Dialects. For example in the Toy tutorial, the compiler only needs to load the Toy dialect in the Context, all the others (linalg, affine, std, LLVM, ...) are automatically loaded depending on the optimization pipeline enabled.
      ebf521e7
  18. Aug 12, 2020
    • Valentin Clement's avatar
      [mlir][linalg][NFC] Remove extra semi-colon causing warnings · 0e70a127
      Valentin Clement authored
      Extra semi-colon causes bunch of warnings with GCC 9.2.0
      
      ```
      [1354/1516] Building CXX object tools/mlir/lib/Dialect/Linalg/IR/CMakeFiles/obj.MLIRLinalgOps.dir/LinalgOps.cpp.o
      /home/4vn/versioning/llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:1306:35: warning: extra ';' [-Wpedantic]
       1306 | CANONICALIZERS_AND_FOLDERS(ConvOp);
            |                                   ^
      /home/4vn/versioning/llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:1307:41: warning: extra ';' [-Wpedantic]
       1307 | CANONICALIZERS_AND_FOLDERS(PoolingMaxOp);
            |                                         ^
      /home/4vn/versioning/llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:1308:41: warning: extra ';' [-Wpedantic]
       1308 | CANONICALIZERS_AND_FOLDERS(PoolingMinOp);
            |                                         ^
      /home/4vn/versioning/llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:1309:41: warning: extra ';' [-Wpedantic]
       1309 | CANONICALIZERS_AND_FOLDERS(PoolingSumOp);
            |                                         ^
      /home/4vn/versioning/llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:1310:35: warning: extra ';' [-Wpedantic]
       1310 | CANONICALIZERS_AND_FOLDERS(CopyOp);
            |                                   ^
      /home/4vn/versioning/llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:1311:35: warning: extra ';' [-Wpedantic]
       1311 | CANONICALIZERS_AND_FOLDERS(FillOp);
            |                                   ^
      /home/4vn/versioning/llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:1312:38: warning: extra ';' [-Wpedantic]
       1312 | CANONICALIZERS_AND_FOLDERS(GenericOp);
            |                                      ^
      /home/4vn/versioning/llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:1313:45: warning: extra ';' [-Wpedantic]
       1313 | CANONICALIZERS_AND_FOLDERS(IndexedGenericOp);
            |                                             ^
      /home/4vn/versioning/llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:1318:42: warning: extra ';' [-Wpedantic]
       1318 | CANONICALIZERS_AND_FOLDERS(BatchMatmulOp);
            |                                          ^
      /home/4vn/versioning/llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:1319:34: warning: extra ';' [-Wpedantic]
       1319 | CANONICALIZERS_AND_FOLDERS(DotOp);
            |                                  ^
      /home/4vn/versioning/llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:1320:37: warning: extra ';' [-Wpedantic]
       1320 | CANONICALIZERS_AND_FOLDERS(MatmulOp);
            |                                     ^
      /home/4vn/versioning/llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:1321:37: warning: extra ';' [-Wpedantic]
       1321 | CANONICALIZERS_AND_FOLDERS(MatvecOp);
            |                                     ^
      /home/4vn/versioning/llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:1322:36: warning: extra ';' [-Wpedantic]
       1322 | CANONICALIZERS_AND_FOLDERS(ConvWOp);
            |                                    ^
      /home/4vn/versioning/llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:1323:38: warning: extra ';' [-Wpedantic]
       1323 | CANONICALIZERS_AND_FOLDERS(ConvNWCOp);
            |                                      ^
      /home/4vn/versioning/llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:1324:38: warning: extra ';' [-Wpedantic]
       1324 | CANONICALIZERS_AND_FOLDERS(ConvNCWOp);
            |                                      ^
      /home/4vn/versioning/llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:1325:37: warning: extra ';' [-Wpedantic]
       1325 | CANONICALIZERS_AND_FOLDERS(ConvHWOp);
            |                                     ^
      /home/4vn/versioning/llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:1326:39: warning: extra ';' [-Wpedantic]
       1326 | CANONICALIZERS_AND_FOLDERS(ConvNHWCOp);
            |                                       ^
      /home/4vn/versioning/llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:1327:39: warning: extra ';' [-Wpedantic]
       1327 | CANONICALIZERS_AND_FOLDERS(ConvNCHWOp);
            |                                       ^
      /home/4vn/versioning/llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:1328:38: warning: extra ';' [-Wpedantic]
       1328 | CANONICALIZERS_AND_FOLDERS(ConvDHWOp);
            |                                      ^
      /home/4vn/versioning/llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:1329:40: warning: extra ';' [-Wpedantic]
       1329 | CANONICALIZERS_AND_FOLDERS(ConvNDHWCOp);
            |                                        ^
      /home/4vn/versioning/llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:1330:40: warning: extra ';' [-Wpedantic]
       1330 | CANONICALIZERS_AND_FOLDERS(ConvNCDHWOp);
            |                                        ^
      ```
      
      Reviewed By: mehdi_amini, rriddle
      
      Differential Revision: https://reviews.llvm.org/D85766
      0e70a127
  19. Aug 10, 2020
    • MaheshRavishankar's avatar
      [mlir][Linalg] Allow distribution `scf.parallel` loops generated in · 41d41200
      MaheshRavishankar authored
      Linalg to processors.
      
      This changes adds infrastructure to distribute the loops generated in
      Linalg to processors at the time of generation. This addresses use
      case where the instantiation of loop is done just to distribute
      them. The option to distribute is added to TilingOptions for now and
      will allow specifying the distribution as a transformation option,
      just like tiling and promotion are specified as options.
      
      Differential Revision: https://reviews.llvm.org/D85147
      41d41200
  20. Aug 07, 2020
    • River Riddle's avatar
      [mlir][Type] Remove usages of Type::getKind · c8c45985
      River Riddle authored
      This is in preparation for removing the use of "kinds" within attributes and types in MLIR.
      
      Differential Revision: https://reviews.llvm.org/D85475
      c8c45985
    • Nicolas Vasilache's avatar
      [mlir] Introduce AffineMinSCF folding as a pattern · 3110e7b0
      Nicolas Vasilache authored
      This revision adds a folding pattern to replace affine.min ops by the actual min value, when it can be determined statically from the strides and bounds of enclosing scf loop .
      
      This matches the type of expressions that Linalg produces during tiling and simplifies boundary checks. For now Linalg depends both on Affine and SCF but they do not depend on each other, so the pattern is added there.
      In the future this will move to a more appropriate place when it is determined.
      
      The canonicalization of AffineMinOp operations in the context of enclosing scf.for and scf.parallel proceeds by:
        1. building an affine map where uses of the induction variable of a loop
        are replaced by `%lb + %step * floordiv(%iv - %lb, %step)` expressions.
        2. checking if any of the results of this affine map divides all the other
        results (in which case it is also guaranteed to be the min).
        3. replacing the AffineMinOp by the result of (2).
      
      The algorithm is functional in simple parametric tiling cases by using semi-affine maps. However simplifications of such semi-affine maps are not yet available and the canonicalization does not succeed yet.
      
      Differential Revision: https://reviews.llvm.org/D82009
      3110e7b0
    • Mehdi Amini's avatar
      Revisit Dialect registration: require and store a TypeID on dialects · 575b22b5
      Mehdi Amini authored
      This patch moves the registration to a method in the MLIRContext: getOrCreateDialect<ConcreteDialect>()
      
      This method requires dialect to provide a static getDialectNamespace()
      and store a TypeID on the Dialect itself, which allows to lazyily
      create a dialect when not yet loaded in the context.
      As a side effect, it means that duplicated registration of the same
      dialect is not an issue anymore.
      
      To limit the boilerplate, TableGen dialect generation is modified to
      emit the constructor entirely and invoke separately a "init()" method
      that the user implements.
      
      Differential Revision: https://reviews.llvm.org/D85495
      575b22b5
  21. Aug 06, 2020
    • Nicolas Vasilache's avatar
      [mlir][Linalg] Introduce canonicalization to remove dead LinalgOps · 54fafd17
      Nicolas Vasilache authored
      When any of the memrefs in a structured linalg op has a zero dimension, it becomes dead.
      This is consistent with the fact that linalg ops deduce their loop bounds from their operands.
      
      Note however that this is not the case for the `tensor<0xelt_type>` which is a special convention
      that must be lowered away into either `memref<elt_type>` or just `elt_type` before this
      canonicalization can kick in.
      
      Differential Revision: https://reviews.llvm.org/D85413
      54fafd17
Loading