[all-commits] [llvm/llvm-project] 97c1a2: [mlir][linalg] Add option to pad dynamic dims to `...

Fabian Mora via All-commits all-commits at lists.llvm.org
Thu Jun 19 02:48:06 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 97c1a2444574b32dd7a283c53be248c5dbbf62e9
      https://github.com/llvm/llvm-project/commit/97c1a2444574b32dd7a283c53be248c5dbbf62e9
  Author: Fabian Mora <fmora.dev at gmail.com>
  Date:   2025-06-19 (Thu, 19 Jun 2025)

  Changed paths:
    M mlir/include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.td
    M mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
    M mlir/include/mlir/Dialect/Linalg/Utils/Utils.h
    M mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
    M mlir/lib/Dialect/Linalg/Transforms/Padding.cpp
    M mlir/lib/Dialect/Linalg/Utils/Utils.cpp
    M mlir/test/Dialect/Linalg/transform-op-pad.mlir

  Log Message:
  -----------
  [mlir][linalg] Add option to pad dynamic dims to `linalg::rewriteAsPaddedOp` (#144354)

This patch makes the following changes:

- Add a `ValueRange typeDynDims` argument to
`linalg::makeComposedPadHighOp`, allowing to pad a tensor with dynamic
dimensions using `tensor::createPadHighOp`.

- Add a `DenseMap<std::pair<unsigned, unsigned>, OpFoldResult>
sizeToPadTo;` option to `LinalgPaddingOptions`. This option allows
setting the size to use when padding a dimension of an operand, allowing
to pad operands even in the case they don't have a constant upper
bounding box. If the value is not provided, then the constant upper
bound is used by default.

- Add a `use_prescribed_tensor_shapes` option to
`transform.structured.pad`. If set to true then `tensor.dim` will be
used as dimensions to compute the size of the padded dim instead of
computing the constant upper bound.

- This patch also changes the behavior for computing the padded shape
`linalg::rewriteAsPaddedOp`, by using the newly added options in
`LinalgPaddingOptions`.

- Finally it adds tests verifying the behavior.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list