[all-commits] [llvm/llvm-project] 6d3ebd: [mlir][affine] Allow `memref.cast` in `isDimOpVali...

Matthias Springer via All-commits all-commits at lists.llvm.org
Wed Dec 13 15:54:52 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6d3ebd831c31d473acb18511949d04038115864a
      https://github.com/llvm/llvm-project/commit/6d3ebd831c31d473acb18511949d04038115864a
  Author: Matthias Springer <me at m-sp.org>
  Date:   2023-12-14 (Thu, 14 Dec 2023)

  Changed paths:
    M mlir/lib/Dialect/Affine/IR/AffineOps.cpp

  Log Message:
  -----------
  [mlir][affine] Allow `memref.cast` in `isDimOpValidSymbol` (#74401)

`isDimOpValidSymbol` is used during the verification of `affine.for`
ops. It is used to check if LB/UB values are valid symbols. This change
adds support for `memref.cast`, which can be skipped over if it is a
ranked -> ranked cast.

This change fixes `mlir/test/Transforms/canonicalize.mlir`, which used
to fail when verifying the IR after each pattern application (#74270).
In this test case, a pattern that folds dynamic offsets/sizes/strides to
static ones is applied. This pattern inserts a trivial `memref.cast`
that can be folded away. This folding happens after the pattern
application, so the IR fails to verify after applying the
offsets/sizes/strides canonicalization pattern.

Note: The verifier of `affine.for` violates MLIR guidelines. Only local
properties of an op should be verified. The verifier should not inspect
the defining ops of operands. (This would mean that constraints such as
"operand is a valid affine symbol" cannot be verified.)




More information about the All-commits mailing list