This is an automated email from the ASF dual-hosted git repository.

mboehm7 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/systemds.git


The following commit(s) were added to refs/heads/main by this push:
     new 9f82e9f675 [SYSTEMDS-3668] Fix ultra-sparse tsmm for CSR sparse blocks
9f82e9f675 is described below

commit 9f82e9f675c567c7f80360f3814e3a19138d7a62
Author: Matthias Boehm <[email protected]>
AuthorDate: Wed Jan 24 22:36:55 2024 +0100

    [SYSTEMDS-3668] Fix ultra-sparse tsmm for CSR sparse blocks
    
    There were flaky component tests, which originated from the shared
    matrix blocks being converted from MCSR to CSR and then the new
    ultra-sparse tsmm failing due to incorrect index handling.
    This patch generalizes the tsmm implementation for all sparse blocks.
---
 .../java/org/apache/sysds/runtime/matrix/data/LibMatrixMult.java  | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git 
a/src/main/java/org/apache/sysds/runtime/matrix/data/LibMatrixMult.java 
b/src/main/java/org/apache/sysds/runtime/matrix/data/LibMatrixMult.java
index bafdeba18b..96c75cecdc 100644
--- a/src/main/java/org/apache/sysds/runtime/matrix/data/LibMatrixMult.java
+++ b/src/main/java/org/apache/sysds/runtime/matrix/data/LibMatrixMult.java
@@ -451,11 +451,14 @@ public class LibMatrixMult
                matrixMultTransposeSelf(m1, m1t, ret, leftTranspose, 0, 
ret.rlen);
 
                //post-processing
-               if(copyToLowerTriangle){
+               if(copyToLowerTriangle) {
                        long nnz = copyUpperToLowerTriangle(ret);
                        ret.setNonZeros(nnz);
                        ret.examSparsity();
                }
+               else {
+                       ret.recomputeNonZeros();
+               }
                
                //System.out.println("TSMM 
("+m1.isInSparseFormat()+","+m1.getNumRows()+","+m1.getNumColumns()+","+m1.getNonZeros()+","+leftTranspose+")
 in "+time.stop());
        }
@@ -2600,8 +2603,9 @@ public class LibMatrixMult
                                int[] bix = b.indexes(aixk);
                                double[] bvals = b.values(aixk);
                                //sparse updates for ultra-sparse output
-                               for(int k2 = bpos2; k2<bpos+blen; k2++)
+                               for(int k2 = bpos+bpos2; k2<bpos+blen; k2++) {
                                        c.add(i, bix[k2], aval*bvals[k2]);
+                               }
                        }
                }
        }

Reply via email to