[Mlir-commits] [mlir] [mlir][vector] Fix scalability issues in drop innermost transfer_read unit dims (PR #92402)

Cullen Rhodes llvmlistbot at llvm.org
Fri May 17 00:00:30 PDT 2024


================
@@ -174,3 +174,33 @@ func.func @non_unit_strides(%arg0: memref<512x16x1xf32, strided<[8192, 16, 4], o
 // The inner most unit dims can not be dropped if the strides are not ones.
 // CHECK:     func.func @non_unit_strides
 // CHECK-NOT:   memref.subview
+
+// -----
+
+func.func @leading_scalable_dimension_transfer_read(%dest : memref<24x1xf32>, %index: index) -> vector<[4]x1xf32> {
+  %c0 = arith.constant 0 : index
+  %cst_0 = arith.constant 0.000000e+00 : f32
+  %4 = vector.transfer_read %dest[%index, %c0], %cst_0 {in_bounds = [true, true]} : memref<24x1xf32>, vector<[4]x1xf32>
+  return %4 : vector<[4]x1xf32>
+}
----------------
c-rhodes wrote:

nit: is non-constant index necessary or will constant do? Also some other clean ups / suggestions (same applies to test below).
```suggestion
func.func @leading_scalable_dimension_transfer_read(%dest : memref<24x1xf32>) -> vector<[4]x1xf32> {
  %c0 = arith.constant 0 : index
  %pad = arith.constant 0.0 : f32
  %0 = vector.transfer_read %dest[%c0, %c0], %pad {in_bounds = [true, true]} : memref<24x1xf32>, vector<[4]x1xf32>
  return %0 : vector<[4]x1xf32>
}
```

https://github.com/llvm/llvm-project/pull/92402


More information about the Mlir-commits mailing list