[Mlir-commits] [mlir] [mlir] [linalg] fix side effect of linalg op (PR #114045)

donald chen llvmlistbot at llvm.org
Tue Oct 29 19:04:24 PDT 2024


================
@@ -1232,3 +1232,21 @@ func.func @transpose_buffer(%input: memref<?xf32>,
 //  CHECK-SAME:            %[[VAL_1:.*]]: memref<?xf32>) {
 //       CHECK:     linalg.transpose ins(%[[VAL_0]] : memref<?xf32>)
 //  CHECK-SAME:       outs(%[[VAL_1]] : memref<?xf32>) permutation = [0]
+
+// -----
+
+// This test checks linalg op has a recursive memory effect. Otherwise
+// linalg.map without a user would be DCEd.
+func.func @recursive_effect(%arg0: memref<1xf32>, %arg1 : tensor<1xf32>) {
+  %c1 = arith.constant 1 : index
+  %init = arith.constant dense<0.0> : tensor<1xf32>
+  %mapped = linalg.map ins(%arg1:tensor<1xf32>) outs(%init :tensor<1xf32>)
+            (%in : f32) {
+              memref.store %in, %arg0[%c1] : memref<1xf32>
----------------
cxy-1993 wrote:

Perhaps there are some usages that I'm unaware of. I'd be happy to hear if you could suggest any.

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


More information about the Mlir-commits mailing list