[mlir][sparse] Fix checks in a test.
authorbixia1 <bixia@google.com>
Thu, 8 Dec 2022 16:22:37 +0000 (08:22 -0800)
committerbixia1 <bixia@google.com>
Thu, 8 Dec 2022 16:48:55 +0000 (08:48 -0800)
Reviewed By: Peiming

Differential Revision: https://reviews.llvm.org/D139636

mlir/test/Dialect/SparseTensor/convert_sparse2sparse.mlir

index 496d594..3b975cc 100644 (file)
@@ -25,7 +25,7 @@
   dimLevelType = ["compressed"]
 }>
 
-#SortedWRT3D = #sparse_tensor.encoding<{
+#SortedCOO3D = #sparse_tensor.encoding<{
   dimLevelType = [ "compressed-nu", "singleton-nu", "singleton" ]
 
 }>
@@ -169,29 +169,29 @@ func.func @sparse_convert_singleton(%arg0: tensor<?xf32, #SparseSingleton64>) ->
   return %0 : tensor<?xf32, #SparseSingleton32>
 }
 
-// CHECK-WRT-LABEL: func.func @sparse_convert_permuted(
-//  CHECK-WRT-SAME: %[[COO:.*]]:
-//   CHECK-WRT-DAG: %[[C0:.*]] = arith.constant 0 : index
-//   CHECK-WRT-DAG: %[[C1:.*]] = arith.constant 1 : index
-//   CHECK-WRT-DAG: %[[C2:.*]] = arith.constant 2 : index
-//       CHECK-WRT: %[[D0:.*]] = tensor.dim %[[COO]], %[[C0]]
-//       CHECK-WRT: %[[D1:.*]] = tensor.dim %[[COO]], %[[C1]]
-//       CHECK-WRT: %[[D2:.*]] = tensor.dim %[[COO]], %[[C2]]
-//       CHECK-WRT: %[[I0:.*]] = sparse_tensor.indices %[[COO]] {dimension = 0 : index}
-//       CHECK-WRT: %[[I1:.*]] = sparse_tensor.indices %[[COO]] {dimension = 1 : index}
-//       CHECK-WRT: %[[I2:.*]] = sparse_tensor.indices %[[COO]] {dimension = 2 : index}
-//       CHECK-WRT: %[[NNZ:.*]] = sparse_tensor.number_of_entries %[[COO]]
-//       CHECK-WRT: %[[V:.*]] = sparse_tensor.values %[[COO]]
-//       CHECK-WRT: sparse_tensor.sort %[[NNZ]], %[[I2]], %[[I0]], %[[I1]] jointly %[[V]]
-//       CHECK-WRT: %[[T1:.*]] = bufferization.alloc_tensor(%[[D0]], %[[D1]], %[[D2]])
-//       CHECK-WRT: %[[T2:.*]] = sparse_tensor.foreach in %[[COO]] init(%[[T1]])
-//       CHECK-WRT: ^bb0(%[[LI0:.*]]: index, %[[LI1:.*]]: index, %[[LI2:.*]]: index, %[[LV:.*]]: f32, %[[LT1:.*]]: tensor<?x?x?xf32,
-//       CHECK-WRT:   %[[LT2:.*]] = sparse_tensor.insert %[[LV]] into %[[LT1]]{{\[}}%[[LI2]], %[[LI0]], %[[LI1]]]
-//       CHECK-WRT:   sparse_tensor.yield %[[LT2]]
-//       CHECK-WRT: }
-//       CHECK-WRT: %[[T3:.*]] = sparse_tensor.load %[[T2:.*]] hasInserts
-//       CHECK-WRT: %[[T4:.*]] = sparse_tensor.convert %[[T3]]
-//       CHECK-WRT: return %[[T4]]
+// CHECK-RWT-LABEL: func.func @sparse_convert_permuted(
+//  CHECK-RWT-SAME: %[[COO:.*]]:
+//   CHECK-RWT-DAG: %[[C0:.*]] = arith.constant 0 : index
+//   CHECK-RWT-DAG: %[[C1:.*]] = arith.constant 1 : index
+//   CHECK-RWT-DAG: %[[C2:.*]] = arith.constant 2 : index
+//       CHECK-RWT: %[[D0:.*]] = tensor.dim %[[COO]], %[[C0]]
+//       CHECK-RWT: %[[D1:.*]] = tensor.dim %[[COO]], %[[C1]]
+//       CHECK-RWT: %[[D2:.*]] = tensor.dim %[[COO]], %[[C2]]
+//       CHECK-RWT: %[[I0:.*]] = sparse_tensor.indices %[[COO]] {dimension = 0 : index}
+//       CHECK-RWT: %[[I1:.*]] = sparse_tensor.indices %[[COO]] {dimension = 1 : index}
+//       CHECK-RWT: %[[I2:.*]] = sparse_tensor.indices %[[COO]] {dimension = 2 : index}
+//       CHECK-RWT: %[[NNZ:.*]] = sparse_tensor.number_of_entries %[[COO]]
+//       CHECK-RWT: %[[V:.*]] = sparse_tensor.values %[[COO]]
+//       CHECK-RWT: sparse_tensor.sort %[[NNZ]], %[[I2]], %[[I0]], %[[I1]] jointly %[[V]]
+//       CHECK-RWT: %[[T1:.*]] = bufferization.alloc_tensor(%[[D0]], %[[D1]], %[[D2]])
+//       CHECK-RWT: %[[T2:.*]] = sparse_tensor.foreach in %[[COO]] init(%[[T1]])
+//       CHECK-RWT: ^bb0(%[[LI0:.*]]: index, %[[LI1:.*]]: index, %[[LI2:.*]]: index, %[[LV:.*]]: f32, %[[LT1:.*]]: tensor<?x?x?xf32,
+//       CHECK-RWT:   %[[LT2:.*]] = sparse_tensor.insert %[[LV]] into %[[LT1]]{{\[}}%[[LI2]], %[[LI0]], %[[LI1]]]
+//       CHECK-RWT:   sparse_tensor.yield %[[LT2]]
+//       CHECK-RWT: }
+//       CHECK-RWT: %[[T3:.*]] = sparse_tensor.load %[[T2:.*]] hasInserts
+//       CHECK-RWT: %[[T4:.*]] = sparse_tensor.convert %[[T3]]
+//       CHECK-RWT: return %[[T4]]
 func.func @sparse_convert_permuted(%arg0: tensor<?x?x?xf32, #SortedCOO3D>) -> tensor<?x?x?xf32, #TsssPermuted> {
   %0 = sparse_tensor.convert %arg0 : tensor<?x?x?xf32, #SortedCOO3D> to tensor<?x?x?xf32, #TsssPermuted>
   return %0 : tensor<?x?x?xf32, #TsssPermuted>