You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@systemml.apache.org by mb...@apache.org on 2017/03/06 03:32:56 UTC
[2/2] incubator-systemml git commit: [MINOR] Cleanup hop visit status
and its usage, remove hop print
[MINOR] Cleanup hop visit status and its usage, remove hop print
The hop visit status - used for memoization on dag traversal - was
originally multi-valued but later reduced to binary states. This patch
replaces the visit status with a simple boolean variable which
simplifies its usage. Furthermore, this patch also removes the hop
printme debug output as it's superseded by the hop explain.
Project: http://git-wip-us.apache.org/repos/asf/incubator-systemml/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-systemml/commit/8936e4f8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-systemml/tree/8936e4f8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-systemml/diff/8936e4f8
Branch: refs/heads/master
Commit: 8936e4f8a2c58261bc685b2921cf19c9cfc90bdd
Parents: e449cae
Author: Matthias Boehm <mb...@gmail.com>
Authored: Sat Mar 4 21:28:57 2017 -0800
Committer: Matthias Boehm <mb...@gmail.com>
Committed: Sat Mar 4 21:28:57 2017 -0800
----------------------------------------------------------------------
.../java/org/apache/sysml/api/DMLScript.java | 23 ----
.../java/org/apache/sysml/hops/AggBinaryOp.java | 17 ---
.../java/org/apache/sysml/hops/AggUnaryOp.java | 14 ---
.../java/org/apache/sysml/hops/BinaryOp.java | 14 ---
.../org/apache/sysml/hops/ConvolutionOp.java | 16 ---
.../java/org/apache/sysml/hops/DataGenOp.java | 13 --
src/main/java/org/apache/sysml/hops/DataOp.java | 17 ---
src/main/java/org/apache/sysml/hops/Hop.java | 66 +++-------
.../java/org/apache/sysml/hops/IndexingOp.java | 10 --
.../org/apache/sysml/hops/LeftIndexingOp.java | 11 --
.../java/org/apache/sysml/hops/LiteralOp.java | 31 -----
.../java/org/apache/sysml/hops/MemoTable.java | 5 +-
.../java/org/apache/sysml/hops/MultipleOp.java | 13 --
.../sysml/hops/ParameterizedBuiltinOp.java | 13 --
.../org/apache/sysml/hops/QuaternaryOp.java | 13 --
.../java/org/apache/sysml/hops/ReorgOp.java | 16 ---
.../java/org/apache/sysml/hops/TernaryOp.java | 13 --
.../java/org/apache/sysml/hops/UnaryOp.java | 13 --
.../sysml/hops/globalopt/GDFEnumOptimizer.java | 3 +-
.../sysml/hops/ipa/InterProceduralAnalysis.java | 21 ++--
.../hops/recompile/LiteralReplacement.java | 5 +-
.../apache/sysml/hops/recompile/Recompiler.java | 21 ++--
.../sysml/hops/rewrite/HopDagValidator.java | 4 +-
.../sysml/hops/rewrite/HopRewriteUtils.java | 9 +-
.../RewriteAlgebraicSimplificationDynamic.java | 4 +-
.../RewriteAlgebraicSimplificationStatic.java | 4 +-
.../rewrite/RewriteBlockSizeAndReblock.java | 4 +-
.../RewriteCommonSubexpressionElimination.java | 8 +-
.../hops/rewrite/RewriteCompressedReblock.java | 4 +-
.../hops/rewrite/RewriteConstantFolding.java | 5 +-
.../rewrite/RewriteIndexingVectorization.java | 4 +-
.../RewriteInjectSparkPReadCheckpointing.java | 4 +-
.../RewriteMatrixMultChainOptimization.java | 12 +-
.../RewriteRemovePersistentReadWrite.java | 5 +-
.../rewrite/RewriteRemoveReadAfterWrite.java | 4 +-
.../rewrite/RewriteRemoveUnnecessaryCasts.java | 5 +-
.../RewriteSplitDagDataDependentOperators.java | 29 +++--
.../rewrite/RewriteSplitDagUnknownCSVRead.java | 5 +-
.../org/apache/sysml/parser/DMLTranslator.java | 102 ---------------
.../parfor/opt/OptTreeConverter.java | 5 +-
.../parfor/opt/OptTreePlanChecker.java | 5 +-
.../parfor/opt/OptimizerRuleBased.java | 124 +++++++++----------
.../parfor/opt/ProgramRecompiler.java | 9 +-
.../java/org/apache/sysml/utils/Explain.java | 8 +-
.../sysml/yarn/ropt/GridEnumerationMemory.java | 4 +-
.../sysml/yarn/ropt/ResourceOptimizer.java | 6 +-
46 files changed, 167 insertions(+), 574 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/8936e4f8/src/main/java/org/apache/sysml/api/DMLScript.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/api/DMLScript.java b/src/main/java/org/apache/sysml/api/DMLScript.java
index 25c03ea..97597e0 100644
--- a/src/main/java/org/apache/sysml/api/DMLScript.java
+++ b/src/main/java/org/apache/sysml/api/DMLScript.java
@@ -587,28 +587,11 @@ public class DMLScript
dmlt.validateParseTree(prog);
dmlt.constructHops(prog);
- if (LOG.isDebugEnabled()) {
- LOG.debug("\n********************** HOPS DAG (Before Rewrite) *******************");
- dmlt.printHops(prog);
- DMLTranslator.resetHopsDAGVisitStatus(prog);
- }
-
//init working directories (before usage by following compilation steps)
initHadoopExecution( dmlconf );
//Step 5: rewrite HOP DAGs (incl IPA and memory estimates)
dmlt.rewriteHopsDAG(prog);
-
- if (LOG.isDebugEnabled()) {
- LOG.debug("\n********************** HOPS DAG (After Rewrite) *******************");
- dmlt.printHops(prog);
- DMLTranslator.resetHopsDAGVisitStatus(prog);
-
- LOG.debug("\n********************** OPTIMIZER *******************\n" +
- "Level = " + OptimizerUtils.getOptLevel() + "\n"
- +"Available Memory = " + ((double)InfrastructureAnalyzer.getLocalMaxMemory()/1024/1024) + " MB" + "\n"
- +"Memory Budget = " + ((double)OptimizerUtils.getLocalMemBudget()/1024/1024) + " MB" + "\n");
- }
//Step 5.1: Generate code for the rewrited Hop dags
if( dmlconf.getBooleanValue(DMLConfig.CODEGEN) ){
@@ -616,12 +599,6 @@ public class DMLScript
SpoofCompiler.ALWAYS_COMPILE_LITERALS = (dmlconf.getIntValue(DMLConfig.CODEGEN_LITERALS)==2);
dmlt.codgenHopsDAG(prog);
-
- if (LOG.isDebugEnabled()) {
- LOG.debug("\n********************** HOPS DAG (After Codegen) *******************");
- dmlt.printHops(prog);
-
- }
}
//Step 6: construct lops (incl exec type and op selection)
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/8936e4f8/src/main/java/org/apache/sysml/hops/AggBinaryOp.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/AggBinaryOp.java b/src/main/java/org/apache/sysml/hops/AggBinaryOp.java
index dd9182d..ac17ef2 100644
--- a/src/main/java/org/apache/sysml/hops/AggBinaryOp.java
+++ b/src/main/java/org/apache/sysml/hops/AggBinaryOp.java
@@ -282,23 +282,6 @@ public class AggBinaryOp extends Hop implements MultiThreadedHop
HopsOpOp2String.get(innerOp)+")";
return s;
}
-
- public void printMe() throws HopsException {
- if (LOG.isDebugEnabled()){
- if (getVisited() != VisitStatus.DONE) {
- super.printMe();
- LOG.debug(" InnerOperation: " + innerOp);
- LOG.debug(" OuterOperation: " + outerOp);
- for (Hop h : getInput()) {
- h.printMe();
- }
- ;
- }
- setVisited(VisitStatus.DONE);
- }
- }
-
-
@Override
public void computeMemEstimate(MemoTable memo)
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/8936e4f8/src/main/java/org/apache/sysml/hops/AggUnaryOp.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/AggUnaryOp.java b/src/main/java/org/apache/sysml/hops/AggUnaryOp.java
index fce424c..70a71bc 100644
--- a/src/main/java/org/apache/sysml/hops/AggUnaryOp.java
+++ b/src/main/java/org/apache/sysml/hops/AggUnaryOp.java
@@ -313,20 +313,6 @@ public class AggUnaryOp extends Hop implements MultiThreadedHop
HopsDirection2String.get(_direction) + ")";
return s;
}
-
- public void printMe() throws HopsException {
- if (LOG.isDebugEnabled()){
- if (getVisited() != VisitStatus.DONE) {
- super.printMe();
- LOG.debug(" Operation: " + _op);
- LOG.debug(" Direction: " + _direction);
- for (Hop h : getInput()) {
- h.printMe();
- }
- }
- setVisited(VisitStatus.DONE);
- }
- }
@Override
public boolean allowsAllExecTypes()
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/8936e4f8/src/main/java/org/apache/sysml/hops/BinaryOp.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/BinaryOp.java b/src/main/java/org/apache/sysml/hops/BinaryOp.java
index f1e6aaf..7ddc656 100644
--- a/src/main/java/org/apache/sysml/hops/BinaryOp.java
+++ b/src/main/java/org/apache/sysml/hops/BinaryOp.java
@@ -756,20 +756,6 @@ public class BinaryOp extends Hop
return s;
}
- public void printMe() throws HopsException {
- if (LOG.isDebugEnabled()){
- if (getVisited() != VisitStatus.DONE) {
- super.printMe();
- LOG.debug(" Operation: " + op );
- for (Hop h : getInput()) {
- h.printMe();
- }
- ;
- }
- setVisited(VisitStatus.DONE);
- }
- }
-
@Override
protected double computeOutputMemEstimate( long dim1, long dim2, long nnz )
{
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/8936e4f8/src/main/java/org/apache/sysml/hops/ConvolutionOp.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/ConvolutionOp.java b/src/main/java/org/apache/sysml/hops/ConvolutionOp.java
index 7751999..a13de52 100644
--- a/src/main/java/org/apache/sysml/hops/ConvolutionOp.java
+++ b/src/main/java/org/apache/sysml/hops/ConvolutionOp.java
@@ -505,22 +505,6 @@ public class ConvolutionOp extends Hop implements MultiThreadedHop
return ret;
}
-
-
- @Override
- public void printMe() throws HopsException
- {
- if (LOG.isDebugEnabled()){
- if (getVisited() != VisitStatus.DONE) {
- super.printMe();
- LOG.debug(" Operation: " + op);
- for (Hop h : getInput()) {
- h.printMe();
- }
- }
- setVisited(VisitStatus.DONE);
- }
- }
@Override
public void setMaxNumThreads( int k ) {
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/8936e4f8/src/main/java/org/apache/sysml/hops/DataGenOp.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/DataGenOp.java b/src/main/java/org/apache/sysml/hops/DataGenOp.java
index c9eecb7..64948c9 100644
--- a/src/main/java/org/apache/sysml/hops/DataGenOp.java
+++ b/src/main/java/org/apache/sysml/hops/DataGenOp.java
@@ -176,19 +176,6 @@ public class DataGenOp extends Hop implements MultiThreadedHop
return getLops();
}
-
- @Override
- public void printMe() throws HopsException
- {
- if (LOG.isDebugEnabled()){
- if(getVisited() != VisitStatus.DONE)
- {
- super.printMe();
- }
-
- setVisited(VisitStatus.DONE);
- }
- }
@Override
public boolean allowsAllExecTypes()
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/8936e4f8/src/main/java/org/apache/sysml/hops/DataOp.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/DataOp.java b/src/main/java/org/apache/sysml/hops/DataOp.java
index 85d1692..36e72f3 100644
--- a/src/main/java/org/apache/sysml/hops/DataOp.java
+++ b/src/main/java/org/apache/sysml/hops/DataOp.java
@@ -334,23 +334,6 @@ public class DataOp extends Hop
return s;
}
- public void printMe() throws HopsException {
- if (LOG.isDebugEnabled()){
- if (getVisited() != VisitStatus.DONE) {
- super.printMe();
- LOG.debug(" DataOp: " + _dataop);
- if (_fileName != null) {
- LOG.debug(" file: " + _fileName);
- }
- LOG.debug(" format: " + getInputFormatType());
- for (Hop h : getInput()) {
- h.printMe();
- }
- }
- setVisited(VisitStatus.DONE);
- }
- }
-
@Override
public boolean allowsAllExecTypes()
{
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/8936e4f8/src/main/java/org/apache/sysml/hops/Hop.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/Hop.java b/src/main/java/org/apache/sysml/hops/Hop.java
index 4021a1a..75b24de 100644
--- a/src/main/java/org/apache/sysml/hops/Hop.java
+++ b/src/main/java/org/apache/sysml/hops/Hop.java
@@ -55,11 +55,6 @@ public abstract class Hop
public static final long CPThreshold = 2000;
- public enum VisitStatus {
- DONE,
- NOTVISITED
- }
-
/**
* Optional hop interface, to be implemented by multi-threaded hops.
*/
@@ -75,7 +70,7 @@ public abstract class Hop
protected String _name;
protected DataType _dataType;
protected ValueType _valueType;
- protected VisitStatus _visited = VisitStatus.NOTVISITED;
+ protected boolean _visited = false;
protected long _dim1 = -1;
protected long _dim2 = -1;
protected long _rows_in_block = -1;
@@ -731,12 +726,12 @@ public abstract class Hop
* @param memo memory table
*/
public void refreshMemEstimates( MemoTable memo ) {
- if (getVisited() == VisitStatus.DONE)
+ if( isVisited() )
return;
- for (Hop h : this.getInput())
+ for( Hop h : this.getInput() )
h.refreshMemEstimates( memo );
- this.computeMemEstimate( memo );
- this.setVisited(VisitStatus.DONE);
+ computeMemEstimate( memo );
+ setVisited();
}
/**
@@ -861,22 +856,18 @@ public abstract class Hop
&& (_dim1 > 0 || _dim2 > 0)) );
}
- public static void resetVisitStatus( ArrayList<Hop> hops )
- {
+ public static void resetVisitStatus( ArrayList<Hop> hops ) {
if( hops != null )
for( Hop hopRoot : hops )
hopRoot.resetVisitStatus();
}
- public void resetVisitStatus()
- {
- if ( getVisited() == Hop.VisitStatus.NOTVISITED )
+ public void resetVisitStatus() {
+ if( !isVisited() )
return;
-
- for (Hop h : this.getInput())
- h.resetVisitStatus();
-
- setVisited(Hop.VisitStatus.NOTVISITED);
+ for( Hop h : this.getInput() )
+ h.resetVisitStatus();
+ setVisited(false);
}
public static void resetRecompilationFlag( ArrayList<Hop> hops, ExecType et )
@@ -894,7 +885,7 @@ public abstract class Hop
private void resetRecompilationFlag( ExecType et )
{
- if( getVisited() == VisitStatus.DONE )
+ if( isVisited() )
return;
//process child hops
@@ -905,28 +896,7 @@ public abstract class Hop
if( et == null || getExecType() == et || getExecType()==null )
_requiresRecompile = false;
- this.setVisited(VisitStatus.DONE);
- }
-
- public void printMe() throws HopsException {
- if (LOG.isDebugEnabled()) {
- StringBuilder s = new StringBuilder("");
- s.append(getClass().getSimpleName() + " " + getHopID() + "\n");
- s.append(" Label: " + getName() + "; DataType: " + _dataType + "; ValueType: " + _valueType + "\n");
- s.append(" Parent: ");
- for (Hop h : getParent()) {
- s.append(h.hashCode() + "; ");
- }
- ;
- s.append("\n Input: ");
- for (Hop h : getInput()) {
- s.append(h.getHopID() + "; ");
- }
-
- s.append("\n dims [" + _dim1 + "," + _dim2 + "] blk [" + _rows_in_block + "," + _cols_in_block + "] nnz: " + _nnz + " UpdateInPlace: " + _updateType);
- s.append(" MemEstimate = Out " + (_outputMemEstimate/1024/1024) + " MB, In&Out " + (_memEstimate/1024/1024) + " MB" );
- LOG.debug(s.toString());
- }
+ setVisited();
}
public long getDim1() {
@@ -960,7 +930,7 @@ public abstract class Hop
_lops = lops;
}
- public VisitStatus getVisited() {
+ public boolean isVisited() {
return _visited;
}
@@ -972,8 +942,12 @@ public abstract class Hop
_dataType = dt;
}
- public void setVisited(VisitStatus visited) {
- _visited = visited;
+ public void setVisited() {
+ setVisited(true);
+ }
+
+ public void setVisited(boolean flag) {
+ _visited = flag;
}
public void setName(String _name) {
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/8936e4f8/src/main/java/org/apache/sysml/hops/IndexingOp.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/IndexingOp.java b/src/main/java/org/apache/sysml/hops/IndexingOp.java
index 9437cef..7edbbea 100644
--- a/src/main/java/org/apache/sysml/hops/IndexingOp.java
+++ b/src/main/java/org/apache/sysml/hops/IndexingOp.java
@@ -193,16 +193,6 @@ public class IndexingOp extends Hop
s += OPSTRING;
return s;
}
-
- public void printMe() throws HopsException {
- if (getVisited() != VisitStatus.DONE) {
- super.printMe();
- for (Hop h : getInput()) {
- h.printMe();
- }
- }
- setVisited(VisitStatus.DONE);
- }
@Override
public boolean allowsAllExecTypes()
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/8936e4f8/src/main/java/org/apache/sysml/hops/LeftIndexingOp.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/LeftIndexingOp.java b/src/main/java/org/apache/sysml/hops/LeftIndexingOp.java
index c82d63a..89c025b 100644
--- a/src/main/java/org/apache/sysml/hops/LeftIndexingOp.java
+++ b/src/main/java/org/apache/sysml/hops/LeftIndexingOp.java
@@ -257,17 +257,6 @@ public class LeftIndexingOp extends Hop
return s;
}
- public void printMe() throws HopsException {
- if (getVisited() != VisitStatus.DONE) {
- super.printMe();
- for (Hop h : getInput()) {
- h.printMe();
- }
- ;
- }
- setVisited(VisitStatus.DONE);
- }
-
@Override
public boolean allowsAllExecTypes()
{
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/8936e4f8/src/main/java/org/apache/sysml/hops/LiteralOp.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/LiteralOp.java b/src/main/java/org/apache/sysml/hops/LiteralOp.java
index 107bf28..835b7ab 100644
--- a/src/main/java/org/apache/sysml/hops/LiteralOp.java
+++ b/src/main/java/org/apache/sysml/hops/LiteralOp.java
@@ -107,37 +107,6 @@ public class LiteralOp extends Hop
return getLops();
}
- public void printMe() throws HopsException {
- if (LOG.isDebugEnabled()){
- if (getVisited() != VisitStatus.DONE) {
- super.printMe();
- switch (getValueType()) {
- case DOUBLE:
- LOG.debug(" Value: " + value_double);
- break;
- case BOOLEAN:
- LOG.debug(" Value: " + value_boolean);
- break;
- case STRING:
- LOG.debug(" Value: " + value_string);
- break;
- case INT:
- LOG.debug(" Value: " + value_long);
- break;
- default:
- throw new HopsException(this.printErrorLocation() +
- "unexpected value type printing LiteralOp.\n");
- }
-
- for (Hop h : getInput()) {
- h.printMe();
- }
-
- }
- setVisited(VisitStatus.DONE);
- }
- }
-
@Override
public String getOpString() {
String val = null;
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/8936e4f8/src/main/java/org/apache/sysml/hops/MemoTable.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/MemoTable.java b/src/main/java/org/apache/sysml/hops/MemoTable.java
index 83a29d3..94368ee 100644
--- a/src/main/java/org/apache/sysml/hops/MemoTable.java
+++ b/src/main/java/org/apache/sysml/hops/MemoTable.java
@@ -23,7 +23,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import org.apache.sysml.hops.Hop.DataOpTypes;
-import org.apache.sysml.hops.Hop.VisitStatus;
import org.apache.sysml.hops.recompile.RecompileStatus;
import org.apache.sysml.parser.Expression.DataType;
import org.apache.sysml.runtime.matrix.MatrixCharacteristics;
@@ -186,7 +185,7 @@ public class MemoTable
private void rinit(Hop hop, RecompileStatus status)
{
- if( hop.getVisited() == VisitStatus.DONE )
+ if( hop.isVisited() )
return;
//probe status of previous twrites
@@ -203,7 +202,7 @@ public class MemoTable
for( Hop c : hop.getInput() )
rinit( c, status );
- hop.setVisited(VisitStatus.DONE);
+ hop.setVisited();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/8936e4f8/src/main/java/org/apache/sysml/hops/MultipleOp.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/MultipleOp.java b/src/main/java/org/apache/sysml/hops/MultipleOp.java
index d850b8a..07e1bd1 100644
--- a/src/main/java/org/apache/sysml/hops/MultipleOp.java
+++ b/src/main/java/org/apache/sysml/hops/MultipleOp.java
@@ -75,19 +75,6 @@ public class MultipleOp extends Hop {
return multipleOperandOperation;
}
- public void printMe() throws HopsException {
- if (LOG.isDebugEnabled()) {
- if (getVisited() != VisitStatus.DONE) {
- super.printMe();
- LOG.debug(" Operation: " + multipleOperandOperation);
- for (Hop h : getInput()) {
- h.printMe();
- }
- }
- setVisited(VisitStatus.DONE);
- }
- }
-
@Override
public String getOpString() {
return "m(" + multipleOperandOperation.toString().toLowerCase() + ")";
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/8936e4f8/src/main/java/org/apache/sysml/hops/ParameterizedBuiltinOp.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/ParameterizedBuiltinOp.java b/src/main/java/org/apache/sysml/hops/ParameterizedBuiltinOp.java
index 72e9115..fa51948 100644
--- a/src/main/java/org/apache/sysml/hops/ParameterizedBuiltinOp.java
+++ b/src/main/java/org/apache/sysml/hops/ParameterizedBuiltinOp.java
@@ -802,19 +802,6 @@ public class ParameterizedBuiltinOp extends Hop implements MultiThreadedHop
setLops(finalagg);
}
}
-
-
- @Override
- public void printMe() throws HopsException {
- if (LOG.isDebugEnabled()){
- if (getVisited() != VisitStatus.DONE) {
- super.printMe();
- LOG.debug(" " + _op);
- }
-
- setVisited(VisitStatus.DONE);
- }
- }
@Override
protected double computeOutputMemEstimate( long dim1, long dim2, long nnz )
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/8936e4f8/src/main/java/org/apache/sysml/hops/QuaternaryOp.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/QuaternaryOp.java b/src/main/java/org/apache/sysml/hops/QuaternaryOp.java
index 888cff9..2549526 100644
--- a/src/main/java/org/apache/sysml/hops/QuaternaryOp.java
+++ b/src/main/java/org/apache/sysml/hops/QuaternaryOp.java
@@ -286,19 +286,6 @@ public class QuaternaryOp extends Hop implements MultiThreadedHop
return s;
}
- public void printMe() throws HopsException {
- if (LOG.isDebugEnabled()){
- if (getVisited() != VisitStatus.DONE) {
- super.printMe();
- LOG.debug(" Operation: " + _op);
- for (Hop h : getInput()) {
- h.printMe();
- }
- }
- setVisited(VisitStatus.DONE);
- }
- }
-
@Override
public boolean allowsAllExecTypes()
{
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/8936e4f8/src/main/java/org/apache/sysml/hops/ReorgOp.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/ReorgOp.java b/src/main/java/org/apache/sysml/hops/ReorgOp.java
index 8d0b4b4..1ca2463 100644
--- a/src/main/java/org/apache/sysml/hops/ReorgOp.java
+++ b/src/main/java/org/apache/sysml/hops/ReorgOp.java
@@ -647,22 +647,6 @@ public class ReorgOp extends Hop implements MultiThreadedHop
return ret;
}
-
-
- @Override
- public void printMe() throws HopsException
- {
- if (LOG.isDebugEnabled()){
- if (getVisited() != VisitStatus.DONE) {
- super.printMe();
- LOG.debug(" Operation: " + op);
- for (Hop h : getInput()) {
- h.printMe();
- }
- }
- setVisited(VisitStatus.DONE);
- }
- }
/**
* This will check if there is sufficient memory locally (twice the size of second matrix, for original and sort data), and remotely (size of second matrix (sorted data)).
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/8936e4f8/src/main/java/org/apache/sysml/hops/TernaryOp.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/TernaryOp.java b/src/main/java/org/apache/sysml/hops/TernaryOp.java
index b8be594..ec863c4 100644
--- a/src/main/java/org/apache/sysml/hops/TernaryOp.java
+++ b/src/main/java/org/apache/sysml/hops/TernaryOp.java
@@ -687,19 +687,6 @@ public class TernaryOp extends Hop
return s;
}
- public void printMe() throws HopsException {
- if (LOG.isDebugEnabled()){
- if (getVisited() != VisitStatus.DONE) {
- super.printMe();
- LOG.debug(" Operation: " + _op);
- for (Hop h : getInput()) {
- h.printMe();
- }
- }
- setVisited(VisitStatus.DONE);
- }
- }
-
@Override
public boolean allowsAllExecTypes()
{
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/8936e4f8/src/main/java/org/apache/sysml/hops/UnaryOp.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/UnaryOp.java b/src/main/java/org/apache/sysml/hops/UnaryOp.java
index dd2a634..ac306b3 100644
--- a/src/main/java/org/apache/sysml/hops/UnaryOp.java
+++ b/src/main/java/org/apache/sysml/hops/UnaryOp.java
@@ -78,19 +78,6 @@ public class UnaryOp extends Hop implements MultiThreadedHop
public OpOp1 getOp() {
return _op;
}
-
- public void printMe() throws HopsException {
- if (LOG.isDebugEnabled()){
- if (getVisited() != VisitStatus.DONE) {
- super.printMe();
- LOG.debug(" Operation: " + _op);
- for (Hop h : getInput()) {
- h.printMe();
- }
- }
- setVisited(VisitStatus.DONE);
- }
- }
@Override
public String getOpString() {
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/8936e4f8/src/main/java/org/apache/sysml/hops/globalopt/GDFEnumOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/globalopt/GDFEnumOptimizer.java b/src/main/java/org/apache/sysml/hops/globalopt/GDFEnumOptimizer.java
index f0e5cdb..82a3376 100644
--- a/src/main/java/org/apache/sysml/hops/globalopt/GDFEnumOptimizer.java
+++ b/src/main/java/org/apache/sysml/hops/globalopt/GDFEnumOptimizer.java
@@ -28,7 +28,6 @@ import org.apache.sysml.conf.ConfigurationManager;
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.VisitStatus;
import org.apache.sysml.hops.HopsException;
import org.apache.sysml.hops.Hop.FileFormatTypes;
import org.apache.sysml.hops.OptimizerUtils;
@@ -451,7 +450,7 @@ public class GDFEnumOptimizer extends GlobalOptimizer
if( !(currentHop instanceof DataOp && ((DataOp)currentHop).isWrite()) ){
ArrayList<Hop> newRoots = new ArrayList<Hop>();
tmpHop = new DataOp("_tmp", currentHop.getDataType(), currentHop.getValueType(), currentHop, DataOpTypes.TRANSIENTWRITE, "tmp");
- tmpHop.setVisited(VisitStatus.DONE); //ensure recursive visitstatus reset on recompile
+ tmpHop.setVisited(); //ensure recursive visitstatus reset on recompile
newRoots.add(tmpHop);
pb.getStatementBlock().set_hops(newRoots);
}
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/8936e4f8/src/main/java/org/apache/sysml/hops/ipa/InterProceduralAnalysis.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/ipa/InterProceduralAnalysis.java b/src/main/java/org/apache/sysml/hops/ipa/InterProceduralAnalysis.java
index acfd6d2..4cea2e2 100644
--- a/src/main/java/org/apache/sysml/hops/ipa/InterProceduralAnalysis.java
+++ b/src/main/java/org/apache/sysml/hops/ipa/InterProceduralAnalysis.java
@@ -47,7 +47,6 @@ import org.apache.sysml.hops.Hop.OpOp1;
import org.apache.sysml.hops.Hop.OpOp2;
import org.apache.sysml.hops.HopsException;
import org.apache.sysml.hops.OptimizerUtils;
-import org.apache.sysml.hops.Hop.VisitStatus;
import org.apache.sysml.hops.LiteralOp;
import org.apache.sysml.hops.UnaryOp;
import org.apache.sysml.hops.rewrite.HopRewriteUtils;
@@ -299,7 +298,7 @@ public class InterProceduralAnalysis
private void getFunctionCandidatesForStatisticPropagation(DMLProgram prog, Hop hop, Map<String, Integer> fcandCounts, Map<String, FunctionOp> fcandHops )
throws HopsException, ParseException
{
- if( hop.getVisited() == VisitStatus.DONE )
+ if( hop.isVisited() )
return;
if( hop instanceof FunctionOp && !((FunctionOp)hop).getFunctionNamespace().equals(DMLProgram.INTERNAL_NAMESPACE) )
@@ -355,7 +354,7 @@ public class InterProceduralAnalysis
for( Hop c : hop.getInput() )
getFunctionCandidatesForStatisticPropagation(prog, c, fcandCounts, fcandHops);
- hop.setVisited(VisitStatus.DONE);
+ hop.setVisited();
}
private void pruneFunctionCandidatesForStatisticPropagation(Map<String, Integer> fcandCounts, Map<String, FunctionOp> fcandHops)
@@ -607,7 +606,7 @@ public class InterProceduralAnalysis
private void propagateStatisticsIntoFunctions(DMLProgram prog, Hop hop, Map<String, Integer> fcand, LocalVariableMap callVars, Map<String, Set<Long>> fcandSafeNNZ, Set<String> unaryFcands, Set<String> fnStack )
throws HopsException, ParseException
{
- if( hop.getVisited() == VisitStatus.DONE )
+ if( hop.isVisited() )
return;
for( Hop c : hop.getInput() )
@@ -664,7 +663,7 @@ public class InterProceduralAnalysis
}
}
- hop.setVisited(VisitStatus.DONE);
+ hop.setVisited();
}
private void populateLocalVariableMapForFunctionCall( FunctionStatement fstmt, FunctionOp fop, LocalVariableMap callvars, LocalVariableMap vars, Set<Long> inputSafeNNZ, Integer numCalls )
@@ -1155,7 +1154,7 @@ public class InterProceduralAnalysis
private void rCollectCheckpoints(Hop hop, ArrayList<Hop> checkpoints)
{
- if( hop.getVisited()==VisitStatus.DONE )
+ if( hop.isVisited() )
return;
//handle leaf node for variable (checkpoint directly bound
@@ -1171,12 +1170,12 @@ public class InterProceduralAnalysis
for( Hop c : hop.getInput() )
rCollectCheckpoints(c, checkpoints);
- hop.setVisited(Hop.VisitStatus.DONE);
+ hop.setVisited();
}
public static void rRemoveCheckpointReadWrite(Hop hop)
{
- if( hop.getVisited()==VisitStatus.DONE )
+ if( hop.isVisited() )
return;
//remove checkpoint on pread if only consumed by pwrite or uagg
@@ -1206,7 +1205,7 @@ public class InterProceduralAnalysis
for( Hop c : hop.getInput() )
rRemoveCheckpointReadWrite(c);
- hop.setVisited(Hop.VisitStatus.DONE);
+ hop.setVisited();
}
/////////////////////////////
@@ -1294,7 +1293,7 @@ public class InterProceduralAnalysis
private void rRemoveConstantBinaryOp(Hop hop, HashMap<String,Hop> mOnes)
{
- if( hop.getVisited()==VisitStatus.DONE )
+ if( hop.isVisited() )
return;
if( hop instanceof BinaryOp && ((BinaryOp)hop).getOp()==OpOp2.MULT
@@ -1314,6 +1313,6 @@ public class InterProceduralAnalysis
for( Hop c : hop.getInput() )
rRemoveConstantBinaryOp(c, mOnes);
- hop.setVisited(Hop.VisitStatus.DONE);
+ hop.setVisited();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/8936e4f8/src/main/java/org/apache/sysml/hops/recompile/LiteralReplacement.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/recompile/LiteralReplacement.java b/src/main/java/org/apache/sysml/hops/recompile/LiteralReplacement.java
index 0785bcc..f539abc 100644
--- a/src/main/java/org/apache/sysml/hops/recompile/LiteralReplacement.java
+++ b/src/main/java/org/apache/sysml/hops/recompile/LiteralReplacement.java
@@ -33,7 +33,6 @@ import org.apache.sysml.hops.Hop.AggOp;
import org.apache.sysml.hops.Hop.DataOpTypes;
import org.apache.sysml.hops.Hop.Direction;
import org.apache.sysml.hops.Hop.OpOp1;
-import org.apache.sysml.hops.Hop.VisitStatus;
import org.apache.sysml.hops.rewrite.HopRewriteUtils;
import org.apache.sysml.parser.Expression.DataType;
import org.apache.sysml.runtime.DMLRuntimeException;
@@ -54,7 +53,7 @@ public class LiteralReplacement
protected static void rReplaceLiterals( Hop hop, LocalVariableMap vars )
throws DMLRuntimeException
{
- if( hop.getVisited() == VisitStatus.DONE )
+ if( hop.isVisited() )
return;
if( hop.getInput() != null )
@@ -101,7 +100,7 @@ public class LiteralReplacement
}
}
- hop.setVisited(VisitStatus.DONE);
+ hop.setVisited();
}
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/8936e4f8/src/main/java/org/apache/sysml/hops/recompile/Recompiler.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/recompile/Recompiler.java b/src/main/java/org/apache/sysml/hops/recompile/Recompiler.java
index f8b2a62..5533686 100644
--- a/src/main/java/org/apache/sysml/hops/recompile/Recompiler.java
+++ b/src/main/java/org/apache/sysml/hops/recompile/Recompiler.java
@@ -45,7 +45,6 @@ import org.apache.sysml.hops.Hop.DataGenMethod;
import org.apache.sysml.hops.Hop.DataOpTypes;
import org.apache.sysml.hops.Hop.FileFormatTypes;
import org.apache.sysml.hops.Hop.OpOp1;
-import org.apache.sysml.hops.Hop.VisitStatus;
import org.apache.sysml.hops.HopsException;
import org.apache.sysml.hops.IndexingOp;
import org.apache.sysml.hops.LiteralOp;
@@ -750,7 +749,7 @@ public class Recompiler
public static void rUpdateFunctionNames( Hop hop, long pid )
{
- if( hop.getVisited() == VisitStatus.DONE )
+ if( hop.isVisited() )
return;
//update function names
@@ -764,7 +763,7 @@ public class Recompiler
for( Hop c : hop.getInput() )
rUpdateFunctionNames(c, pid);
- hop.setVisited(VisitStatus.DONE);
+ hop.setVisited();
}
@@ -1413,7 +1412,7 @@ public class Recompiler
private static boolean rRequiresRecompile( Hop hop )
{
boolean ret = hop.requiresRecompile();
- if( hop.getVisited() == VisitStatus.DONE )
+ if( hop.isVisited() )
return ret;
if( hop.getInput() != null )
@@ -1423,7 +1422,7 @@ public class Recompiler
if( ret ) break; // early abort
}
- hop.setVisited(VisitStatus.DONE);
+ hop.setVisited();
return ret;
}
@@ -1441,7 +1440,7 @@ public class Recompiler
*/
public static void rClearLops( Hop hop )
{
- if( hop.getVisited() == VisitStatus.DONE )
+ if( hop.isVisited() )
return;
//clear all relevant lops to allow for recompilation
@@ -1460,13 +1459,13 @@ public class Recompiler
rClearLops(c);
}
- hop.setVisited(VisitStatus.DONE);
+ hop.setVisited();
}
public static void rUpdateStatistics( Hop hop, LocalVariableMap vars )
throws DMLRuntimeException
{
- if( hop.getVisited() == VisitStatus.DONE )
+ if( hop.isVisited() )
return;
//recursively process children
@@ -1587,7 +1586,7 @@ public class Recompiler
hop.refreshSizeInformation();
}
- hop.setVisited(VisitStatus.DONE);
+ hop.setVisited();
}
/**
@@ -1606,7 +1605,7 @@ public class Recompiler
public static void rSetExecType( Hop hop, ExecType etype )
{
- if( hop.getVisited() == VisitStatus.DONE )
+ if( hop.isVisited() )
return;
//update function names
@@ -1616,7 +1615,7 @@ public class Recompiler
for( Hop c : hop.getInput() )
rSetExecType(c, etype);
- hop.setVisited(VisitStatus.DONE);
+ hop.setVisited();
}
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/8936e4f8/src/main/java/org/apache/sysml/hops/rewrite/HopDagValidator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/rewrite/HopDagValidator.java b/src/main/java/org/apache/sysml/hops/rewrite/HopDagValidator.java
index eec8413..83069ad 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/HopDagValidator.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/HopDagValidator.java
@@ -85,7 +85,7 @@ public class HopDagValidator
private static void rValidateHop( Hop hop )
throws HopsException
{
- if(hop.getVisited() == Hop.VisitStatus.DONE)
+ if(hop.isVisited())
return;
//check parent linking
@@ -107,6 +107,6 @@ public class HopDagValidator
for( Hop child : hop.getInput() )
rValidateHop(child);
- hop.setVisited(Hop.VisitStatus.DONE);
+ hop.setVisited();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/8936e4f8/src/main/java/org/apache/sysml/hops/rewrite/HopRewriteUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/rewrite/HopRewriteUtils.java b/src/main/java/org/apache/sysml/hops/rewrite/HopRewriteUtils.java
index c21e9e3..d6ad037 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/HopRewriteUtils.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/HopRewriteUtils.java
@@ -40,7 +40,6 @@ import org.apache.sysml.hops.Hop.OpOp2;
import org.apache.sysml.hops.Hop.OpOp3;
import org.apache.sysml.hops.Hop.ParamBuiltinOp;
import org.apache.sysml.hops.Hop.ReOrgOp;
-import org.apache.sysml.hops.Hop.VisitStatus;
import org.apache.sysml.hops.HopsException;
import org.apache.sysml.hops.LeftIndexingOp;
import org.apache.sysml.hops.LiteralOp;
@@ -919,7 +918,7 @@ public class HopRewriteUtils
public static boolean rHasSimpleReadChain(Hop root, String var)
{
- if( root.getVisited()==VisitStatus.DONE )
+ if( root.isVisited() )
return false;
boolean ret = false;
@@ -939,13 +938,13 @@ public class HopRewriteUtils
ret |= root.getParent().size()<=1;
}
- root.setVisited(Hop.VisitStatus.DONE);
+ root.setVisited();
return ret;
}
public static boolean rContainsRead(Hop root, String var, boolean includeMetaOp)
{
- if( root.getVisited()==VisitStatus.DONE )
+ if( root.isVisited() )
return false;
boolean ret = false;
@@ -971,7 +970,7 @@ public class HopRewriteUtils
for( Hop c : root.getInput() )
ret |= rContainsRead(c, var, includeMetaOp);
- root.setVisited(Hop.VisitStatus.DONE);
+ root.setVisited();
return ret;
}
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/8936e4f8/src/main/java/org/apache/sysml/hops/rewrite/RewriteAlgebraicSimplificationDynamic.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/rewrite/RewriteAlgebraicSimplificationDynamic.java b/src/main/java/org/apache/sysml/hops/rewrite/RewriteAlgebraicSimplificationDynamic.java
index 20c1eeb..0c2f337 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/RewriteAlgebraicSimplificationDynamic.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/RewriteAlgebraicSimplificationDynamic.java
@@ -133,7 +133,7 @@ public class RewriteAlgebraicSimplificationDynamic extends HopRewriteRule
private void rule_AlgebraicSimplification(Hop hop, boolean descendFirst)
throws HopsException
{
- if(hop.getVisited() == Hop.VisitStatus.DONE)
+ if(hop.isVisited())
return;
//recursively process children
@@ -195,7 +195,7 @@ public class RewriteAlgebraicSimplificationDynamic extends HopRewriteRule
rule_AlgebraicSimplification(hi, descendFirst);
}
- hop.setVisited(Hop.VisitStatus.DONE);
+ hop.setVisited();
}
private Hop removeEmptyRightIndexing(Hop parent, Hop hi, int pos)
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/8936e4f8/src/main/java/org/apache/sysml/hops/rewrite/RewriteAlgebraicSimplificationStatic.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/rewrite/RewriteAlgebraicSimplificationStatic.java b/src/main/java/org/apache/sysml/hops/rewrite/RewriteAlgebraicSimplificationStatic.java
index 5e97829..5af850f 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/RewriteAlgebraicSimplificationStatic.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/RewriteAlgebraicSimplificationStatic.java
@@ -123,7 +123,7 @@ public class RewriteAlgebraicSimplificationStatic extends HopRewriteRule
private void rule_AlgebraicSimplification(Hop hop, boolean descendFirst)
throws HopsException
{
- if(hop.getVisited() == Hop.VisitStatus.DONE)
+ if(hop.isVisited())
return;
//recursively process children
@@ -178,7 +178,7 @@ public class RewriteAlgebraicSimplificationStatic extends HopRewriteRule
rule_AlgebraicSimplification(hi, descendFirst);
}
- hop.setVisited(Hop.VisitStatus.DONE);
+ hop.setVisited();
}
private Hop removeUnnecessaryVectorizeOperation(Hop hi)
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/8936e4f8/src/main/java/org/apache/sysml/hops/rewrite/RewriteBlockSizeAndReblock.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/rewrite/RewriteBlockSizeAndReblock.java b/src/main/java/org/apache/sysml/hops/rewrite/RewriteBlockSizeAndReblock.java
index d8edfdd..2e2f91f 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/RewriteBlockSizeAndReblock.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/RewriteBlockSizeAndReblock.java
@@ -84,7 +84,7 @@ public class RewriteBlockSizeAndReblock extends HopRewriteRule
{
// Go to the source(s) of the DAG
for (Hop hi : hop.getInput()) {
- if (hi.getVisited() != Hop.VisitStatus.DONE)
+ if (!hi.isVisited())
rule_BlockSizeAndReblock(hi, blocksize);
}
@@ -237,7 +237,7 @@ public class RewriteBlockSizeAndReblock extends HopRewriteRule
}
}
- hop.setVisited(Hop.VisitStatus.DONE);
+ hop.setVisited();
}
private static boolean isReblockValid() {
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/8936e4f8/src/main/java/org/apache/sysml/hops/rewrite/RewriteCommonSubexpressionElimination.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/rewrite/RewriteCommonSubexpressionElimination.java b/src/main/java/org/apache/sysml/hops/rewrite/RewriteCommonSubexpressionElimination.java
index d6d023c..72957dd 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/RewriteCommonSubexpressionElimination.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/RewriteCommonSubexpressionElimination.java
@@ -100,7 +100,7 @@ public class RewriteCommonSubexpressionElimination extends HopRewriteRule
throws HopsException
{
int ret = 0;
- if( hop.getVisited() == Hop.VisitStatus.DONE )
+ if( hop.isVisited() )
return ret;
if( hop.getInput().isEmpty() ) //LEAF NODE
@@ -152,7 +152,7 @@ public class RewriteCommonSubexpressionElimination extends HopRewriteRule
}
}
- hop.setVisited(Hop.VisitStatus.DONE);
+ hop.setVisited();
return ret;
}
@@ -160,7 +160,7 @@ public class RewriteCommonSubexpressionElimination extends HopRewriteRule
throws HopsException
{
int ret = 0;
- if( hop.getVisited() == Hop.VisitStatus.DONE )
+ if( hop.isVisited() )
return ret;
//step 1: merge childs recursively first
@@ -212,7 +212,7 @@ public class RewriteCommonSubexpressionElimination extends HopRewriteRule
}
}
- hop.setVisited(Hop.VisitStatus.DONE);
+ hop.setVisited();
return ret;
}
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/8936e4f8/src/main/java/org/apache/sysml/hops/rewrite/RewriteCompressedReblock.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/rewrite/RewriteCompressedReblock.java b/src/main/java/org/apache/sysml/hops/rewrite/RewriteCompressedReblock.java
index 92b6db9..c150a2b 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/RewriteCompressedReblock.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/RewriteCompressedReblock.java
@@ -66,7 +66,7 @@ public class RewriteCompressedReblock extends HopRewriteRule
{
// Go to the source(s) of the DAG
for (Hop hi : hop.getInput()) {
- if (hi.getVisited() != Hop.VisitStatus.DONE)
+ if (!hi.isVisited())
rule_CompressedReblock(hi);
}
@@ -77,6 +77,6 @@ public class RewriteCompressedReblock extends HopRewriteRule
hop.setRequiresCompression(true);
}
- hop.setVisited(Hop.VisitStatus.DONE);
+ hop.setVisited();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/8936e4f8/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 0b4faf6..afb982c 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/RewriteConstantFolding.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/RewriteConstantFolding.java
@@ -29,7 +29,6 @@ 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;
import org.apache.sysml.hops.LiteralOp;
import org.apache.sysml.hops.UnaryOp;
@@ -98,7 +97,7 @@ public class RewriteConstantFolding extends HopRewriteRule
private Hop rConstantFoldingExpression( Hop root )
throws HopsException
{
- if( root.getVisited() == VisitStatus.DONE )
+ if( root.isVisited() )
return root;
//recursively process childs (before replacement to allow bottom-recursion)
@@ -168,7 +167,7 @@ public class RewriteConstantFolding extends HopRewriteRule
//mark processed
- root.setVisited( VisitStatus.DONE );
+ root.setVisited();
return root;
}
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/8936e4f8/src/main/java/org/apache/sysml/hops/rewrite/RewriteIndexingVectorization.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/rewrite/RewriteIndexingVectorization.java b/src/main/java/org/apache/sysml/hops/rewrite/RewriteIndexingVectorization.java
index cf5ebce..f5af292 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/RewriteIndexingVectorization.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/RewriteIndexingVectorization.java
@@ -72,7 +72,7 @@ public class RewriteIndexingVectorization extends HopRewriteRule
private void rule_IndexingVectorization( Hop hop )
throws HopsException
{
- if(hop.getVisited() == Hop.VisitStatus.DONE)
+ if(hop.isVisited())
return;
//recursively process children
@@ -90,7 +90,7 @@ public class RewriteIndexingVectorization extends HopRewriteRule
rule_IndexingVectorization( hi );
}
- hop.setVisited(Hop.VisitStatus.DONE);
+ hop.setVisited();
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/8936e4f8/src/main/java/org/apache/sysml/hops/rewrite/RewriteInjectSparkPReadCheckpointing.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/rewrite/RewriteInjectSparkPReadCheckpointing.java b/src/main/java/org/apache/sysml/hops/rewrite/RewriteInjectSparkPReadCheckpointing.java
index 5ddcae1..9aceab4 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/RewriteInjectSparkPReadCheckpointing.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/RewriteInjectSparkPReadCheckpointing.java
@@ -64,7 +64,7 @@ public class RewriteInjectSparkPReadCheckpointing extends HopRewriteRule
private void rInjectCheckpointAfterPRead( Hop hop )
throws HopsException
{
- if(hop.getVisited() == Hop.VisitStatus.DONE)
+ if(hop.isVisited())
return;
// The reblocking is performed after transform, and hence checkpoint only non-transformed reads.
@@ -86,6 +86,6 @@ public class RewriteInjectSparkPReadCheckpointing extends HopRewriteRule
}
}
- hop.setVisited(Hop.VisitStatus.DONE);
+ hop.setVisited();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/8936e4f8/src/main/java/org/apache/sysml/hops/rewrite/RewriteMatrixMultChainOptimization.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/rewrite/RewriteMatrixMultChainOptimization.java b/src/main/java/org/apache/sysml/hops/rewrite/RewriteMatrixMultChainOptimization.java
index 9445fcb..d43cb81 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/RewriteMatrixMultChainOptimization.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/RewriteMatrixMultChainOptimization.java
@@ -93,12 +93,11 @@ public class RewriteMatrixMultChainOptimization extends HopRewriteRule
private void rule_OptimizeMMChains(Hop hop)
throws HopsException
{
- if(hop.getVisited() == Hop.VisitStatus.DONE)
+ if(hop.isVisited())
return;
if ( HopRewriteUtils.isMatrixMultiply(hop)
- && !((AggBinaryOp)hop).hasLeftPMInput()
- && hop.getVisited() != Hop.VisitStatus.DONE )
+ && !((AggBinaryOp)hop).hasLeftPMInput() && !hop.isVisited() )
{
// Try to find and optimize the chain in which current Hop is the
// last operator
@@ -108,7 +107,7 @@ public class RewriteMatrixMultChainOptimization extends HopRewriteRule
for (Hop hi : hop.getInput())
rule_OptimizeMMChains(hi);
- hop.setVisited(Hop.VisitStatus.DONE);
+ hop.setVisited();
}
@@ -160,8 +159,7 @@ public class RewriteMatrixMultChainOptimization extends HopRewriteRule
*/
if ( HopRewriteUtils.isMatrixMultiply(h)
- && !((AggBinaryOp)hop).hasLeftPMInput()
- && h.getVisited() != Hop.VisitStatus.DONE )
+ && !((AggBinaryOp)hop).hasLeftPMInput() && h.isVisited() )
{
// check if the output of "h" is used at multiple places. If yes, it can
// not be expanded.
@@ -173,7 +171,7 @@ public class RewriteMatrixMultChainOptimization extends HopRewriteRule
expandable = true;
}
- h.setVisited(Hop.VisitStatus.DONE);
+ h.setVisited();
if ( !expandable ) {
i = i + 1;
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/8936e4f8/src/main/java/org/apache/sysml/hops/rewrite/RewriteRemovePersistentReadWrite.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/rewrite/RewriteRemovePersistentReadWrite.java b/src/main/java/org/apache/sysml/hops/rewrite/RewriteRemovePersistentReadWrite.java
index 7922f29..bd734c9 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/RewriteRemovePersistentReadWrite.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/RewriteRemovePersistentReadWrite.java
@@ -28,7 +28,6 @@ import org.apache.commons.logging.LogFactory;
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.VisitStatus;
import org.apache.sysml.hops.HopsException;
import org.apache.sysml.parser.Expression.DataType;
import org.apache.sysml.runtime.controlprogram.LocalVariableMap;
@@ -107,7 +106,7 @@ public class RewriteRemovePersistentReadWrite extends HopRewriteRule
throws HopsException
{
//check mark processed
- if( hop.getVisited() == VisitStatus.DONE )
+ if( hop.isVisited() )
return;
//recursively process childs
@@ -164,6 +163,6 @@ public class RewriteRemovePersistentReadWrite extends HopRewriteRule
}
//mark processed
- hop.setVisited( VisitStatus.DONE );
+ hop.setVisited();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/8936e4f8/src/main/java/org/apache/sysml/hops/rewrite/RewriteRemoveReadAfterWrite.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/rewrite/RewriteRemoveReadAfterWrite.java b/src/main/java/org/apache/sysml/hops/rewrite/RewriteRemoveReadAfterWrite.java
index 9348088..d3489f4 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/RewriteRemoveReadAfterWrite.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/RewriteRemoveReadAfterWrite.java
@@ -89,7 +89,7 @@ public class RewriteRemoveReadAfterWrite extends HopRewriteRule
private void collectPersistentReadWriteOps(Hop hop, HashMap<String,Hop> pWrites, HashMap<String,Hop> pReads)
throws HopsException
{
- if( hop.getVisited() == Hop.VisitStatus.DONE )
+ if( hop.isVisited() )
return;
//process childs
@@ -111,6 +111,6 @@ public class RewriteRemoveReadAfterWrite extends HopRewriteRule
}
}
- hop.setVisited(Hop.VisitStatus.DONE);
+ hop.setVisited();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/8936e4f8/src/main/java/org/apache/sysml/hops/rewrite/RewriteRemoveUnnecessaryCasts.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/rewrite/RewriteRemoveUnnecessaryCasts.java b/src/main/java/org/apache/sysml/hops/rewrite/RewriteRemoveUnnecessaryCasts.java
index 95a1214..e657f7f 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/RewriteRemoveUnnecessaryCasts.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/RewriteRemoveUnnecessaryCasts.java
@@ -23,7 +23,6 @@ import java.util.ArrayList;
import org.apache.sysml.hops.Hop;
import org.apache.sysml.hops.Hop.OpOp1;
import org.apache.sysml.hops.HopsException;
-import org.apache.sysml.hops.Hop.VisitStatus;
import org.apache.sysml.hops.UnaryOp;
import org.apache.sysml.parser.Expression.ValueType;
@@ -74,7 +73,7 @@ public class RewriteRemoveUnnecessaryCasts extends HopRewriteRule
private void rule_RemoveUnnecessaryCasts( Hop hop )
{
//check mark processed
- if( hop.getVisited() == VisitStatus.DONE )
+ if( hop.isVisited() )
return;
//recursively process childs
@@ -129,6 +128,6 @@ public class RewriteRemoveUnnecessaryCasts extends HopRewriteRule
}
//mark processed
- hop.setVisited( VisitStatus.DONE );
+ hop.setVisited();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/8936e4f8/src/main/java/org/apache/sysml/hops/rewrite/RewriteSplitDagDataDependentOperators.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/rewrite/RewriteSplitDagDataDependentOperators.java b/src/main/java/org/apache/sysml/hops/rewrite/RewriteSplitDagDataDependentOperators.java
index c4e6caa..85d34dc 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/RewriteSplitDagDataDependentOperators.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/RewriteSplitDagDataDependentOperators.java
@@ -31,7 +31,6 @@ import org.apache.sysml.hops.Hop.OpOp3;
import org.apache.sysml.hops.Hop.ParamBuiltinOp;
import org.apache.sysml.hops.Hop.DataOpTypes;
import org.apache.sysml.hops.Hop.ReOrgOp;
-import org.apache.sysml.hops.Hop.VisitStatus;
import org.apache.sysml.hops.HopsException;
import org.apache.sysml.hops.LiteralOp;
import org.apache.sysml.hops.ParameterizedBuiltinOp;
@@ -123,7 +122,7 @@ public class RewriteSplitDagDataDependentOperators extends StatementBlockRewrite
//create new transient read
DataOp tread = new DataOp(varname, c.getDataType(), c.getValueType(),
DataOpTypes.TRANSIENTREAD, null, rlen, clen, nnz, update, brlen, bclen);
- tread.setVisited(VisitStatus.DONE);
+ tread.setVisited();
HopRewriteUtils.copyLineNumbers(c, tread);
//replace data-dependent operator with transient read
@@ -149,7 +148,7 @@ public class RewriteSplitDagDataDependentOperators extends StatementBlockRewrite
//create new transient read
DataOp tread = new DataOp(varname, c.getDataType(), c.getValueType(),
DataOpTypes.TRANSIENTREAD, null, rlen, clen, nnz, update, brlen, bclen);
- tread.setVisited(VisitStatus.DONE);
+ tread.setVisited();
HopRewriteUtils.copyLineNumbers(c, tread);
//replace data-dependent operator with transient read
@@ -164,7 +163,7 @@ public class RewriteSplitDagDataDependentOperators extends StatementBlockRewrite
//add data-dependent operator sub dag to first statement block
DataOp twrite = new DataOp(varname, c.getDataType(), c.getValueType(),
c, DataOpTypes.TRANSIENTWRITE, null);
- twrite.setVisited(VisitStatus.DONE);
+ twrite.setVisited();
twrite.setOutputParams(rlen, clen, nnz, update, brlen, bclen);
HopRewriteUtils.copyLineNumbers(c, twrite);
sb1hops.add(twrite);
@@ -223,7 +222,7 @@ public class RewriteSplitDagDataDependentOperators extends StatementBlockRewrite
private void rCollectDataDependentOperators( Hop hop, ArrayList<Hop> cand )
{
- if( hop.getVisited() == VisitStatus.DONE )
+ if( hop.isVisited() )
return;
//prevent unnecessary dag split (dims known or no consumer operations)
@@ -293,7 +292,7 @@ public class RewriteSplitDagDataDependentOperators extends StatementBlockRewrite
Hop c = hop.getInput().get(i);
if( !(c instanceof LiteralOp || c instanceof DataOp) ){
cand.add(c);
- c.setVisited(VisitStatus.DONE);
+ c.setVisited();
investigateChilds = false;
}
@@ -307,7 +306,7 @@ public class RewriteSplitDagDataDependentOperators extends StatementBlockRewrite
for( Hop c : hop.getInput() )
rCollectDataDependentOperators(c, cand);
- hop.setVisited(VisitStatus.DONE);
+ hop.setVisited();
}
private boolean hasTransientWriteParents( Hop hop )
@@ -350,11 +349,11 @@ public class RewriteSplitDagDataDependentOperators extends StatementBlockRewrite
DataOp tread = new DataOp(varname, c.getDataType(), c.getValueType(), DataOpTypes.TRANSIENTREAD,
null, c.getDim1(), c.getDim2(), c.getNnz(), c.getUpdateType(), c.getRowsInBlock(), c.getColsInBlock());
- tread.setVisited(VisitStatus.DONE);
+ tread.setVisited();
HopRewriteUtils.copyLineNumbers(c, tread);
DataOp twrite = new DataOp(varname, c.getDataType(), c.getValueType(), c, DataOpTypes.TRANSIENTWRITE, null);
- twrite.setVisited(VisitStatus.DONE);
+ twrite.setVisited();
twrite.setOutputParams(c.getDim1(), c.getDim2(), c.getNnz(), c.getUpdateType(), c.getRowsInBlock(), c.getColsInBlock());
HopRewriteUtils.copyLineNumbers(c, twrite);
@@ -378,7 +377,7 @@ public class RewriteSplitDagDataDependentOperators extends StatementBlockRewrite
private void rAddHopsToProbeSet( Hop hop, HashSet<Hop> probeSet )
{
- if( hop.getVisited() == VisitStatus.DONE )
+ if( hop.isVisited() )
return;
//prevent cuts for no-ops
@@ -392,7 +391,7 @@ public class RewriteSplitDagDataDependentOperators extends StatementBlockRewrite
for( Hop c : hop.getInput() )
rAddHopsToProbeSet(c, probeSet);
- hop.setVisited(VisitStatus.DONE);
+ hop.setVisited();
}
/**
@@ -405,7 +404,7 @@ public class RewriteSplitDagDataDependentOperators extends StatementBlockRewrite
*/
private void rProbeAndAddHopsToCandidateSet( Hop hop, HashSet<Hop> probeSet, HashSet<Pair<Hop,Hop>> candSet )
{
- if( hop.getVisited() == VisitStatus.DONE )
+ if( hop.isVisited() )
return;
if( hop.getInput() != null )
@@ -420,7 +419,7 @@ public class RewriteSplitDagDataDependentOperators extends StatementBlockRewrite
}
}
- hop.setVisited(VisitStatus.DONE);
+ hop.setVisited();
}
private void collectCandidateChildOperators( ArrayList<Hop> cand, HashSet<Hop> candChilds )
@@ -439,7 +438,7 @@ public class RewriteSplitDagDataDependentOperators extends StatementBlockRewrite
private void rCollectCandidateChildOperators( Hop hop, ArrayList<Hop> cand, HashSet<Hop> candChilds, boolean collect )
{
- if( hop.getVisited() == VisitStatus.DONE )
+ if( hop.isVisited() )
return;
//collect operator if necessary
@@ -459,6 +458,6 @@ public class RewriteSplitDagDataDependentOperators extends StatementBlockRewrite
rCollectCandidateChildOperators(c, cand, candChilds, passedFlag);
}
- hop.setVisited(VisitStatus.DONE);
+ hop.setVisited();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/8936e4f8/src/main/java/org/apache/sysml/hops/rewrite/RewriteSplitDagUnknownCSVRead.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/rewrite/RewriteSplitDagUnknownCSVRead.java b/src/main/java/org/apache/sysml/hops/rewrite/RewriteSplitDagUnknownCSVRead.java
index 692762e..ee7b9c6 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/RewriteSplitDagUnknownCSVRead.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/RewriteSplitDagUnknownCSVRead.java
@@ -25,7 +25,6 @@ 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.FileFormatTypes;
-import org.apache.sysml.hops.Hop.VisitStatus;
import org.apache.sysml.hops.HopsException;
import org.apache.sysml.parser.DataIdentifier;
import org.apache.sysml.parser.StatementBlock;
@@ -137,7 +136,7 @@ public class RewriteSplitDagUnknownCSVRead extends StatementBlockRewriteRule
private void collectCSVReadHopsUnknownSize( Hop hop, ArrayList<Hop> cand )
{
- if( hop.getVisited() == VisitStatus.DONE )
+ if( hop.isVisited() )
return;
//collect persistent reads (of type csv, with unknown size)
@@ -159,6 +158,6 @@ public class RewriteSplitDagUnknownCSVRead extends StatementBlockRewriteRule
for( Hop c : hop.getInput() )
collectCSVReadHopsUnknownSize(c, cand);
- hop.setVisited(VisitStatus.DONE);
+ hop.setVisited();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/8936e4f8/src/main/java/org/apache/sysml/parser/DMLTranslator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/DMLTranslator.java b/src/main/java/org/apache/sysml/parser/DMLTranslator.java
index 61dff7c..c0eb30f 100644
--- a/src/main/java/org/apache/sysml/parser/DMLTranslator.java
+++ b/src/main/java/org/apache/sysml/parser/DMLTranslator.java
@@ -541,108 +541,6 @@ public class DMLTranslator
}
}
}
-
-
- public void printHops(DMLProgram dmlp) throws ParseException, LanguageException, HopsException {
- if (LOG.isDebugEnabled()) {
- // for each namespace, handle function program blocks
- for (String namespaceKey : dmlp.getNamespaces().keySet()){
- for (String fname : dmlp.getFunctionStatementBlocks(namespaceKey).keySet()){
- FunctionStatementBlock fsblock = dmlp.getFunctionStatementBlock(namespaceKey,fname);
- printHops(fsblock);
- }
- }
-
- // hand
- for (int i = 0; i < dmlp.getNumStatementBlocks(); i++) {
- StatementBlock current = dmlp.getStatementBlock(i);
- printHops(current);
- }
- }
- }
-
- public void printHops(StatementBlock current) throws ParseException, HopsException {
- if (LOG.isDebugEnabled()) {
- ArrayList<Hop> hopsDAG = current.get_hops();
- LOG.debug("\n********************** HOPS DAG FOR BLOCK *******************");
-
- if (current instanceof FunctionStatementBlock) {
- if (current.getNumStatements() > 1)
- LOG.debug("Function statement block has more than 1 stmt");
- FunctionStatement fstmt = (FunctionStatement)current.getStatement(0);
- for (StatementBlock child : fstmt.getBody()){
- printHops(child);
- }
- }
-
- if (current instanceof WhileStatementBlock) {
-
- // print predicate hops
- WhileStatementBlock wstb = (WhileStatementBlock) current;
- Hop predicateHops = wstb.getPredicateHops();
- LOG.debug("\n********************** PREDICATE HOPS *******************");
- predicateHops.printMe();
-
- if (wstb.getNumStatements() > 1)
- LOG.debug("While statement block has more than 1 stmt");
- WhileStatement ws = (WhileStatement)wstb.getStatement(0);
-
- for (StatementBlock sb : ws.getBody()){
- printHops(sb);
- }
- }
-
- if (current instanceof IfStatementBlock) {
-
- // print predicate hops
- IfStatementBlock istb = (IfStatementBlock) current;
- Hop predicateHops = istb.getPredicateHops();
- LOG.debug("\n********************** PREDICATE HOPS *******************");
- predicateHops.printMe();
-
-
- if (istb.getNumStatements() > 1)
- LOG.debug("If statement block has more than 1 stmt");
- IfStatement is = (IfStatement)istb.getStatement(0);
-
- for (StatementBlock sb : is.getIfBody()){
- printHops(sb);
- }
-
- for (StatementBlock sb : is.getElseBody()){
- printHops(sb);
- }
- }
-
-
- if (current instanceof ForStatementBlock) {
-
- // print predicate hops
- ForStatementBlock fsb = (ForStatementBlock) current;
- LOG.debug("\n********************** PREDICATE HOPS *******************");
- if (fsb.getFromHops() != null) fsb.getFromHops().printMe();
- if (fsb.getToHops() != null) fsb.getToHops().printMe();
- if (fsb.getIncrementHops() != null) fsb.getIncrementHops().printMe();
-
- if (fsb.getNumStatements() > 1)
- LOG.debug("For statement block has more than 1 stmt");
- ForStatement ws = (ForStatement)fsb.getStatement(0);
-
- for (StatementBlock sb : ws.getBody()){
- printHops(sb);
- }
- }
-
- if (hopsDAG != null && !hopsDAG.isEmpty()) {
- // hopsDAG.iterator().next().printMe();
- Iterator<Hop> iter = hopsDAG.iterator();
- while (iter.hasNext()) {
- LOG.debug("\n********************** OUTPUT HOPS *******************");
- iter.next().printMe();
- }
- }
- }
- }
public void refreshMemEstimates(DMLProgram dmlp) throws ParseException, LanguageException, HopsException {
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/8936e4f8/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/opt/OptTreeConverter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/opt/OptTreeConverter.java b/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/opt/OptTreeConverter.java
index 80badf9..5c693d5 100644
--- a/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/opt/OptTreeConverter.java
+++ b/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/opt/OptTreeConverter.java
@@ -30,7 +30,6 @@ import org.apache.sysml.hops.Hop;
import org.apache.sysml.hops.Hop.MultiThreadedHop;
import org.apache.sysml.hops.HopsException;
import org.apache.sysml.hops.LiteralOp;
-import org.apache.sysml.hops.Hop.VisitStatus;
import org.apache.sysml.hops.OptimizerUtils;
import org.apache.sysml.lops.LopProperties;
import org.apache.sysml.parser.DMLProgram;
@@ -503,7 +502,7 @@ public class OptTreeConverter
ArrayList<OptNode> ret = new ArrayList<OptNode>();
ArrayList<Hop> in = hop.getInput();
- if( hop.getVisited() == VisitStatus.DONE )
+ if( hop.isVisited() )
return ret;
//general case
@@ -584,7 +583,7 @@ public class OptTreeConverter
if( !(hin instanceof DataOp || hin instanceof LiteralOp ) ) //no need for opt nodes
ret.addAll(rCreateAbstractOptNodes(hin, vars, memo));
- hop.setVisited(VisitStatus.DONE);
+ hop.setVisited();
return ret;
}
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/8936e4f8/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/opt/OptTreePlanChecker.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/opt/OptTreePlanChecker.java b/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/opt/OptTreePlanChecker.java
index 5099feb..db0f297 100644
--- a/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/opt/OptTreePlanChecker.java
+++ b/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/opt/OptTreePlanChecker.java
@@ -25,7 +25,6 @@ import java.util.Set;
import org.apache.sysml.hops.FunctionOp;
import org.apache.sysml.hops.Hop;
-import org.apache.sysml.hops.Hop.VisitStatus;
import org.apache.sysml.hops.HopsException;
import org.apache.sysml.parser.DMLProgram;
import org.apache.sysml.parser.ForStatement;
@@ -186,7 +185,7 @@ public class OptTreePlanChecker
private static void getAllFunctionOps( Hop hop, HashMap<String, FunctionOp> memo )
{
- if( hop.getVisited() == VisitStatus.DONE )
+ if( hop.isVisited() )
return;
//process functionop
@@ -201,6 +200,6 @@ public class OptTreePlanChecker
for( Hop in : hop.getInput() )
getAllFunctionOps(in, memo);
- hop.setVisited(VisitStatus.DONE);
+ hop.setVisited();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/8936e4f8/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/opt/OptimizerRuleBased.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/opt/OptimizerRuleBased.java b/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/opt/OptimizerRuleBased.java
index 87cabaa..a84f93f 100644
--- a/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/opt/OptimizerRuleBased.java
+++ b/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/opt/OptimizerRuleBased.java
@@ -2078,38 +2078,36 @@ public class OptimizerRuleBased extends Optimizer
private void rGetUIPConsumerList(Hop hop, HashMap <String, ArrayList<UIPCandidateHop>> uipCandHopHM)
throws DMLRuntimeException
{
- if(hop.getVisited() != Hop.VisitStatus.DONE)
- {
- if ((!(!hop.getParent().isEmpty() && hop.getParent().get(0) instanceof LeftIndexingOp)) &&
- ((hop instanceof DataOp && ((DataOp)hop).getDataOpType() == DataOpTypes.TRANSIENTREAD ) ||
- (hop instanceof ReorgOp && (((ReorgOp)hop).getOp() == ReOrgOp.RESHAPE || ((ReorgOp)hop).getOp() == ReOrgOp.TRANSPOSE)) ||
- (hop instanceof FunctionOp)))
- {
- // If candidate's name is same as input hop.
- String uipCandiateID = hop.getName();
- ArrayList <UIPCandidateHop> uipCandHopList = uipCandHopHM.get(uipCandiateID);
-
- if (uipCandHopList != null)
- {
- for (UIPCandidateHop uipCandHop: uipCandHopList)
- {
- // Add consumers for candidate hop.
- ArrayList<Hop> consumerHops = uipCandHop.getConsumerHops();
- if(uipCandHop.getConsumerHops() == null)
- consumerHops = new ArrayList<Hop>();
- consumerHops.add(getRootHop(hop));
- uipCandHop.setConsumerHops(consumerHops);
- }
- }
- }
+ if(hop.isVisited())
+ return;
+
+ if ((!(!hop.getParent().isEmpty() && hop.getParent().get(0) instanceof LeftIndexingOp)) &&
+ ((hop instanceof DataOp && ((DataOp)hop).getDataOpType() == DataOpTypes.TRANSIENTREAD ) ||
+ (hop instanceof ReorgOp && (((ReorgOp)hop).getOp() == ReOrgOp.RESHAPE || ((ReorgOp)hop).getOp() == ReOrgOp.TRANSPOSE)) ||
+ (hop instanceof FunctionOp)))
+ {
+ // If candidate's name is same as input hop.
+ String uipCandiateID = hop.getName();
+ ArrayList <UIPCandidateHop> uipCandHopList = uipCandHopHM.get(uipCandiateID);
- for(Hop hopIn: hop.getInput())
+ if (uipCandHopList != null)
{
- rGetUIPConsumerList(hopIn, uipCandHopHM);
+ for (UIPCandidateHop uipCandHop: uipCandHopList)
+ {
+ // Add consumers for candidate hop.
+ ArrayList<Hop> consumerHops = uipCandHop.getConsumerHops();
+ if(uipCandHop.getConsumerHops() == null)
+ consumerHops = new ArrayList<Hop>();
+ consumerHops.add(getRootHop(hop));
+ uipCandHop.setConsumerHops(consumerHops);
+ }
}
-
- hop.setVisited(Hop.VisitStatus.DONE);
}
+
+ for(Hop hopIn: hop.getInput())
+ rGetUIPConsumerList(hopIn, uipCandHopHM);
+
+ hop.setVisited();
}
@@ -2337,61 +2335,51 @@ public class OptimizerRuleBased extends Optimizer
private void rValidateUIPConsumerList(Hop hop, HashMap <String, ArrayList<UIPCandidateHop>> uipCandHopHM)
throws DMLRuntimeException
{
- if(hop.getVisited() != Hop.VisitStatus.DONE)
+ if(hop.isVisited())
+ return;
+
+ for(Entry<String, ArrayList <UIPCandidateHop>> entry: uipCandHopHM.entrySet())
{
- for(Entry<String, ArrayList <UIPCandidateHop>> entry: uipCandHopHM.entrySet())
- {
- ArrayList <UIPCandidateHop> uipCandHopList = entry.getValue();
- if (uipCandHopList != null)
- {
- for (UIPCandidateHop uipCandHop: uipCandHopList)
- {
- ArrayList<Hop> consumerHops = uipCandHop.getConsumerHops();
- if(consumerHops != null)
- {
- // If consumer has read then remove candidate from the list (set flag to false).
- for (Hop consumerHop: consumerHops)
- if(hop.getName().equals(consumerHop.getName()))
- {
- uipCandHop.setUpdateInPlace(false);
- break;
- }
+ if (entry.getValue() == null)
+ continue;
+ for (UIPCandidateHop uipCandHop: entry.getValue()) {
+ ArrayList<Hop> consumerHops = uipCandHop.getConsumerHops();
+ if(consumerHops != null) {
+ // If consumer has read then remove candidate from the list (set flag to false).
+ for (Hop consumerHop: consumerHops)
+ if(hop.getName().equals(consumerHop.getName())) {
+ uipCandHop.setUpdateInPlace(false);
+ break;
}
- }
}
}
- hop.setVisited(Hop.VisitStatus.DONE);
}
+ hop.setVisited();
}
private void rValidateUIPConsumerList(Hop hop, HashMap <String, ArrayList<UIPCandidateHop>> uipCandHopHM, VariableSet readVariables)
throws DMLRuntimeException
{
- if(hop.getVisited() != Hop.VisitStatus.DONE)
+ if(hop.isVisited())
+ return;
+
+ for(Entry<String, ArrayList <UIPCandidateHop>> entry: uipCandHopHM.entrySet())
{
- for(Entry<String, ArrayList <UIPCandidateHop>> entry: uipCandHopHM.entrySet())
- {
- ArrayList <UIPCandidateHop> uipCandHopList = entry.getValue();
- if (uipCandHopList != null)
- {
- for (UIPCandidateHop uipCandHop: uipCandHopList)
- {
- ArrayList<Hop> consumerHops = uipCandHop.getConsumerHops();
- if(consumerHops != null)
- {
- // If consumer has read then remove candidate from the list (set flag to false).
- for (Hop consumerHop: consumerHops)
- if(readVariables.containsVariable(consumerHop.getName()))
- {
- uipCandHop.setUpdateInPlace(false);
- break;
- }
+ if (entry.getValue() == null)
+ continue;
+ for (UIPCandidateHop uipCandHop: entry.getValue()) {
+ ArrayList<Hop> consumerHops = uipCandHop.getConsumerHops();
+ if(consumerHops != null) {
+ // If consumer has read then remove candidate from the list (set flag to false).
+ for (Hop consumerHop: consumerHops)
+ if(readVariables.containsVariable(consumerHop.getName())) {
+ uipCandHop.setUpdateInPlace(false);
+ break;
}
- }
}
}
- hop.setVisited(Hop.VisitStatus.DONE);
}
+ hop.setVisited();
}
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/8936e4f8/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/opt/ProgramRecompiler.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/opt/ProgramRecompiler.java b/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/opt/ProgramRecompiler.java
index c21d0f8..f6ccc13 100644
--- a/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/opt/ProgramRecompiler.java
+++ b/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/opt/ProgramRecompiler.java
@@ -25,7 +25,6 @@ import java.util.ArrayList;
import org.apache.sysml.conf.ConfigurationManager;
import org.apache.sysml.conf.DMLConfig;
import org.apache.sysml.hops.Hop;
-import org.apache.sysml.hops.Hop.VisitStatus;
import org.apache.sysml.hops.HopsException;
import org.apache.sysml.hops.IndexingOp;
import org.apache.sysml.hops.OptimizerUtils;
@@ -396,7 +395,7 @@ public class ProgramRecompiler
{
boolean ret = false;
- if( hop.getVisited() == VisitStatus.DONE )
+ if( hop.isVisited() )
return ret;
ArrayList<Hop> in = hop.getInput();
@@ -423,7 +422,7 @@ public class ProgramRecompiler
for( Hop hin : in )
ret |= rFindAndSetCPIndexingHOP(hin,var);
- hop.setVisited(VisitStatus.DONE);
+ hop.setVisited();
return ret;
}
@@ -432,7 +431,7 @@ public class ProgramRecompiler
{
boolean ret = false;
- if( hop.getVisited() == VisitStatus.DONE )
+ if( hop.isVisited() )
return ret;
ArrayList<Hop> in = hop.getInput();
@@ -453,7 +452,7 @@ public class ProgramRecompiler
for( Hop hin : in )
ret |= rFindAndReleaseIndexingHOP(hin,var);
- hop.setVisited(VisitStatus.DONE);
+ hop.setVisited();
return ret;
}
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/8936e4f8/src/main/java/org/apache/sysml/utils/Explain.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/utils/Explain.java b/src/main/java/org/apache/sysml/utils/Explain.java
index a03ad73..b78029a 100644
--- a/src/main/java/org/apache/sysml/utils/Explain.java
+++ b/src/main/java/org/apache/sysml/utils/Explain.java
@@ -28,7 +28,6 @@ import java.util.Map.Entry;
import org.apache.sysml.api.DMLException;
import org.apache.sysml.hops.Hop;
-import org.apache.sysml.hops.Hop.VisitStatus;
import org.apache.sysml.hops.HopsException;
import org.apache.sysml.hops.LiteralOp;
import org.apache.sysml.hops.OptimizerUtils;
@@ -560,11 +559,8 @@ public class Explain
private static String explainHop(Hop hop, int level)
throws DMLRuntimeException
{
- if( hop.getVisited() == VisitStatus.DONE
- || (!SHOW_LITERAL_HOPS && hop instanceof LiteralOp) )
- {
+ if( hop.isVisited() || (!SHOW_LITERAL_HOPS && hop instanceof LiteralOp) )
return "";
- }
StringBuilder sb = new StringBuilder();
String offset = createOffset(level);
@@ -632,7 +628,7 @@ public class Explain
sb.append('\n');
- hop.setVisited(VisitStatus.DONE);
+ hop.setVisited();
return sb.toString();
}
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/8936e4f8/src/main/java/org/apache/sysml/yarn/ropt/GridEnumerationMemory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/yarn/ropt/GridEnumerationMemory.java b/src/main/java/org/apache/sysml/yarn/ropt/GridEnumerationMemory.java
index 05a9d47..78402d4 100644
--- a/src/main/java/org/apache/sysml/yarn/ropt/GridEnumerationMemory.java
+++ b/src/main/java/org/apache/sysml/yarn/ropt/GridEnumerationMemory.java
@@ -142,7 +142,7 @@ public class GridEnumerationMemory extends GridEnumeration
private void getMemoryEstimates( Hop hop, ArrayList<Long> mem )
{
- if( hop.getVisited() == Hop.VisitStatus.DONE )
+ if( hop.isVisited() )
return;
//process childs
@@ -153,7 +153,7 @@ public class GridEnumerationMemory extends GridEnumeration
mem.add( (long)( (hop.getMemEstimate()+DEFAULT_MEM_ADD)
/OptimizerUtils.MEM_UTIL_FACTOR) );
- hop.setVisited(Hop.VisitStatus.DONE);
+ hop.setVisited();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/8936e4f8/src/main/java/org/apache/sysml/yarn/ropt/ResourceOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/yarn/ropt/ResourceOptimizer.java b/src/main/java/org/apache/sysml/yarn/ropt/ResourceOptimizer.java
index 1544e45..d753406 100644
--- a/src/main/java/org/apache/sysml/yarn/ropt/ResourceOptimizer.java
+++ b/src/main/java/org/apache/sysml/yarn/ropt/ResourceOptimizer.java
@@ -437,7 +437,7 @@ public class ResourceOptimizer
vars.put(varname, mo);
}
- hop.setVisited(Hop.VisitStatus.DONE);
+ hop.setVisited();
}
private static ArrayList<ProgramBlock> pruneProgramBlocks( ArrayList<ProgramBlock> B )
@@ -513,7 +513,7 @@ public class ResourceOptimizer
private static boolean pruneHasOnlyUnknownMR( Hop hop )
{
- if( hop == null || hop.getVisited() == Hop.VisitStatus.DONE )
+ if( hop == null || hop.isVisited() )
return true;
boolean ret = true;
@@ -537,7 +537,7 @@ public class ResourceOptimizer
ret &= lret;
}
- hop.setVisited(Hop.VisitStatus.DONE);
+ hop.setVisited();
return ret;
}