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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Mar 12 18:30:46 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir-sparse

Author: Yinying Li (yinying-lisa-li)

<details>
<summary>Changes</summary>

std::uniform_int_distribution may behave differently in different system.

---
Full diff: https://github.com/llvm/llvm-project/pull/85009.diff


1 Files Affected:

- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_generate.mlir (+5-12) 


``````````diff
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 different 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>

``````````

</details>


https://github.com/llvm/llvm-project/pull/85009


More information about the Mlir-commits mailing list