-
Notifications
You must be signed in to change notification settings - Fork 542
[WIP][SYSTEMDS-3907] tee ooc operator #2317
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -89,5 +89,5 @@ public enum InstructionType { | |
| PMM, | ||
| MatrixReshape, | ||
| Write, | ||
| Init, | ||
| Init, Tee, | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,12 +32,8 @@ | |
| import org.apache.sysds.conf.CompilerConfig.ConfigType; | ||
| import org.apache.sysds.conf.ConfigurationManager; | ||
| import org.apache.sysds.hops.rewrite.HopRewriteUtils; | ||
| import org.apache.sysds.lops.Data; | ||
| import org.apache.sysds.lops.Federated; | ||
| import org.apache.sysds.lops.Lop; | ||
| import org.apache.sysds.lops.*; | ||
| import org.apache.sysds.common.Types.ExecType; | ||
| import org.apache.sysds.lops.LopsException; | ||
| import org.apache.sysds.lops.Sql; | ||
| import org.apache.sysds.parser.DataExpression; | ||
| import static org.apache.sysds.parser.DataExpression.FED_RANGES; | ||
| import org.apache.sysds.runtime.controlprogram.caching.MatrixObject.UpdateType; | ||
|
|
@@ -60,6 +56,8 @@ public class DataOp extends Hop { | |
|
|
||
| private boolean _recompileRead = true; | ||
|
|
||
| private boolean _isTeeOp = false; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would rather make it a op-type of DataOp like TWRITE. |
||
|
|
||
| /** | ||
| * List of "named" input parameters. They are maintained as a hashmap: | ||
| * parameter names (String) are mapped as indices (Integer) into getInput() | ||
|
|
@@ -73,6 +71,10 @@ public class DataOp extends Hop { | |
| private DataOp() { | ||
| //default constructor for clone | ||
| } | ||
|
|
||
| public void setIsTeeOp(boolean isTeeOp) { | ||
| this._isTeeOp = isTeeOp; | ||
| } | ||
|
|
||
| /** | ||
| * READ operation for Matrix w/ dim1, dim2. | ||
|
|
@@ -251,56 +253,66 @@ public Lop constructLops() | |
|
|
||
| ExecType et = optFindExecType(); | ||
| Lop l = null; | ||
|
|
||
| // construct lops for all input parameters | ||
| HashMap<String, Lop> inputLops = new HashMap<>(); | ||
| for (Entry<String, Integer> cur : _paramIndexMap.entrySet()) { | ||
| inputLops.put(cur.getKey(), getInput().get(cur.getValue()).constructLops()); | ||
|
|
||
| if (_isTeeOp) { | ||
| Tee teeLop = new Tee(getInput().get(0).constructLops(), | ||
| getDataType(), getValueType()); | ||
| setLineNumbers(teeLop); | ||
| setLops(teeLop); | ||
| setOutputDimensions(teeLop); | ||
| } | ||
| else { | ||
|
|
||
| // Create the lop | ||
| switch(_op) | ||
| { | ||
| case TRANSIENTREAD: | ||
| l = new Data(_op, null, inputLops, getName(), null, | ||
| getDataType(), getValueType(), getFileFormat()); | ||
| setOutputDimensions(l); | ||
| break; | ||
|
|
||
| case PERSISTENTREAD: | ||
| l = new Data(_op, null, inputLops, getName(), null, | ||
| getDataType(), getValueType(), getFileFormat()); | ||
| l.getOutputParameters().setDimensions(getDim1(), getDim2(), _inBlocksize, getNnz(), getUpdateType()); | ||
| break; | ||
|
|
||
| case PERSISTENTWRITE: | ||
| case FUNCTIONOUTPUT: | ||
| l = new Data(_op, getInput().get(0).constructLops(), inputLops, getName(), null, | ||
| getDataType(), getValueType(), getFileFormat()); | ||
| ((Data)l).setExecType(et); | ||
| setOutputDimensions(l); | ||
| break; | ||
|
|
||
| case TRANSIENTWRITE: | ||
| l = new Data(_op, getInput().get(0).constructLops(), inputLops, getName(), null, | ||
| getDataType(), getValueType(), getFileFormat()); | ||
| setOutputDimensions(l); | ||
| break; | ||
|
|
||
| case SQLREAD: | ||
| l = new Sql(inputLops, getDataType(), getValueType()); | ||
| break; | ||
|
|
||
| case FEDERATED: | ||
| l = new Federated(inputLops, getDataType(), getValueType()); | ||
| break; | ||
|
|
||
| default: | ||
| throw new LopsException("Invalid operation type for Data LOP: " + _op); | ||
| // construct lops for all input parameters | ||
| HashMap<String, Lop> inputLops = new HashMap<>(); | ||
| for (Entry<String, Integer> cur : _paramIndexMap.entrySet()) { | ||
| inputLops.put(cur.getKey(), getInput().get(cur.getValue()).constructLops()); | ||
| } | ||
|
|
||
| // Create the lop | ||
| switch (_op) { | ||
| case TRANSIENTREAD: | ||
| l = new Data(_op, null, inputLops, getName(), null, | ||
| getDataType(), getValueType(), getFileFormat()); | ||
| setOutputDimensions(l); | ||
| break; | ||
|
|
||
| case PERSISTENTREAD: | ||
| l = new Data(_op, null, inputLops, getName(), null, | ||
| getDataType(), getValueType(), getFileFormat()); | ||
| l.getOutputParameters().setDimensions(getDim1(), getDim2(), _inBlocksize, getNnz(), getUpdateType()); | ||
| break; | ||
|
|
||
| case PERSISTENTWRITE: | ||
| case FUNCTIONOUTPUT: | ||
| l = new Data(_op, getInput().get(0).constructLops(), inputLops, getName(), null, | ||
| getDataType(), getValueType(), getFileFormat()); | ||
| ((Data) l).setExecType(et); | ||
| setOutputDimensions(l); | ||
| break; | ||
|
|
||
| case TRANSIENTWRITE: | ||
| l = new Data(_op, getInput().get(0).constructLops(), inputLops, getName(), null, | ||
| getDataType(), getValueType(), getFileFormat()); | ||
| setOutputDimensions(l); | ||
| break; | ||
|
|
||
| case SQLREAD: | ||
| l = new Sql(inputLops, getDataType(), getValueType()); | ||
| break; | ||
|
|
||
| case FEDERATED: | ||
| l = new Federated(inputLops, getDataType(), getValueType()); | ||
| break; | ||
|
|
||
| default: | ||
| throw new LopsException("Invalid operation type for Data LOP: " + _op); | ||
| } | ||
| setLineNumbers(l); | ||
| setLops(l); | ||
| } | ||
|
|
||
| setLineNumbers(l); | ||
| setLops(l); | ||
| // setLineNumbers(l); | ||
| // setLops(l); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the line numbers and lops should also be set for the TeeOp |
||
|
|
||
| //add reblock/checkpoint lops if necessary | ||
| constructAndSetLopsDataFlowProperties(); | ||
|
|
@@ -346,6 +358,9 @@ public boolean isFederatedDataOp(){ | |
| public String getOpString() { | ||
| String s = new String(""); | ||
| s += _op.toString(); | ||
| if (_isTeeOp) { | ||
| s += " tee"; | ||
| } | ||
| s += " "+getName(); | ||
| return s; | ||
| } | ||
|
|
@@ -536,6 +551,7 @@ public Object clone() throws CloneNotSupportedException | |
| ret._inFormat = _inFormat; | ||
| ret._inBlocksize = _inBlocksize; | ||
| ret._recompileRead = _recompileRead; | ||
| ret._isTeeOp = _isTeeOp; // copy the Tee flag | ||
| ret._paramIndexMap = (HashMap<String, Integer>) _paramIndexMap.clone(); | ||
| //note: no deep cp of params since read-only | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll remove *
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes exactly - let's try to avoid the wildcard imports (to avoid ambiguity).