[all-commits] [llvm/llvm-project] 3810f7: [mlir][tensor|memref] Harden the checks on dim op

qcolombet via All-commits all-commits at lists.llvm.org
Thu Feb 2 02:39:12 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3810f76c50923dd0ef16ace6a550e5a4ab6c16a5
      https://github.com/llvm/llvm-project/commit/3810f76c50923dd0ef16ace6a550e5a4ab6c16a5
  Author: Quentin Colombet <quentin.colombet at gmail.com>
  Date:   2023-02-02 (Thu, 02 Feb 2023)

  Changed paths:
    M mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
    M mlir/include/mlir/Dialect/Tensor/IR/TensorOps.td
    M mlir/include/mlir/IR/OpBase.td
    M mlir/test/Dialect/MemRef/invalid.mlir
    M mlir/test/Dialect/Tensor/bufferize.mlir
    M mlir/test/Dialect/Tensor/invalid.mlir

  Log Message:
  -----------
  [mlir][tensor|memref] Harden the checks on dim op

Prior to this patch it was possible to use the dim operation on a 0-D
memref/tensor.
Unless we want to change the semantic of a 0-D shape, this doesn't make
sense because, paraphrasing the dim op semantic, this is guaranteed to
produce something that is undefined. (The requested index is guaranteed
to be equal to or greater than the rank.)

Harden the type requirements for the dim op by disallowing 0-D shaped
types.

This "fixes" llvm.org/PR60195 by rejecting dim op on 0-D shapes instead of
crashing during LLVM conversion.

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




More information about the All-commits mailing list