Repository: systemml
Updated Branches:
  refs/heads/master 233b38c14 -> 0f7190c87


[SYSTEMML-2369] Fix nnz propagation in codegen spark cell ops w/o agg

The recent codegen compiler modification in SYSTEMML-2134 revealed a
hidden issue where spark codegen cell operations without aggregation
wrongly propagated the number of non-zeros of the main input into the
output. This led to incorrect results if the main input is empty but the
cell operation is sparse-unsafe. With this patch we only propagate the
dimensions and blocksizes in this scenario.


Project: http://git-wip-us.apache.org/repos/asf/systemml/repo
Commit: http://git-wip-us.apache.org/repos/asf/systemml/commit/0f7190c8
Tree: http://git-wip-us.apache.org/repos/asf/systemml/tree/0f7190c8
Diff: http://git-wip-us.apache.org/repos/asf/systemml/diff/0f7190c8

Branch: refs/heads/master
Commit: 0f7190c8766e4376b1e0da8600c6079bfe993111
Parents: 233b38c
Author: Matthias Boehm <[email protected]>
Authored: Wed Jun 6 21:09:11 2018 -0700
Committer: Matthias Boehm <[email protected]>
Committed: Wed Jun 6 21:09:11 2018 -0700

----------------------------------------------------------------------
 .../runtime/instructions/spark/SpoofSPInstruction.java  | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/systemml/blob/0f7190c8/src/main/java/org/apache/sysml/runtime/instructions/spark/SpoofSPInstruction.java
----------------------------------------------------------------------
diff --git 
a/src/main/java/org/apache/sysml/runtime/instructions/spark/SpoofSPInstruction.java
 
b/src/main/java/org/apache/sysml/runtime/instructions/spark/SpoofSPInstruction.java
index a3e1dfe..15d4de7 100644
--- 
a/src/main/java/org/apache/sysml/runtime/instructions/spark/SpoofSPInstruction.java
+++ 
b/src/main/java/org/apache/sysml/runtime/instructions/spark/SpoofSPInstruction.java
@@ -314,17 +314,15 @@ public class SpoofSPInstruction extends SPInstruction {
        }
        
        private void updateOutputMatrixCharacteristics(SparkExecutionContext 
sec, SpoofOperator op) {
-               if(op instanceof SpoofCellwise)
-               {
+               if(op instanceof SpoofCellwise) {
                        MatrixCharacteristics mcIn = 
sec.getMatrixCharacteristics(_in[0].getName());
                        MatrixCharacteristics mcOut = 
sec.getMatrixCharacteristics(_out.getName());
                        if( ((SpoofCellwise)op).getCellType()==CellType.ROW_AGG 
)
                                mcOut.set(mcIn.getRows(), 1, 
mcIn.getRowsPerBlock(), mcIn.getColsPerBlock());
                        else if( 
((SpoofCellwise)op).getCellType()==CellType.NO_AGG )
-                               mcOut.set(mcIn);
+                               mcOut.set(mcIn.getRows(), mcIn.getCols(), 
mcIn.getRowsPerBlock(), mcIn.getColsPerBlock());
                }
-               else if(op instanceof SpoofOuterProduct)
-               {
+               else if(op instanceof SpoofOuterProduct) {
                        MatrixCharacteristics mcIn1 = 
sec.getMatrixCharacteristics(_in[0].getName()); //X
                        MatrixCharacteristics mcIn2 = 
sec.getMatrixCharacteristics(_in[1].getName()); //U
                        MatrixCharacteristics mcIn3 = 
sec.getMatrixCharacteristics(_in[2].getName()); //V
@@ -333,8 +331,8 @@ public class SpoofSPInstruction extends SPInstruction {
                        
                        if( type == OutProdType.CELLWISE_OUTER_PRODUCT)
                                mcOut.set(mcIn1.getRows(), mcIn1.getCols(), 
mcIn1.getRowsPerBlock(), mcIn1.getColsPerBlock());
-                       else if( type == OutProdType.LEFT_OUTER_PRODUCT)        
        
-                               mcOut.set(mcIn3.getRows(), mcIn3.getCols(), 
mcIn3.getRowsPerBlock(), mcIn3.getColsPerBlock());          
+                       else if( type == OutProdType.LEFT_OUTER_PRODUCT)
+                               mcOut.set(mcIn3.getRows(), mcIn3.getCols(), 
mcIn3.getRowsPerBlock(), mcIn3.getColsPerBlock());
                        else if( type == OutProdType.RIGHT_OUTER_PRODUCT )
                                mcOut.set(mcIn2.getRows(), mcIn2.getCols(), 
mcIn2.getRowsPerBlock(), mcIn2.getColsPerBlock());
                }

Reply via email to