[all-commits] [llvm/llvm-project] 2ada5c: [mlir][linalg] Fix bug in InferStaticShapeOfOperan...

Vladislav Vinogradov via All-commits all-commits at lists.llvm.org
Wed Nov 16 01:19:50 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2ada5cbea47bdf7d8df70981315f352237cc2222
      https://github.com/llvm/llvm-project/commit/2ada5cbea47bdf7d8df70981315f352237cc2222
  Author: Vladislav Vinogradov <v.vinogradov at yadro.com>
  Date:   2022-11-16 (Wed, 16 Nov 2022)

  Changed paths:
    M mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
    M mlir/test/Dialect/Linalg/canonicalize.mlir

  Log Message:
  -----------
  [mlir][linalg] Fix bug in InferStaticShapeOfOperands pattern

The pattern tries to deduce static shape from `tensor.cast` producer of linalg operation operands.
The original code unconditionally casts type of the `tensor.cast` source to `RankedTensorType`.
But the `tensor.cast` can also operate on `UnrankedTensorType`, so this cast either fail on assertion
in debug build or introduce UB in release build.

The patch replaces unconditional cast with `dyn_cast` and check for the cast result.

Reviewed By: mravishankar

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




More information about the All-commits mailing list