Skip to content

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

Closed
@PeimingLiu

Description

@PeimingLiu

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) -> ()

Activity

llvmbot

llvmbot commented on Sep 18, 2023

@llvmbot
Member

@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; ()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

mlir:sparseSparse compiler in MLIR

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @bixia1@PeimingLiu@aartbik@llvmbot

      Issue actions

        MLIR Sparsifier sorts unordered COO in a wrong order. · Issue #66664 · llvm/llvm-project