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

Krzysztof Drewniak via All-commits all-commits at lists.llvm.org
Tue May 13 11:29:14 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a891163e506238194b715f901c89a424806c8cf3
      https://github.com/llvm/llvm-project/commit/a891163e506238194b715f901c89a424806c8cf3
  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 (#138930)

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