[MINOR] Improved analysis for sparse-safe codegen cell operations

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

Branch: refs/heads/master
Commit: f2fbd99e7d78eb27a560b3095c9db5565f625e95
Parents: 03c050d
Author: Matthias Boehm <mboe...@gmail.com>
Authored: Thu Feb 22 18:30:30 2018 -0800
Committer: Matthias Boehm <mboe...@gmail.com>
Committed: Thu Feb 22 18:30:30 2018 -0800

----------------------------------------------------------------------
 src/main/java/org/apache/sysml/hops/OptimizerUtils.java        | 1 +
 .../org/apache/sysml/hops/codegen/template/TemplateUtils.java  | 6 ++++--
 2 files changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/systemml/blob/f2fbd99e/src/main/java/org/apache/sysml/hops/OptimizerUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/OptimizerUtils.java 
b/src/main/java/org/apache/sysml/hops/OptimizerUtils.java
index 3a406fc..d56692c 100644
--- a/src/main/java/org/apache/sysml/hops/OptimizerUtils.java
+++ b/src/main/java/org/apache/sysml/hops/OptimizerUtils.java
@@ -1038,6 +1038,7 @@ public class OptimizerUtils
                                ||(op==OpOp2.EQUAL    && val!=0)
                                ||(op==OpOp2.MINUS    && val==0)
                                ||(op==OpOp2.PLUS     && val==0)
+                               ||(op==OpOp2.POW      && val!=0)
                                ||(op==OpOp2.MAX      && val<=0)
                                ||(op==OpOp2.MIN      && val>=0));
        }

http://git-wip-us.apache.org/repos/asf/systemml/blob/f2fbd99e/src/main/java/org/apache/sysml/hops/codegen/template/TemplateUtils.java
----------------------------------------------------------------------
diff --git 
a/src/main/java/org/apache/sysml/hops/codegen/template/TemplateUtils.java 
b/src/main/java/org/apache/sysml/hops/codegen/template/TemplateUtils.java
index 1f8151e..b833876 100644
--- a/src/main/java/org/apache/sysml/hops/codegen/template/TemplateUtils.java
+++ b/src/main/java/org/apache/sysml/hops/codegen/template/TemplateUtils.java
@@ -257,8 +257,10 @@ public class TemplateUtils
        
        public static boolean rIsSparseSafeOnly(CNode node, BinType...types) {
                if( !(isBinary(node, types) || node instanceof CNodeData 
-                       || (node instanceof CNodeUnary && 
((CNodeUnary)node).getType().isScalarLookup())
-                       || (node instanceof CNodeUnary && 
((CNodeUnary)node).getType().isSparseSafeScalar())) )
+                       || (node instanceof CNodeUnary && 
((((CNodeUnary)node).getType().isScalarLookup())
+                               || 
((CNodeUnary)node).getType().isSparseSafeScalar()
+                               || ((CNodeUnary)node).getType()==UnaryType.POW2
+                               || 
((CNodeUnary)node).getType()==UnaryType.MULT2)) ))
                        return false;
                boolean ret = true;
                for( CNode c : node.getInput() )

Reply via email to