@@ -105,35 +105,34 @@ func.func @sparse_convert_complex(%arg0: tensor<100xcomplex<f64>>) -> tensor<100
105
105
106
106
// CHECK-RWT-LABEL: func.func @sparse_convert_2d(
107
107
// CHECK-RWT-SAME: %[[T0:.*]]: tensor<2x4xf64>) -> tensor<2x4xf64, #sparse_tensor.encoding<{ dimLevelType = [ "dense", "compressed" ] }>> {
108
- // CHECK-RWT: %[[VAL_1:.*]] = arith.constant 1 : index
109
- // CHECK-RWT: %[[VAL_2:.*]] = bufferization.alloc_tensor()
110
- // CHECK-RWT: %[[VAL_3:.*]] = sparse_tensor.foreach in %[[T0]] init(%[[VAL_2]])
111
- // CHECK-RWT: ^bb0(%[[VAL_4:.*]]: index, %[[VAL_5:.*]]: index, %[[VAL_6:.*]]: f64, %[[VAL_7:.*]]: tensor
112
- // CHECK-RWT: %[[CMP:.*]] = arith.cmpf une, %[[VAL_6]]
108
+ // CHECK-RWT: %[[T1:.*]] = bufferization.alloc_tensor()
109
+ // CHECK-RWT: %[[T2:.*]] = sparse_tensor.foreach in %[[T0]] init(%[[T1]])
110
+ // CHECK-RWT: ^bb0(%[[L0I0:.*]]: index, %[[L0I1:.*]]: index, %[[L0V:.*]]: f64, %[[L0T:.*]]: tensor
111
+ // CHECK-RWT: %[[CMP:.*]] = arith.cmpf une, %[[L0V]]
113
112
// CHECK-RWT: %[[IFR:.*]] = scf.if %[[CMP]]
114
- // CHECK-RWT: %[[Y1 :.*]] = sparse_tensor.insert %[[VAL_6 ]] into %[[VAL_7 ]]
115
- // CHECK-RWT: scf.yield %[[Y1 ]]
113
+ // CHECK-RWT: %[[L0T2 :.*]] = sparse_tensor.insert %[[L0V ]] into %[[L0T]]{{\[}}%[[L0I0]], %[[L0I1] ]]
114
+ // CHECK-RWT: scf.yield %[[L0T2 ]]
116
115
// CHECK-RWT: } else {
117
- // CHECK-RWT: scf.yield %[[VAL_7 ]]
116
+ // CHECK-RWT: scf.yield %[[L0T ]]
118
117
// CHECK-RWT: }
119
118
// CHECK-RWT: sparse_tensor.yield %[[IFR]]
120
119
// CHECK-RWT: }
121
- // CHECK-RWT: %[[COO:.*]] = sparse_tensor.load %[[VAL_3 ]] hasInserts
120
+ // CHECK-RWT: %[[COO:.*]] = sparse_tensor.load %[[T2 ]] hasInserts
122
121
// CHECK-RWT: %[[I0:.*]] = sparse_tensor.indices %[[COO]] {dimension = 0 : index}
123
122
// CHECK-RWT: %[[I1:.*]] = sparse_tensor.indices %[[COO]] {dimension = 1 : index}
124
- // CHECK-RWT: %[[VAL_13 :.*]] = memref.load %[[I0]]{{\[}}%[[VAL_1]]] : memref<?xindex>
125
- // CHECK-RWT: %[[VAL_14 :.*]] = sparse_tensor.values %[[COO]]
126
- // CHECK-RWT: sparse_tensor.sort %[[VAL_13 ]], %[[I0]], %[[I1]] jointly %[[VAL_14 ]] : memref<?xindex>, memref<?xindex> jointly memref<?xf64>
127
- // CHECK-RWT: %[[VAL_15 :.*]] = bufferization.alloc_tensor()
128
- // CHECK-RWT: %[[VAL_16 :.*]] = sparse_tensor.foreach in %[[COO]] init(%[[VAL_15 ]])
129
- // CHECK-RWT: ^bb0(%[[VAL_17 :.*]]: index, %[[VAL_18 :.*]]: index, %[[VAL_19 :.*]]: f64, %[[VAL_20 :.*]]: tensor
130
- // CHECK-RWT: %[[VAL_21 :.*]] = sparse_tensor.insert %[[VAL_19 ]] into %[[VAL_20 ]]{{\[}}%[[VAL_17 ]], %[[VAL_18 ]]]
131
- // CHECK-RWT: sparse_tensor.yield %[[VAL_21 ]]
123
+ // CHECK-RWT: %[[NNZ :.*]] = sparse_tensor.number_of_entries %[[COO]]
124
+ // CHECK-RWT: %[[V :.*]] = sparse_tensor.values %[[COO]]
125
+ // CHECK-RWT: sparse_tensor.sort %[[NNZ ]], %[[I0]], %[[I1]] jointly %[[V ]] : memref<?xindex>, memref<?xindex> jointly memref<?xf64>
126
+ // CHECK-RWT: %[[T3 :.*]] = bufferization.alloc_tensor()
127
+ // CHECK-RWT: %[[T4 :.*]] = sparse_tensor.foreach in %[[COO]] init(%[[T3 ]])
128
+ // CHECK-RWT: ^bb0(%[[L1I0 :.*]]: index, %[[L1I1 :.*]]: index, %[[L1V :.*]]: f64, %[[L1T :.*]]: tensor
129
+ // CHECK-RWT: %[[L1T2 :.*]] = sparse_tensor.insert %[[L1V ]] into %[[L1T ]]{{\[}}%[[L1I0 ]], %[[L1I1 ]]]
130
+ // CHECK-RWT: sparse_tensor.yield %[[L1T2 ]]
132
131
// CHECK-RWT: }
133
- // CHECK-RWT: %[[VAL_22 :.*]] = sparse_tensor.load %[[VAL_16 ]] hasInserts
134
- // CHECK-RWT: %[[VAL_24 :.*]] = sparse_tensor.convert %[[VAL_22 ]]
132
+ // CHECK-RWT: %[[T5 :.*]] = sparse_tensor.load %[[T4 ]] hasInserts
133
+ // CHECK-RWT: %[[T6 :.*]] = sparse_tensor.convert %[[T5 ]]
135
134
// CHECK-RWT: bufferization.dealloc_tensor %[[COO]]
136
- // CHECK-RWT: return %[[VAL_24 ]]
135
+ // CHECK-RWT: return %[[T6 ]]
137
136
// CHECK-RWT: }
138
137
func.func @sparse_convert_2d (%arg0: tensor <2 x4 xf64 >) -> tensor <2 x4 xf64 , #CSR > {
139
138
%0 = sparse_tensor.convert %arg0 : tensor <2 x4 xf64 > to tensor <2 x4 xf64 , #CSR >
@@ -169,30 +168,29 @@ func.func @sparse_convert_2d(%arg0: tensor<2x4xf64>) -> tensor<2x4xf64, #CSR> {
169
168
// CHECK: return %[[T]] : !llvm.ptr<i8>
170
169
171
170
// CHECK-RWT-LABEL: func.func @sparse_constant() -> tensor<8x7xf32, #sparse_tensor.encoding<{ dimLevelType = [ "dense", "compressed" ] }>> {
172
- // CHECK-RWT: %[[VAL_0:.*]] = arith.constant 1 : index
173
- // CHECK-RWT: %[[VAL_1:.*]] = arith.constant sparse<{{\[\[}}0, 0], [1, 6]], [1.000000e+00, 5.000000e+00]> : tensor<8x7xf32>
171
+ // CHECK-RWT: %[[F0:.*]] = arith.constant sparse<{{\[\[}}0, 0], [1, 6]], [1.000000e+00, 5.000000e+00]> : tensor<8x7xf32>
174
172
// CHECK-RWT: %[[T0:.*]] = bufferization.alloc_tensor()
175
- // CHECK-RWT: %[[T1:.*]] = sparse_tensor.foreach in %[[VAL_1 ]] init(%[[T0]])
176
- // CHECK-RWT: ^bb0(%[[VAL_4 :.*]]: index, %[[VAL_5 :.*]]: index, %[[VAL_6 :.*]]: f32, %[[VAL_7 :.*]]: tensor
177
- // CHECK-RWT: %[[T2 :.*]] = sparse_tensor.insert %[[VAL_6 ]] into %[[VAL_7 ]]{{\[}}%[[VAL_4 ]], %[[VAL_5 ]]]
178
- // CHECK-RWT: sparse_tensor.yield %[[T2 ]]
173
+ // CHECK-RWT: %[[T1:.*]] = sparse_tensor.foreach in %[[F0 ]] init(%[[T0]])
174
+ // CHECK-RWT: ^bb0(%[[L0I0 :.*]]: index, %[[L0I1 :.*]]: index, %[[L0V :.*]]: f32, %[[L0T :.*]]: tensor
175
+ // CHECK-RWT: %[[L0T2 :.*]] = sparse_tensor.insert %[[L0V ]] into %[[L0T ]]{{\[}}%[[L0I0 ]], %[[L0I1 ]]]
176
+ // CHECK-RWT: sparse_tensor.yield %[[L0T2 ]]
179
177
// CHECK-RWT: }
180
178
// CHECK-RWT: %[[COO:.*]] = sparse_tensor.load %[[T1]] hasInserts
181
179
// CHECK-RWT: %[[I0:.*]] = sparse_tensor.indices %[[COO]] {dimension = 0 : index}
182
180
// CHECK-RWT: %[[I1:.*]] = sparse_tensor.indices %[[COO]] {dimension = 1 : index}
183
- // CHECK-RWT: %[[VAL_13 :.*]] = memref.load %[[I0]]{{\[}}%[[VAL_0]]] : memref<?xindex>
181
+ // CHECK-RWT: %[[NNZ :.*]] = sparse_tensor.number_of_entries %[[COO]]
184
182
// CHECK-RWT: %[[V:.*]] = sparse_tensor.values %[[COO]]
185
- // CHECK-RWT: sparse_tensor.sort %[[VAL_13 ]], %[[I0]], %[[I1]] jointly %[[V]] : memref<?xindex>, memref<?xindex> jointly memref<?xf32>
186
- // CHECK-RWT: %[[VAL_15 :.*]] = bufferization.alloc_tensor()
187
- // CHECK-RWT: %[[VAL_16 :.*]] = sparse_tensor.foreach in %[[COO]] init(%[[VAL_15 ]])
188
- // CHECK-RWT: ^bb0(%[[VAL_17 :.*]]: index, %[[VAL_18 :.*]]: index, %[[VAL_19 :.*]]: f32, %[[VAL_20 :.*]]: tensor
189
- // CHECK-RWT: %[[VAL_21 :.*]] = sparse_tensor.insert %[[VAL_19 ]] into %[[VAL_20 ]]{{\[}}%[[VAL_17 ]], %[[VAL_18 ]]]
190
- // CHECK-RWT: sparse_tensor.yield %[[VAL_21 ]]
183
+ // CHECK-RWT: sparse_tensor.sort %[[NNZ ]], %[[I0]], %[[I1]] jointly %[[V]] : memref<?xindex>, memref<?xindex> jointly memref<?xf32>
184
+ // CHECK-RWT: %[[T3 :.*]] = bufferization.alloc_tensor()
185
+ // CHECK-RWT: %[[T4 :.*]] = sparse_tensor.foreach in %[[COO]] init(%[[T3 ]])
186
+ // CHECK-RWT: ^bb0(%[[L1I0 :.*]]: index, %[[L1I1 :.*]]: index, %[[L1V :.*]]: f32, %[[L1T :.*]]: tensor
187
+ // CHECK-RWT: %[[L1T2 :.*]] = sparse_tensor.insert %[[L1V ]] into %[[L1T ]]{{\[}}%[[L1I0 ]], %[[L1I1 ]]]
188
+ // CHECK-RWT: sparse_tensor.yield %[[L1T2 ]]
191
189
// CHECK-RWT: }
192
- // CHECK-RWT: %[[VAL_22 :.*]] = sparse_tensor.load %[[VAL_16 ]] hasInserts
193
- // CHECK-RWT: %[[VAL_24 :.*]] = sparse_tensor.convert %[[VAL_22 ]]
190
+ // CHECK-RWT: %[[T5 :.*]] = sparse_tensor.load %[[T4 ]] hasInserts
191
+ // CHECK-RWT: %[[T6 :.*]] = sparse_tensor.convert %[[T5 ]]
194
192
// CHECK-RWT: bufferization.dealloc_tensor %[[COO]]
195
- // CHECK-RWT: return %[[VAL_24 ]]
193
+ // CHECK-RWT: return %[[T6 ]]
196
194
// CHECK-RWT: }
197
195
func.func @sparse_constant () -> tensor <8 x7 xf32 , #CSR >{
198
196
// Initialize a tensor.
0 commit comments