Skip to content

Commit 6f9a028

Browse files
address comments
1 parent 883628a commit 6f9a028

File tree

2 files changed

+27
-23
lines changed

2 files changed

+27
-23
lines changed

mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_coo_test.mlir

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -172,18 +172,19 @@ module {
172172
%COO_RET = call @add_coo_coo_out_coo(%COO_A, %COO_B) : (tensor<8x8xf32, #SortedCOO>,
173173
tensor<8x8xf32, #SortedCOOSoA>)
174174
-> tensor<8x8xf32, #SortedCOOSoA>
175+
%C4 = sparse_tensor.convert %COO_RET : tensor<8x8xf32, #SortedCOOSoA> to tensor<8x8xf32>
175176

176177
//
177178
// Verify computed matrix C.
178179
//
179-
// CHECK-COUNT-3: ( 8.8, 4.8, 6.8, 4.8, 8.8, 6.1, 14.8, 16.8 )
180-
// CHECK-NEXT-COUNT-3: ( 4.4, 4.4, 4.4, 8.4, 8.4, 12.4, 16.4, 16.4 )
181-
// CHECK-NEXT-COUNT-3: ( 8.8, 4.8, 6.8, 8.8, 8.8, 12.8, 14.8, 15.8 )
182-
// CHECK-NEXT-COUNT-3: ( 4.3, 5.3, 6.3, 8.3, 8.3, 12.3, 14.3, 16.3 )
183-
// CHECK-NEXT-COUNT-3: ( 4.5, 4.5, 6.5, 8.5, 8.5, 12.5, 14.5, 16.5 )
184-
// CHECK-NEXT-COUNT-3: ( 9.9, 4.9, 6.9, 8.9, 8.9, 12.9, 15.9, 16.9 )
185-
// CHECK-NEXT-COUNT-3: ( 12.1, 6.1, 5.1, 9.1, 9.1, 13.1, 15.1, 17.1 )
186-
// CHECK-NEXT-COUNT-3: ( 15.4, 5.4, 7.4, 5.4, 11.4, 10.4, 11.4, 9.4 )
180+
// CHECK-COUNT-4: ( 8.8, 4.8, 6.8, 4.8, 8.8, 6.1, 14.8, 16.8 )
181+
// CHECK-NEXT-COUNT-4: ( 4.4, 4.4, 4.4, 8.4, 8.4, 12.4, 16.4, 16.4 )
182+
// CHECK-NEXT-COUNT-4: ( 8.8, 4.8, 6.8, 8.8, 8.8, 12.8, 14.8, 15.8 )
183+
// CHECK-NEXT-COUNT-4: ( 4.3, 5.3, 6.3, 8.3, 8.3, 12.3, 14.3, 16.3 )
184+
// CHECK-NEXT-COUNT-4: ( 4.5, 4.5, 6.5, 8.5, 8.5, 12.5, 14.5, 16.5 )
185+
// CHECK-NEXT-COUNT-4: ( 9.9, 4.9, 6.9, 8.9, 8.9, 12.9, 15.9, 16.9 )
186+
// CHECK-NEXT-COUNT-4: ( 12.1, 6.1, 5.1, 9.1, 9.1, 13.1, 15.1, 17.1 )
187+
// CHECK-NEXT-COUNT-4: ( 15.4, 5.4, 7.4, 5.4, 11.4, 10.4, 11.4, 9.4 )
187188
//
188189
%f0 = arith.constant 0.0 : f32
189190
scf.for %i = %c0 to %c8 step %c1 {
@@ -193,9 +194,12 @@ module {
193194
: tensor<8x8xf32>, vector<8xf32>
194195
%v3 = vector.transfer_read %C3[%i, %c0], %f0
195196
: tensor<8x8xf32>, vector<8xf32>
197+
%v4 = vector.transfer_read %C4[%i, %c0], %f0
198+
: tensor<8x8xf32>, vector<8xf32>
196199
vector.print %v1 : vector<8xf32>
197200
vector.print %v2 : vector<8xf32>
198201
vector.print %v3 : vector<8xf32>
202+
vector.print %v4 : vector<8xf32>
199203
}
200204

201205
//
@@ -228,6 +232,7 @@ module {
228232
bufferization.dealloc_tensor %C1 : tensor<8x8xf32>
229233
bufferization.dealloc_tensor %C2 : tensor<8x8xf32>
230234
bufferization.dealloc_tensor %C3 : tensor<8x8xf32>
235+
bufferization.dealloc_tensor %C4 : tensor<8x8xf32>
231236
bufferization.dealloc_tensor %CSR_A : tensor<8x8xf32, #CSR>
232237
bufferization.dealloc_tensor %COO_A : tensor<8x8xf32, #SortedCOO>
233238
bufferization.dealloc_tensor %COO_B : tensor<8x8xf32, #SortedCOOSoA>

mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_index.mlir

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -297,22 +297,8 @@ module {
297297
sparse_tensor.print %6 : tensor<3x4xi64, #SparseMatrix>
298298
sparse_tensor.print %7 : tensor<3x4xi64, #SparseMatrix>
299299

300-
// Release resources.
301-
bufferization.dealloc_tensor %sv : tensor<8xi64, #SparseVector>
302-
bufferization.dealloc_tensor %dv : tensor<8xi64, #SparseVector>
303-
bufferization.dealloc_tensor %0 : tensor<8xi64, #SparseVector>
304-
bufferization.dealloc_tensor %1 : tensor<8xi64, #SparseVector>
305-
bufferization.dealloc_tensor %2 : tensor<8xi64, #SparseVector>
306-
bufferization.dealloc_tensor %3 : tensor<8xi64, #SparseVector>
307-
bufferization.dealloc_tensor %sm : tensor<3x4xi64, #SparseMatrix>
308-
bufferization.dealloc_tensor %dm : tensor<3x4xi64, #SparseMatrix>
309-
bufferization.dealloc_tensor %4 : tensor<3x4xi64, #SparseMatrix>
310-
bufferization.dealloc_tensor %5 : tensor<3x4xi64, #SparseMatrix>
311-
bufferization.dealloc_tensor %6 : tensor<3x4xi64, #SparseMatrix>
312-
bufferization.dealloc_tensor %7 : tensor<3x4xi64, #SparseMatrix>
313-
314300
//
315-
// Call the f32 kernel, verify the result, release the resources.
301+
// Call the f32 kernel, verify the result.
316302
//
317303
// CHECK: ---- Sparse Tensor ----
318304
// CHECK-NEXT: nse = 6
@@ -329,6 +315,19 @@ module {
329315
-> tensor<2x3xf32, #SparseMatrix>
330316
sparse_tensor.print %100 : tensor<2x3xf32, #SparseMatrix>
331317

318+
// Release resources.
319+
bufferization.dealloc_tensor %sv : tensor<8xi64, #SparseVector>
320+
bufferization.dealloc_tensor %dv : tensor<8xi64, #SparseVector>
321+
bufferization.dealloc_tensor %0 : tensor<8xi64, #SparseVector>
322+
bufferization.dealloc_tensor %1 : tensor<8xi64, #SparseVector>
323+
bufferization.dealloc_tensor %2 : tensor<8xi64, #SparseVector>
324+
bufferization.dealloc_tensor %3 : tensor<8xi64, #SparseVector>
325+
bufferization.dealloc_tensor %sm : tensor<3x4xi64, #SparseMatrix>
326+
bufferization.dealloc_tensor %dm : tensor<3x4xi64, #SparseMatrix>
327+
bufferization.dealloc_tensor %4 : tensor<3x4xi64, #SparseMatrix>
328+
bufferization.dealloc_tensor %5 : tensor<3x4xi64, #SparseMatrix>
329+
bufferization.dealloc_tensor %6 : tensor<3x4xi64, #SparseMatrix>
330+
bufferization.dealloc_tensor %7 : tensor<3x4xi64, #SparseMatrix>
332331
bufferization.dealloc_tensor %sf32 : tensor<2x3xf32, #SparseMatrix>
333332
bufferization.dealloc_tensor %100 : tensor<2x3xf32, #SparseMatrix>
334333

0 commit comments

Comments
 (0)