1
- // RUN: mlir-opt %s -one-shot-bufferize="bufferize-function-boundaries allow-return-allocs function-boundary-type-conversion=fully-dynamic-layout-map" -drop-equivalent-buffer-results -buffer-results-to-out-params -split-input-file | FileCheck %s
2
- // RUN: mlir-opt %s -one-shot-bufferize="bufferize-function-boundaries allow-return-allocs function-boundary-type-conversion=identity-layout-map" -drop-equivalent-buffer-results -buffer-results-to-out-params -split-input-file | FileCheck %s --check-prefix=CHECK-NO-LAYOUT
3
- // RUN: mlir-opt %s -one-shot-bufferize="bufferize-function-boundaries allow-return-allocs function-boundary-type-conversion=infer-layout-map" -drop-equivalent-buffer-results -split-input-file | FileCheck %s --check-prefix=CHECK-BASELINE
1
+ // RUN: mlir-opt %s -one-shot-bufferize="bufferize-function-boundaries allow-return-allocs function-boundary-type-conversion=fully-dynamic-layout-map" -drop-equivalent-buffer-results -buffer-results-to-out-params -buffer-deallocation - split-input-file | FileCheck %s
2
+ // RUN: mlir-opt %s -one-shot-bufferize="bufferize-function-boundaries allow-return-allocs function-boundary-type-conversion=identity-layout-map" -drop-equivalent-buffer-results -buffer-results-to-out-params -buffer-deallocation - split-input-file | FileCheck %s --check-prefix=CHECK-NO-LAYOUT
3
+ // RUN: mlir-opt %s -one-shot-bufferize="bufferize-function-boundaries allow-return-allocs function-boundary-type-conversion=infer-layout-map" -drop-equivalent-buffer-results -buffer-deallocation - split-input-file | FileCheck %s --check-prefix=CHECK-BASELINE
4
4
5
5
// Note: function-boundary-type-conversion=infer-layout-map with
6
6
// promote-buffer-results-to-out-params is an unsupported combination.
18
18
// CHECK: memref.store %{{.*}}, %[[alloc]]
19
19
// CHECK: %[[casted:.*]] = memref.cast %[[alloc]]
20
20
// CHECK: memref.copy %[[casted]], %[[arg1]]
21
+ // CHECK: memref.dealloc %[[alloc]]
21
22
// CHECK: return
22
23
// CHECK: }
23
24
28
29
// CHECK-NO-LAYOUT: memref.copy %[[arg0]], %[[alloc]]
29
30
// CHECK-NO-LAYOUT: memref.store {{.*}}, %[[alloc]]
30
31
// CHECK-NO-LAYOUT: memref.copy %[[alloc]], %[[arg1]]
32
+ // CHECK-NO-LAYOUT: memref.dealloc %[[alloc]]
31
33
32
34
// CHECK-BASELINE-LABEL: func @callee(
33
35
// CHECK-BASELINE-SAME: %[[arg0:.*]]: memref<5xf32, strided<[?], offset: ?>>) -> memref<5xf32> {
@@ -51,6 +53,7 @@ func.func @callee(%t: tensor<5xf32>) -> (tensor<5xf32>, tensor<5xf32>) {
51
53
// CHECK: call @callee(%[[arg0]], %[[casted]])
52
54
// CHECK: %[[l1:.*]] = memref.load %[[arg0]]
53
55
// CHECK: %[[l2:.*]] = memref.load %[[casted]]
56
+ // CHECK: memref.dealloc %[[alloc]]
54
57
// CHECK: return %[[l1]], %[[l2]]
55
58
// CHECK: }
56
59
@@ -75,6 +78,7 @@ func.func @main(%t: tensor<5xf32>) -> (f32, f32) {
75
78
// CHECK: %[[subview:.*]] = memref.subview %[[alloc]]{{.*}} : memref<10x20xf32> to memref<2x5xf32, strided<[20, 1], offset: ?>>
76
79
// CHECK: %[[casted:.*]] = memref.cast %[[subview]]
77
80
// CHECK: memref.copy %[[casted]], %[[r]]
81
+ // CHECK: memref.dealloc %[[alloc]]
78
82
79
83
// CHECK-NO-LAYOUT-LABEL: func @callee(
80
84
// CHECK-NO-LAYOUT-SAME: %{{.*}}: index,
@@ -86,7 +90,9 @@ func.func @main(%t: tensor<5xf32>) -> (f32, f32) {
86
90
// value and function signature.
87
91
// CHECK-NO-LAYOUT: %[[alloc2:.*]] = memref.alloc() : memref<2x5xf32>
88
92
// CHECK-NO-LAYOUT: memref.copy %[[subview]], %[[alloc2]]
93
+ // CHECK-NO-LAYOUT: memref.dealloc %[[alloc]]
89
94
// CHECK-NO-LAYOUT: memref.copy %[[alloc2]], %[[r]]
95
+ // CHECK-NO-LAYOUT: memref.dealloc %[[alloc2]]
90
96
91
97
// CHECK-BASELINE-LABEL: func @callee(
92
98
// CHECK-BASELINE-SAME: %{{.*}}: index) -> memref<2x5xf32, strided<[20, 1], offset: ?>> {
@@ -104,11 +110,13 @@ func.func @callee(%idx: index) -> tensor<2x5xf32> {
104
110
// CHECK: %[[casted:.*]] = memref.cast %[[alloc]] : memref<2x5xf32> to memref<2x5xf32, strided<[?, ?], offset: ?>>
105
111
// CHECK: call @callee(%{{.*}}, %[[casted]])
106
112
// CHECK: memref.load %[[casted]]
113
+ // CHECK: memref.dealloc %[[alloc]]
107
114
108
115
// CHECK-NO-LAYOUT: func @main(
109
116
// CHECK-NO-LAYOUT: %[[alloc:.*]] = memref.alloc() : memref<2x5xf32>
110
117
// CHECK-NO-LAYOUT: call @callee(%{{.*}}, %[[alloc]])
111
118
// CHECK-NO-LAYOUT: memref.load %[[alloc]]
119
+ // CHECK-NO-LAYOUT: memref.dealloc
112
120
113
121
// CHECK-BASELINE: func @main(
114
122
// CHECK-BASELINE: %[[call:.*]] = call @callee
0 commit comments