Skip to content

MLIR Sparsifier sorts unordered COO in a wrong order. #66664

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
PeimingLiu opened this issue Sep 18, 2023 · 1 comment
Closed

MLIR Sparsifier sorts unordered COO in a wrong order. #66664

PeimingLiu opened this issue Sep 18, 2023 · 1 comment
Assignees
Labels
mlir:sparse Sparse compiler in MLIR

Comments

@PeimingLiu
Copy link
Member

To reproduce, simply apply the attached patch and run test sparse_rewrite_sort_coo.mlir.

The patch to apply:

diff --git a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_rewrite_sort_coo.mlir b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_rewrite_sort_coo.mlir
index c3bdc30e355b..7e03451f1b8e 100644
--- a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_rewrite_sort_coo.mlir
+++ b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_rewrite_sort_coo.mlir
@@ -99,9 +99,9 @@ module {
     // CHECK: ( 9, 9, 4, 7, 2 )
     // CHECK: ( 7, 8, 10, 9, 6 )
     // CHECK: ( 7, 4, 7, 9, 5 )
-    call @storeValuesToStrided(%x0, %c10, %c2, %c1, %c5, %c1)
+    call @storeValuesToStrided(%x1, %c10, %c2, %c1, %c5, %c1)
       : (memref<?xi32, strided<[4], offset: ?>>, i32, i32, i32, i32, i32) -> ()
-    call @storeValuesToStrided(%x1, %c1, %c1, %c3, %c10, %c3)
+    call @storeValuesToStrided(%x0, %c1, %c1, %c3, %c10, %c3)
       : (memref<?xi32, strided<[4], offset: ?>>, i32, i32, i32, i32, i32) -> ()
     call @storeValuesToStrided(%x2, %c2, %c4, %c9, %c7, %c9)
       : (memref<?xi32, strided<[4], offset: ?>>, i32, i32, i32, i32, i32) -> ()
@@ -127,9 +127,9 @@ module {
     // CHECK: ( 9, 9, 4, 7, 2 )
     // CHECK: ( 8, 7, 10, 9, 6 )
     // CHECK: ( 4, 7, 7, 9, 5 )
-    call @storeValuesToStrided(%x0, %c10, %c2, %c1, %c5, %c1)
+    call @storeValuesToStrided(%x1, %c10, %c2, %c1, %c5, %c1)
       : (memref<?xi32, strided<[4], offset: ?>>, i32, i32, i32, i32, i32) -> ()
-    call @storeValuesToStrided(%x1, %c1, %c1, %c3, %c10, %c3)
+    call @storeValuesToStrided(%x0, %c1, %c1, %c3, %c10, %c3)
       : (memref<?xi32, strided<[4], offset: ?>>, i32, i32, i32, i32, i32) -> ()
     call @storeValuesToStrided(%x2, %c2, %c4, %c9, %c7, %c9)
       : (memref<?xi32, strided<[4], offset: ?>>, i32, i32, i32, i32, i32) -> ()
@PeimingLiu PeimingLiu added the mlir:sparse Sparse compiler in MLIR label Sep 18, 2023
@llvmbot
Copy link
Member

llvmbot commented Sep 18, 2023

@llvm/issue-subscribers-mlir-sparse

To reproduce, simply apply the attached patch and run test `sparse_rewrite_sort_coo.mlir`.

The patch to apply:

diff --git a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_rewrite_sort_coo.mlir b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_rewrite_sort_coo.mlir
index c3bdc30e355b..7e03451f1b8e 100644
--- a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_rewrite_sort_coo.mlir
+++ b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_rewrite_sort_coo.mlir
@@ -99,9 +99,9 @@ module {
     // CHECK: ( 9, 9, 4, 7, 2 )
     // CHECK: ( 7, 8, 10, 9, 6 )
     // CHECK: ( 7, 4, 7, 9, 5 )
-    call @<!-- -->storeValuesToStrided(%x0, %c10, %c2, %c1, %c5, %c1)
+    call @<!-- -->storeValuesToStrided(%x1, %c10, %c2, %c1, %c5, %c1)
       : (memref&lt;?xi32, strided&lt;[4], offset: ?&gt;&gt;, i32, i32, i32, i32, i32) -&gt; ()
-    call @<!-- -->storeValuesToStrided(%x1, %c1, %c1, %c3, %c10, %c3)
+    call @<!-- -->storeValuesToStrided(%x0, %c1, %c1, %c3, %c10, %c3)
       : (memref&lt;?xi32, strided&lt;[4], offset: ?&gt;&gt;, i32, i32, i32, i32, i32) -&gt; ()
     call @<!-- -->storeValuesToStrided(%x2, %c2, %c4, %c9, %c7, %c9)
       : (memref&lt;?xi32, strided&lt;[4], offset: ?&gt;&gt;, i32, i32, i32, i32, i32) -&gt; ()
@@ -127,9 +127,9 @@ module {
     // CHECK: ( 9, 9, 4, 7, 2 )
     // CHECK: ( 8, 7, 10, 9, 6 )
     // CHECK: ( 4, 7, 7, 9, 5 )
-    call @<!-- -->storeValuesToStrided(%x0, %c10, %c2, %c1, %c5, %c1)
+    call @<!-- -->storeValuesToStrided(%x1, %c10, %c2, %c1, %c5, %c1)
       : (memref&lt;?xi32, strided&lt;[4], offset: ?&gt;&gt;, i32, i32, i32, i32, i32) -&gt; ()
-    call @<!-- -->storeValuesToStrided(%x1, %c1, %c1, %c3, %c10, %c3)
+    call @<!-- -->storeValuesToStrided(%x0, %c1, %c1, %c3, %c10, %c3)
       : (memref&lt;?xi32, strided&lt;[4], offset: ?&gt;&gt;, i32, i32, i32, i32, i32) -&gt; ()
     call @<!-- -->storeValuesToStrided(%x2, %c2, %c4, %c9, %c7, %c9)
       : (memref&lt;?xi32, strided&lt;[4], offset: ?&gt;&gt;, i32, i32, i32, i32, i32) -&gt; ()

PeimingLiu added a commit that referenced this issue Sep 18, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
To fix issue: #66664
ZijunZhaoCCK pushed a commit to ZijunZhaoCCK/llvm-project that referenced this issue Sep 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mlir:sparse Sparse compiler in MLIR
Projects
None yet
Development

No branches or pull requests

4 participants