[all-commits] [llvm/llvm-project] 249e42: [mlir][MemRef] Use specialized index ops to fold e...

Krzysztof Drewniak via All-commits all-commits at lists.llvm.org
Tue May 13 09:16:20 PDT 2025


  Branch: refs/heads/users/krzysz00/linearize-delinearize-alias-ops-folder
  Home:   https://github.com/llvm/llvm-project
  Commit: 249e4262abe185d87e6c8cbd1e9b010329fecbd9
      https://github.com/llvm/llvm-project/commit/249e4262abe185d87e6c8cbd1e9b010329fecbd9
  Author: Krzysztof Drewniak <Krzysztof.Drewniak at amd.com>
  Date:   2025-05-13 (Tue, 13 May 2025)

  Changed paths:
    M mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
    M mlir/lib/Dialect/MemRef/Transforms/FoldMemRefAliasOps.cpp
    M mlir/test/Dialect/MemRef/fold-memref-alias-ops.mlir

  Log Message:
  -----------
  [mlir][MemRef] Use specialized index ops to fold expand/collapse_shape

This PR updates the FoldMemRefAliasOps to use `affine.linearize_index`
and `affine.delinearize_index` to perform the index computations
needed to fold a `memref.expand_shape` or `memref.collapse_shape` into
its consumers, respectively.

This also loosens some limitations of the pass:
1. The existing `output_shape` argument to `memref.expand_shape` is
now used, eliminating the need to re-infer this shape or call
`memref.dim`.
2. Because we're using `affine.delinearize_index`, the restriction
that each group in a `memref.collapse_shape` can only have one dynamic
dimension is removed.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list