[all-commits] [llvm/llvm-project] 0a9f6b: [mlir][tensor/linalg] Fix bug in reifyResultShapes

Matthias Springer via All-commits all-commits at lists.llvm.org
Fri Mar 10 02:38:15 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0a9f6b8ca3fa9449cc0accba1bc11e98d6dbc6b6
      https://github.com/llvm/llvm-project/commit/0a9f6b8ca3fa9449cc0accba1bc11e98d6dbc6b6
  Author: Matthias Springer <me at m-sp.org>
  Date:   2023-03-10 (Fri, 10 Mar 2023)

  Changed paths:
    M mlir/lib/Dialect/Linalg/IR/LinalgInterfaces.cpp
    M mlir/lib/Dialect/Tensor/IR/TensorOps.cpp

  Log Message:
  -----------
  [mlir][tensor/linalg] Fix bug in reifyResultShapes

`reifyResultShapes` should return an IntegerAttr if and only if the corresponding dimension is static.

Differential Revision: https://reviews.llvm.org/D145702


  Commit: 758329dc7cd3b0da835a4f865b89003263050080
      https://github.com/llvm/llvm-project/commit/758329dc7cd3b0da835a4f865b89003263050080
  Author: Matthias Springer <me at m-sp.org>
  Date:   2023-03-10 (Fri, 10 Mar 2023)

  Changed paths:
    M mlir/include/mlir/Interfaces/InferTypeOpInterface.h
    M mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp
    M mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
    M mlir/lib/Dialect/Linalg/Transforms/ConvertToDestinationStyle.cpp
    M mlir/lib/Dialect/Linalg/Transforms/FusePadOpWithLinalgProducer.cpp
    M mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp
    M mlir/lib/Dialect/MemRef/Transforms/ResolveShapedTypeResultDims.cpp
    M mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
    M mlir/lib/Dialect/Tensor/IR/TensorTilingInterfaceImpl.cpp
    M mlir/lib/Dialect/Tensor/Transforms/EmptyOpPatterns.cpp
    M mlir/lib/Dialect/Tensor/Transforms/ExtractSliceFromReshapeUtils.cpp
    M mlir/lib/Interfaces/InferTypeOpInterface.cpp
    M mlir/test/lib/Dialect/Tensor/TestTensorTransforms.cpp
    M mlir/test/lib/Dialect/Test/TestDialect.cpp

  Log Message:
  -----------
  [mlir][NFC] reifyResultShapes: Add extra error checking

This change adds a new helper function `mlir::reifyResultShapes` that calls the corresponding interface method and also checks the result produced by the implementation when running in debug mode. Bugs due to incorrect interface implementations can be difficult to debug.

This helper function also reduces the amount of code needed at call sites: the cast to `ReifyRankedShapedTypeOpInterface` is done in the helper function.

Differential Revision: https://reviews.llvm.org/D145777


Compare: https://github.com/llvm/llvm-project/compare/6b03ce374e0d...758329dc7cd3


More information about the All-commits mailing list