[Mlir-commits] [mlir] 88986d6 - [mlir][sparse] Fix sparse_generate test (#85009)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Mar 12 18:39:41 PDT 2024


Author: Yinying Li
Date: 2024-03-12T21:39:37-04:00
New Revision: 88986d65e4ed1b2ddd6693ff3e70b84436af767a

URL: https://github.com/llvm/llvm-project/commit/88986d65e4ed1b2ddd6693ff3e70b84436af767a
DIFF: https://github.com/llvm/llvm-project/commit/88986d65e4ed1b2ddd6693ff3e70b84436af767a.diff

LOG: [mlir][sparse] Fix sparse_generate test (#85009)

std::uniform_int_distribution may behave differently in different
systems.

Added: 
    

Modified: 
    mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_generate.mlir

Removed: 
    


################################################################################
diff  --git a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_generate.mlir b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_generate.mlir
index e1f73eb4ac4fe6..63a6d3acd737e2 100644
--- a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_generate.mlir
+++ b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_generate.mlir
@@ -78,20 +78,13 @@ module {
     }
 
     %sv = sparse_tensor.convert %output : tensor<?xf64> to tensor<?xf64, #SparseVector>
+    %n0 = sparse_tensor.number_of_entries %sv : tensor<?xf64, #SparseVector>
 
+    // Print the number of non-zeros for verification
+    // as shuffle may generate 
diff erent numbers.
     //
-    // Verify the outputs.
-    //
-    // CHECK:      ---- Sparse Tensor ----
-    // CHECK-NEXT: nse = 5
-    // CHECK-NEXT: dim = ( 50 )
-    // CHECK-NEXT: lvl = ( 50 )
-    // CHECK-NEXT: pos[0] : ( 0, 5
-    // CHECK-NEXT: crd[0] : ( 1, 9, 17, 27, 30
-    // CHECK-NEXT: values : ( 84, 34, 8, 40, 93
-    // CHECK-NEXT: ----
-    //
-    sparse_tensor.print %sv : tensor<?xf64, #SparseVector>
+    // CHECK: 5
+    vector.print %n0 : index
 
     // Release the resources.
     bufferization.dealloc_tensor %sv : tensor<?xf64, #SparseVector>


        


More information about the Mlir-commits mailing list