Repository: incubator-systemml
Updated Branches:
  refs/heads/master ea49e620c -> 34845bb68


[SYSTEMML-694] Improved constant folding (all unary, except print/stop)

>From the set of all unary operations, so far only value type casts were
subject to constant folding. With this patch all unary operations other
than print, stop and casts to non-scalars are amenable to constant
folding.

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

Branch: refs/heads/master
Commit: d39e7d64cf5c84c063fb4cb795be0e5e97e83644
Parents: ea49e62
Author: Matthias Boehm <[email protected]>
Authored: Fri May 13 22:51:03 2016 -0700
Committer: Matthias Boehm <[email protected]>
Committed: Sat May 14 00:16:37 2016 -0700

----------------------------------------------------------------------
 .../org/apache/sysml/hops/rewrite/RewriteConstantFolding.java   | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/d39e7d64/src/main/java/org/apache/sysml/hops/rewrite/RewriteConstantFolding.java
----------------------------------------------------------------------
diff --git 
a/src/main/java/org/apache/sysml/hops/rewrite/RewriteConstantFolding.java 
b/src/main/java/org/apache/sysml/hops/rewrite/RewriteConstantFolding.java
index c6fb6b0..e60d9f1 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/RewriteConstantFolding.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/RewriteConstantFolding.java
@@ -27,6 +27,7 @@ import org.apache.sysml.hops.BinaryOp;
 import org.apache.sysml.hops.DataOp;
 import org.apache.sysml.hops.Hop;
 import org.apache.sysml.hops.Hop.DataOpTypes;
+import org.apache.sysml.hops.Hop.OpOp1;
 import org.apache.sysml.hops.Hop.OpOp2;
 import org.apache.sysml.hops.Hop.VisitStatus;
 import org.apache.sysml.hops.HopsException;
@@ -297,7 +298,9 @@ public class RewriteConstantFolding extends HopRewriteRule
                ArrayList<Hop> in = hop.getInput();
                return (   hop instanceof UnaryOp 
                                && in.get(0) instanceof LiteralOp 
-                               && 
HopRewriteUtils.isValueTypeCast(((UnaryOp)hop).getOp()));                    
+                               && ((UnaryOp)hop).getOp() != OpOp1.PRINT 
+                               && ((UnaryOp)hop).getOp() != OpOp1.STOP
+                               && hop.getDataType() == DataType.SCALAR);
        }
        
        /**

Reply via email to