[all-commits] [llvm/llvm-project] 84aa02: [memref] Handle edge case in subview of full stati...

Benjamin Maxwell via All-commits all-commits at lists.llvm.org
Thu Aug 22 22:52:30 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 84aa02d3fa1f1f614c4f3c144ec118b2f05ae6b0
      https://github.com/llvm/llvm-project/commit/84aa02d3fa1f1f614c4f3c144ec118b2f05ae6b0
  Author: Benjamin Maxwell <macdue at dueutil.tech>
  Date:   2024-08-23 (Fri, 23 Aug 2024)

  Changed paths:
    M mlir/include/mlir/IR/BuiltinAttributes.td
    M mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
    M mlir/lib/IR/BuiltinAttributes.cpp
    M mlir/test/Dialect/MemRef/canonicalize.mlir

  Log Message:
  -----------
  [memref] Handle edge case in subview of full static size fold (#105635)

It is possible to have a subview with a fully static size and a type
that matches the source type, but a dynamic offset that may be
different. However, currently the memref dialect folds:

```mlir
func.func @subview_of_static_full_size(
  %arg0:  memref<16x4xf32,  strided<[4, 1], offset: ?>>, %idx: index)
  -> memref<16x4xf32,  strided<[4, 1], offset: ?>>
{
  %0 = memref.subview %arg0[%idx, 0][16, 4][1, 1]
   : memref<16x4xf32,  strided<[4, 1], offset: ?>>
     to memref<16x4xf32,  strided<[4, 1], offset: ?>>
  return %0 : memref<16x4xf32,  strided<[4, 1], offset: ?>>
}
```

To:

```mlir
func.func @subview_of_static_full_size(
  %arg0: memref<16x4xf32, strided<[4, 1], offset: ?>>, %arg1: index)
  -> memref<16x4xf32, strided<[4, 1], offset: ?>>
{
  return %arg0 : memref<16x4xf32, strided<[4, 1], offset: ?>>
}
```

Which drops the dynamic offset from the `subview` op.



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