[all-commits] [llvm/llvm-project] db4931: [mlir][memref] `memref.subview`: Verify result str...

Matthias Springer via All-commits all-commits at lists.llvm.org
Wed Jan 31 00:15:00 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: db49319264d6d2b6f9f7b345495d543210c2cfe3
      https://github.com/llvm/llvm-project/commit/db49319264d6d2b6f9f7b345495d543210c2cfe3
  Author: Matthias Springer <me at m-sp.org>
  Date:   2024-01-31 (Wed, 31 Jan 2024)

  Changed paths:
    M mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
    M mlir/test/Dialect/GPU/decompose-memrefs.mlir
    M mlir/test/Dialect/MemRef/fold-memref-alias-ops.mlir
    M mlir/test/Dialect/MemRef/invalid.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_rewrite_sort_coo.mlir

  Log Message:
  -----------
  [mlir][memref] `memref.subview`: Verify result strides (#79865)

The `memref.subview` verifier currently checks result shape, element
type, memory space and offset of the result type. However, the strides
of the result type are currently not verified. This commit adds
verification of result strides for non-rank reducing ops and fixes
invalid IR in test cases.

Verification of result strides for ops with rank reductions is more
complex (and there could be multiple possible result types). That is
left for a separate commit.

Also refactor the implementation a bit:
* If `computeMemRefRankReductionMask` could not compute the dropped
dimensions, there must be something wrong with the op. Return
`FailureOr` instead of `std::optional`.
* `isRankReducedMemRefType` did much more than just checking whether the
op has rank reductions or not. Inline the implementation into the
verifier and add better comments.
* `produceSubViewErrorMsg` does not have to be templatized.




More information about the All-commits mailing list