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/08/16 18:01:06 UTC
[3/3] systemml git commit: [SYSTEMML-1843] Fix rewrite mark loop
variables as update-in-place
[SYSTEMML-1843] Fix rewrite mark loop variables as update-in-place
This patch fixes special cases of the update in place rewrite, where
variables that are updated but not read inside the loop were mistakenly
marked for update-in-place. We now properly reject these cases which
avoids an unnecessary matrix copy on loop entry.
Project: http://git-wip-us.apache.org/repos/asf/systemml/repo
Commit: http://git-wip-us.apache.org/repos/asf/systemml/commit/a2bf0006
Tree: http://git-wip-us.apache.org/repos/asf/systemml/tree/a2bf0006
Diff: http://git-wip-us.apache.org/repos/asf/systemml/diff/a2bf0006
Branch: refs/heads/master
Commit: a2bf0006f26e2c0058d1ee2c63b7ff0e3360466f
Parents: e84e07a
Author: Matthias Boehm <mb...@gmail.com>
Authored: Tue Aug 15 19:22:23 2017 -0700
Committer: Matthias Boehm <mb...@gmail.com>
Committed: Tue Aug 15 19:22:23 2017 -0700
----------------------------------------------------------------------
.../hops/rewrite/RewriteMarkLoopVariablesUpdateInPlace.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/systemml/blob/a2bf0006/src/main/java/org/apache/sysml/hops/rewrite/RewriteMarkLoopVariablesUpdateInPlace.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/rewrite/RewriteMarkLoopVariablesUpdateInPlace.java b/src/main/java/org/apache/sysml/hops/rewrite/RewriteMarkLoopVariablesUpdateInPlace.java
index a61dd43..9c6efb3 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/RewriteMarkLoopVariablesUpdateInPlace.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/RewriteMarkLoopVariablesUpdateInPlace.java
@@ -99,12 +99,12 @@ public class RewriteMarkLoopVariablesUpdateInPlace extends StatementBlockRewrite
//recursive invocation
boolean ret = true;
for( StatementBlock sb : sbs ) {
- if( !sb.variablesRead().containsVariable(varname) )
+ if( !sb.variablesRead().containsVariable(varname)
+ && !sb.variablesUpdated().containsVariable(varname) )
continue; //valid wrt update-in-place
if( sb instanceof WhileStatementBlock || sb instanceof ForStatementBlock ) {
- ret &= sb.getUpdateInPlaceVars()
- .contains(varname);
+ ret &= sb.getUpdateInPlaceVars().contains(varname);
}
else if( sb instanceof IfStatementBlock ) {
IfStatementBlock isb = (IfStatementBlock) sb;