http://git-wip-us.apache.org/repos/asf/systemml/blob/648eb21d/src/main/java/org/apache/sysml/runtime/instructions/cp/ConvolutionCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/ConvolutionCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/ConvolutionCPInstruction.java index 840b39e..f12cb7f 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/ConvolutionCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/ConvolutionCPInstruction.java @@ -220,8 +220,8 @@ public class ConvolutionCPInstruction extends UnaryCPInstruction public void processReluBackwardInstruction(ExecutionContext ec) throws DMLRuntimeException { // (X > 0) * dout - MatrixBlock input = ec.getMatrixInput(input1.getName()); - MatrixBlock dout = ec.getMatrixInput(_in2.getName()); + MatrixBlock input = ec.getMatrixInput(input1.getName(), getExtendedOpcode()); + MatrixBlock dout = ec.getMatrixInput(_in2.getName(), getExtendedOpcode()); MatrixBlock outputBlock = new MatrixBlock(input.getNumRows(), input.getNumColumns(), (input.isInSparseFormat() || dout.isInSparseFormat())); if( !input.isEmpty() && !dout.isEmpty() ) { @@ -230,14 +230,14 @@ public class ConvolutionCPInstruction extends UnaryCPInstruction } // release inputs/outputs - ec.releaseMatrixInput(input1.getName()); - ec.releaseMatrixInput(_in2.getName()); - ec.setMatrixOutput(getOutputVariableName(), outputBlock); + ec.releaseMatrixInput(input1.getName(), getExtendedOpcode()); + ec.releaseMatrixInput(_in2.getName(), getExtendedOpcode()); + ec.setMatrixOutput(getOutputVariableName(), outputBlock, getExtendedOpcode()); } public void processBiasAddInstruction(ExecutionContext ec) throws DMLRuntimeException { - MatrixBlock input = ec.getMatrixInput(input1.getName()); - MatrixBlock bias = ec.getMatrixInput(_in2.getName()); + MatrixBlock input = ec.getMatrixInput(input1.getName(), getExtendedOpcode()); + MatrixBlock bias = ec.getMatrixInput(_in2.getName(), getExtendedOpcode()); MatrixBlock outputBlock = null; if(bias.getNumColumns() != 1) { @@ -258,14 +258,14 @@ public class ConvolutionCPInstruction extends UnaryCPInstruction } // release inputs/outputs - ec.releaseMatrixInput(input1.getName()); - ec.releaseMatrixInput(_in2.getName()); - ec.setMatrixOutput(getOutputVariableName(), outputBlock); + ec.releaseMatrixInput(input1.getName(), getExtendedOpcode()); + ec.releaseMatrixInput(_in2.getName(), getExtendedOpcode()); + ec.setMatrixOutput(getOutputVariableName(), outputBlock, getExtendedOpcode()); } public void processBiasMultiplyInstruction(ExecutionContext ec) throws DMLRuntimeException { - MatrixBlock input = ec.getMatrixInput(input1.getName()); - MatrixBlock bias = ec.getMatrixInput(_in2.getName()); + MatrixBlock input = ec.getMatrixInput(input1.getName(), getExtendedOpcode()); + MatrixBlock bias = ec.getMatrixInput(_in2.getName(), getExtendedOpcode()); MatrixBlock outputBlock = null; if(bias.getNumColumns() != 1) { @@ -284,9 +284,9 @@ public class ConvolutionCPInstruction extends UnaryCPInstruction } // release inputs/outputs - ec.releaseMatrixInput(input1.getName()); - ec.releaseMatrixInput(_in2.getName()); - ec.setMatrixOutput(getOutputVariableName(), outputBlock); + ec.releaseMatrixInput(input1.getName(), getExtendedOpcode()); + ec.releaseMatrixInput(_in2.getName(), getExtendedOpcode()); + ec.setMatrixOutput(getOutputVariableName(), outputBlock, getExtendedOpcode()); } // Assumption: enableNative && NativeHelper.isNativeLibraryLoaded() is true @@ -319,7 +319,7 @@ public class ConvolutionCPInstruction extends UnaryCPInstruction // acquire inputs MatrixBlock outputBlock = null; - MatrixBlock matBlock = ec.getMatrixInput(input1.getName()); + MatrixBlock matBlock = ec.getMatrixInput(input1.getName(), getExtendedOpcode()); int pad_h = getScalarInput(ec, _padding, 0); int pad_w = getScalarInput(ec, _padding, 1); int stride_h = getScalarInput(ec, _stride, 0); @@ -351,7 +351,7 @@ public class ConvolutionCPInstruction extends UnaryCPInstruction } } else if (instOpcode.equalsIgnoreCase("maxpooling_backward") || instOpcode.equalsIgnoreCase("relu_maxpooling_backward")) { - MatrixBlock dout = ec.getMatrixInput(_in2.getName()); + MatrixBlock dout = ec.getMatrixInput(_in2.getName(), getExtendedOpcode()); if(matBlock.isEmpty() || dout.isEmpty()) { outputBlock = new MatrixBlock(N, C*H*W, true); } @@ -362,10 +362,10 @@ public class ConvolutionCPInstruction extends UnaryCPInstruction else LibMatrixDNN.maxpoolingBackward(matBlock, dout, outputBlock, params, true); } - ec.releaseMatrixInput(_in2.getName()); + ec.releaseMatrixInput(_in2.getName(), getExtendedOpcode()); } else if (instOpcode.equalsIgnoreCase("conv2d")) { - MatrixBlock filter = ec.getMatrixInput(_in2.getName()); + MatrixBlock filter = ec.getMatrixInput(_in2.getName(), getExtendedOpcode()); if(filter.isEmpty() || matBlock.isEmpty()) { outputBlock = new MatrixBlock(N, K*P*Q, true); } @@ -376,11 +376,11 @@ public class ConvolutionCPInstruction extends UnaryCPInstruction else LibMatrixDNN.conv2d(matBlock, filter, outputBlock, params); } - ec.releaseMatrixInput(_in2.getName()); + ec.releaseMatrixInput(_in2.getName(), getExtendedOpcode()); } else if (instOpcode.equalsIgnoreCase("conv2d_bias_add")) { - MatrixBlock filter = ec.getMatrixInput(_in3.getName()); - MatrixBlock bias = ec.getMatrixInput(_in2.getName()); + MatrixBlock filter = ec.getMatrixInput(_in3.getName(), getExtendedOpcode()); + MatrixBlock bias = ec.getMatrixInput(_in2.getName(), getExtendedOpcode()); if(bias.getNumRows() != params.K || bias.getNumColumns() != 1) { throw new DMLRuntimeException("Incorrect shape of bias matrix: [" + bias.getNumRows() + " " + bias.getNumColumns() + "]. " + "Expected: [" + params.K + ", 1]"); @@ -408,11 +408,11 @@ public class ConvolutionCPInstruction extends UnaryCPInstruction else LibMatrixDNN.conv2d(matBlock, filter, outputBlock, params); } - ec.releaseMatrixInput(_in3.getName()); - ec.releaseMatrixInput(_in2.getName()); + ec.releaseMatrixInput(_in3.getName(), getExtendedOpcode()); + ec.releaseMatrixInput(_in2.getName(), getExtendedOpcode()); } else if (instOpcode.equalsIgnoreCase("conv2d_backward_filter")) { - MatrixBlock dout = ec.getMatrixInput(_in2.getName()); + MatrixBlock dout = ec.getMatrixInput(_in2.getName(), getExtendedOpcode()); if(dout.isEmpty() || matBlock.isEmpty()) { outputBlock = new MatrixBlock(K, C*R*S, true); } @@ -423,10 +423,10 @@ public class ConvolutionCPInstruction extends UnaryCPInstruction else LibMatrixDNN.conv2dBackwardFilter(matBlock, dout, outputBlock, params); } - ec.releaseMatrixInput(_in2.getName()); + ec.releaseMatrixInput(_in2.getName(), getExtendedOpcode()); } else if (instOpcode.equalsIgnoreCase("conv2d_backward_data")) { - MatrixBlock dout = ec.getMatrixInput(_in2.getName()); + MatrixBlock dout = ec.getMatrixInput(_in2.getName(), getExtendedOpcode()); if(dout.isEmpty() || matBlock.isEmpty()) { outputBlock = new MatrixBlock(N, C * H * W, true); } @@ -437,15 +437,15 @@ public class ConvolutionCPInstruction extends UnaryCPInstruction else LibMatrixDNN.conv2dBackwardData(matBlock, dout, outputBlock, params); } - ec.releaseMatrixInput(_in2.getName()); + ec.releaseMatrixInput(_in2.getName(), getExtendedOpcode()); } else { throw new DMLRuntimeException("Unsupported op code " + instOpcode); } // release inputs/outputs - ec.releaseMatrixInput(input1.getName()); - ec.setMatrixOutput(getOutputVariableName(), outputBlock); + ec.releaseMatrixInput(input1.getName(), getExtendedOpcode()); + ec.setMatrixOutput(getOutputVariableName(), outputBlock, getExtendedOpcode()); } private MatrixBlock getDenseOutputBlock(int numRows, int numCols) throws DMLRuntimeException {
http://git-wip-us.apache.org/repos/asf/systemml/blob/648eb21d/src/main/java/org/apache/sysml/runtime/instructions/cp/CovarianceCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/CovarianceCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/CovarianceCPInstruction.java index cbb06aa..d2e43e2 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/CovarianceCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/CovarianceCPInstruction.java @@ -80,8 +80,8 @@ public class CovarianceCPInstruction extends BinaryCPInstruction public void processInstruction(ExecutionContext ec) throws DMLRuntimeException { - MatrixBlock matBlock1 = ec.getMatrixInput(input1.getName()); - MatrixBlock matBlock2 = ec.getMatrixInput(input2.getName()); + MatrixBlock matBlock1 = ec.getMatrixInput(input1.getName(), getExtendedOpcode()); + MatrixBlock matBlock2 = ec.getMatrixInput(input2.getName(), getExtendedOpcode()); String output_name = output.getName(); COVOperator cov_op = (COVOperator)_optr; @@ -92,19 +92,19 @@ public class CovarianceCPInstruction extends BinaryCPInstruction // Unweighted: cov.mvar0.mvar1.out covobj = matBlock1.covOperations(cov_op, matBlock2); - ec.releaseMatrixInput(input1.getName()); - ec.releaseMatrixInput(input2.getName()); + ec.releaseMatrixInput(input1.getName(), getExtendedOpcode()); + ec.releaseMatrixInput(input2.getName(), getExtendedOpcode()); } else { // Weighted: cov.mvar0.mvar1.weights.out - MatrixBlock wtBlock = ec.getMatrixInput(input3.getName()); + MatrixBlock wtBlock = ec.getMatrixInput(input3.getName(), getExtendedOpcode()); covobj = matBlock1.covOperations(cov_op, matBlock2, wtBlock); - ec.releaseMatrixInput(input1.getName()); - ec.releaseMatrixInput(input2.getName()); - ec.releaseMatrixInput(input3.getName()); + ec.releaseMatrixInput(input1.getName(), getExtendedOpcode()); + ec.releaseMatrixInput(input2.getName(), getExtendedOpcode()); + ec.releaseMatrixInput(input3.getName(), getExtendedOpcode()); } double val = covobj.getRequiredResult(_optr); http://git-wip-us.apache.org/repos/asf/systemml/blob/648eb21d/src/main/java/org/apache/sysml/runtime/instructions/cp/DataGenCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/DataGenCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/DataGenCPInstruction.java index 7cd4f77..73e4cf1 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/DataGenCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/DataGenCPInstruction.java @@ -327,6 +327,6 @@ public class DataGenCPInstruction extends UnaryCPInstruction } //release created output - ec.setMatrixOutput(output.getName(), soresBlock); + ec.setMatrixOutput(output.getName(), soresBlock, getExtendedOpcode()); } } http://git-wip-us.apache.org/repos/asf/systemml/blob/648eb21d/src/main/java/org/apache/sysml/runtime/instructions/cp/DataPartitionCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/DataPartitionCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/DataPartitionCPInstruction.java index 2b75460..68151d2 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/DataPartitionCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/DataPartitionCPInstruction.java @@ -97,6 +97,6 @@ public class DataPartitionCPInstruction extends UnaryCPInstruction } //release input - ec.releaseMatrixInput(input1.getName()); + ec.releaseMatrixInput(input1.getName(), getExtendedOpcode()); } } http://git-wip-us.apache.org/repos/asf/systemml/blob/648eb21d/src/main/java/org/apache/sysml/runtime/instructions/cp/MMChainCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/MMChainCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/MMChainCPInstruction.java index 3fee0d1..273dd2a 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/MMChainCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/MMChainCPInstruction.java @@ -75,20 +75,20 @@ public class MMChainCPInstruction extends UnaryCPInstruction throws DMLRuntimeException { //get inputs - MatrixBlock X = ec.getMatrixInput(input1.getName()); - MatrixBlock v = ec.getMatrixInput(input2.getName()); + MatrixBlock X = ec.getMatrixInput(input1.getName(), getExtendedOpcode()); + MatrixBlock v = ec.getMatrixInput(input2.getName(), getExtendedOpcode()); MatrixBlock w = (_type==ChainType.XtwXv || _type==ChainType.XtXvy) ? - ec.getMatrixInput(input3.getName()) : null; + ec.getMatrixInput(input3.getName(), getExtendedOpcode()) : null; //execute mmchain operation MatrixBlock out = (MatrixBlock) X.chainMatrixMultOperations(v, w, new MatrixBlock(), _type, _numThreads); //set output and release inputs - ec.setMatrixOutput(output.getName(), out); - ec.releaseMatrixInput(input1.getName()); - ec.releaseMatrixInput(input2.getName()); + ec.setMatrixOutput(output.getName(), out, getExtendedOpcode()); + ec.releaseMatrixInput(input1.getName(), getExtendedOpcode()); + ec.releaseMatrixInput(input2.getName(), getExtendedOpcode()); if( w !=null ) - ec.releaseMatrixInput(input3.getName()); + ec.releaseMatrixInput(input3.getName(), getExtendedOpcode()); } public ChainType getMMChainType() http://git-wip-us.apache.org/repos/asf/systemml/blob/648eb21d/src/main/java/org/apache/sysml/runtime/instructions/cp/MMTSJCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/MMTSJCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/MMTSJCPInstruction.java index ccc472b..361da7f 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/MMTSJCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/MMTSJCPInstruction.java @@ -63,14 +63,14 @@ public class MMTSJCPInstruction extends UnaryCPInstruction throws DMLRuntimeException { //get inputs - MatrixBlock matBlock1 = ec.getMatrixInput(input1.getName()); + MatrixBlock matBlock1 = ec.getMatrixInput(input1.getName(), getExtendedOpcode()); //execute operations MatrixBlock ret = (MatrixBlock) matBlock1.transposeSelfMatrixMultOperations(new MatrixBlock(), _type, _numThreads ); //set output and release inputs - ec.setMatrixOutput(output.getName(), ret); - ec.releaseMatrixInput(input1.getName()); + ec.setMatrixOutput(output.getName(), ret, getExtendedOpcode()); + ec.releaseMatrixInput(input1.getName(), getExtendedOpcode()); } public MMTSJType getMMTSJType() http://git-wip-us.apache.org/repos/asf/systemml/blob/648eb21d/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixAppendCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixAppendCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixAppendCPInstruction.java index 4c48ed7..ec6bf09 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixAppendCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixAppendCPInstruction.java @@ -35,8 +35,8 @@ public final class MatrixAppendCPInstruction extends AppendCPInstruction throws DMLRuntimeException { //get inputs - MatrixBlock matBlock1 = ec.getMatrixInput(input1.getName()); - MatrixBlock matBlock2 = ec.getMatrixInput(input2.getName()); + MatrixBlock matBlock1 = ec.getMatrixInput(input1.getName(), getExtendedOpcode()); + MatrixBlock matBlock2 = ec.getMatrixInput(input2.getName(), getExtendedOpcode()); //check input dimensions if( _type == AppendType.CBIND && matBlock1.getNumRows() != matBlock2.getNumRows() ) { @@ -52,8 +52,8 @@ public final class MatrixAppendCPInstruction extends AppendCPInstruction MatrixBlock ret = matBlock1.appendOperations(matBlock2, new MatrixBlock(), _type==AppendType.CBIND); //set output and release inputs - ec.setMatrixOutput(output.getName(), ret); - ec.releaseMatrixInput(input1.getName()); - ec.releaseMatrixInput(input2.getName()); + ec.setMatrixOutput(output.getName(), ret, getExtendedOpcode()); + ec.releaseMatrixInput(input1.getName(), getExtendedOpcode()); + ec.releaseMatrixInput(input2.getName(), getExtendedOpcode()); } } http://git-wip-us.apache.org/repos/asf/systemml/blob/648eb21d/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixBuiltinCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixBuiltinCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixBuiltinCPInstruction.java index 003b85d..7817c06 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixBuiltinCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixBuiltinCPInstruction.java @@ -43,20 +43,20 @@ public class MatrixBuiltinCPInstruction extends BuiltinUnaryCPInstruction String opcode = getOpcode(); if(LibCommonsMath.isSupportedUnaryOperation(opcode)) { MatrixBlock retBlock = LibCommonsMath.unaryOperations(ec.getMatrixObject(input1.getName()),getOpcode()); - ec.setMatrixOutput(output_name, retBlock); + ec.setMatrixOutput(output_name, retBlock, getExtendedOpcode()); } else { - MatrixBlock inBlock = ec.getMatrixInput(input1.getName()); + MatrixBlock inBlock = ec.getMatrixInput(input1.getName(), getExtendedOpcode()); MatrixBlock retBlock = (MatrixBlock) (inBlock.unaryOperations(u_op, new MatrixBlock())); - ec.releaseMatrixInput(input1.getName()); + ec.releaseMatrixInput(input1.getName(), getExtendedOpcode()); // Ensure right dense/sparse output representation (guarded by released input memory) if( checkGuardedRepresentationChange(inBlock, retBlock) ) { retBlock.examSparsity(); } - ec.setMatrixOutput(output_name, retBlock); + ec.setMatrixOutput(output_name, retBlock, getExtendedOpcode()); } } } http://git-wip-us.apache.org/repos/asf/systemml/blob/648eb21d/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixIndexingCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixIndexingCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixIndexingCPInstruction.java index 4d99a32..b2e416c 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixIndexingCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixIndexingCPInstruction.java @@ -61,19 +61,19 @@ public final class MatrixIndexingCPInstruction extends IndexingCPInstruction else //via slicing the in-memory matrix { //execute right indexing operation - MatrixBlock matBlock = ec.getMatrixInput(input1.getName()); + MatrixBlock matBlock = ec.getMatrixInput(input1.getName(), getExtendedOpcode()); resultBlock = matBlock.sliceOperations(ixrange, new MatrixBlock()); //unpin rhs input - ec.releaseMatrixInput(input1.getName()); + ec.releaseMatrixInput(input1.getName(), getExtendedOpcode()); //ensure correct sparse/dense output representation //(memory guarded by release of input) - resultBlock.examSparsity(); + resultBlock.examSparsity(getExtendedOpcode()); } //unpin output - ec.setMatrixOutput(output.getName(), resultBlock); + ec.setMatrixOutput(output.getName(), resultBlock, getExtendedOpcode()); } //left indexing else if ( opcode.equalsIgnoreCase("leftIndex")) @@ -86,14 +86,14 @@ public final class MatrixIndexingCPInstruction extends IndexingCPInstruction Statistics.incrementTotalLix(); } - MatrixBlock matBlock = ec.getMatrixInput(input1.getName()); + MatrixBlock matBlock = ec.getMatrixInput(input1.getName(), getExtendedOpcode()); MatrixBlock resultBlock = null; if(input2.getDataType() == DataType.MATRIX) //MATRIX<-MATRIX { - MatrixBlock rhsMatBlock = ec.getMatrixInput(input2.getName()); - resultBlock = matBlock.leftIndexingOperations(rhsMatBlock, ixrange, new MatrixBlock(), updateType); - ec.releaseMatrixInput(input2.getName()); + MatrixBlock rhsMatBlock = ec.getMatrixInput(input2.getName(), getExtendedOpcode()); + resultBlock = matBlock.leftIndexingOperations(rhsMatBlock, ixrange, new MatrixBlock(), updateType, getExtendedOpcode()); + ec.releaseMatrixInput(input2.getName(), getExtendedOpcode()); } else //MATRIX<-SCALAR { @@ -105,14 +105,14 @@ public final class MatrixIndexingCPInstruction extends IndexingCPInstruction } //unpin lhs input - ec.releaseMatrixInput(input1.getName()); + ec.releaseMatrixInput(input1.getName(), getExtendedOpcode()); //ensure correct sparse/dense output representation //(memory guarded by release of input) - resultBlock.examSparsity(); + resultBlock.examSparsity(getExtendedOpcode()); //unpin output - ec.setMatrixOutput(output.getName(), resultBlock, updateType); + ec.setMatrixOutput(output.getName(), resultBlock, updateType, getExtendedOpcode()); } else throw new DMLRuntimeException("Invalid opcode (" + opcode +") encountered in MatrixIndexingCPInstruction."); http://git-wip-us.apache.org/repos/asf/systemml/blob/648eb21d/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixMatrixArithmeticCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixMatrixArithmeticCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixMatrixArithmeticCPInstruction.java index 208b688..7216418 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixMatrixArithmeticCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixMatrixArithmeticCPInstruction.java @@ -43,16 +43,16 @@ public class MatrixMatrixArithmeticCPInstruction extends ArithmeticBinaryCPInstr throws DMLRuntimeException { // Read input matrices - MatrixBlock inBlock1 = ec.getMatrixInput(input1.getName()); - MatrixBlock inBlock2 = ec.getMatrixInput(input2.getName()); + MatrixBlock inBlock1 = ec.getMatrixInput(input1.getName(), getExtendedOpcode()); + MatrixBlock inBlock2 = ec.getMatrixInput(input2.getName(), getExtendedOpcode()); // Perform computation using input matrices, and produce the result matrix BinaryOperator bop = (BinaryOperator) _optr; MatrixBlock retBlock = (MatrixBlock) (inBlock1.binaryOperations (bop, inBlock2, new MatrixBlock())); // Release the memory occupied by input matrices - ec.releaseMatrixInput(input1.getName()); - ec.releaseMatrixInput(input2.getName()); + ec.releaseMatrixInput(input1.getName(), getExtendedOpcode()); + ec.releaseMatrixInput(input2.getName(), getExtendedOpcode()); // Ensure right dense/sparse output representation (guarded by released input memory) if( checkGuardedRepresentationChange(inBlock1, inBlock2, retBlock) ) { @@ -60,6 +60,6 @@ public class MatrixMatrixArithmeticCPInstruction extends ArithmeticBinaryCPInstr } // Attach result matrix with MatrixObject associated with output_name - ec.setMatrixOutput(output.getName(), retBlock); + ec.setMatrixOutput(output.getName(), retBlock, getExtendedOpcode()); } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/systemml/blob/648eb21d/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixMatrixBuiltinCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixMatrixBuiltinCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixMatrixBuiltinCPInstruction.java index daba3bc..348b9d6 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixMatrixBuiltinCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixMatrixBuiltinCPInstruction.java @@ -48,7 +48,7 @@ public class MatrixMatrixBuiltinCPInstruction extends BuiltinBinaryCPInstruction if ( LibCommonsMath.isSupportedMatrixMatrixOperation(opcode) ) { MatrixBlock solution = LibCommonsMath.matrixMatrixOperations(ec.getMatrixObject(input1.getName()), (MatrixObject)ec.getVariable(input2.getName()), opcode); - ec.setMatrixOutput(output.getName(), solution); + ec.setMatrixOutput(output.getName(), solution, getExtendedOpcode()); return; } @@ -56,19 +56,19 @@ public class MatrixMatrixBuiltinCPInstruction extends BuiltinBinaryCPInstruction String output_name = output.getName(); BinaryOperator bop = (BinaryOperator) _optr; - MatrixBlock inBlock1 = ec.getMatrixInput(input1.getName()); - MatrixBlock inBlock2 = ec.getMatrixInput(input2.getName()); + MatrixBlock inBlock1 = ec.getMatrixInput(input1.getName(), getExtendedOpcode()); + MatrixBlock inBlock2 = ec.getMatrixInput(input2.getName(), getExtendedOpcode()); MatrixBlock retBlock = (MatrixBlock) inBlock1.binaryOperations(bop, inBlock2, new MatrixBlock()); - ec.releaseMatrixInput(input1.getName()); - ec.releaseMatrixInput(input2.getName()); + ec.releaseMatrixInput(input1.getName(), getExtendedOpcode()); + ec.releaseMatrixInput(input2.getName(), getExtendedOpcode()); // Ensure right dense/sparse output representation (guarded by released input memory) if( checkGuardedRepresentationChange(inBlock1, inBlock2, retBlock) ) { retBlock.examSparsity(); } - ec.setMatrixOutput(output_name, retBlock); + ec.setMatrixOutput(output_name, retBlock, getExtendedOpcode()); } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/systemml/blob/648eb21d/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixMatrixRelationalCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixMatrixRelationalCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixMatrixRelationalCPInstruction.java index f972748..fd6bd8b 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixMatrixRelationalCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixMatrixRelationalCPInstruction.java @@ -42,22 +42,22 @@ public class MatrixMatrixRelationalCPInstruction extends RelationalBinaryCPInstr public void processInstruction(ExecutionContext ec) throws DMLRuntimeException { - MatrixBlock inBlock1 = ec.getMatrixInput(input1.getName()); - MatrixBlock inBlock2 = ec.getMatrixInput(input2.getName()); + MatrixBlock inBlock1 = ec.getMatrixInput(input1.getName(), getExtendedOpcode()); + MatrixBlock inBlock2 = ec.getMatrixInput(input2.getName(), getExtendedOpcode()); String output_name = output.getName(); BinaryOperator bop = (BinaryOperator) _optr; MatrixBlock retBlock = (MatrixBlock) inBlock1.binaryOperations(bop, inBlock2, new MatrixBlock()); - ec.releaseMatrixInput(input1.getName()); - ec.releaseMatrixInput(input2.getName()); + ec.releaseMatrixInput(input1.getName(), getExtendedOpcode()); + ec.releaseMatrixInput(input2.getName(), getExtendedOpcode()); // Ensure right dense/sparse output representation (guarded by released input memory) if( checkGuardedRepresentationChange(inBlock1, inBlock2, retBlock) ) { retBlock.examSparsity(); } - ec.setMatrixOutput(output_name, retBlock); + ec.setMatrixOutput(output_name, retBlock, getExtendedOpcode()); } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/systemml/blob/648eb21d/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixReshapeCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixReshapeCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixReshapeCPInstruction.java index 95f5af7..132428f 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixReshapeCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixReshapeCPInstruction.java @@ -68,7 +68,7 @@ public class MatrixReshapeCPInstruction extends UnaryCPInstruction throws DMLRuntimeException { //get inputs - MatrixBlock in = ec.getMatrixInput(input1.getName()); + MatrixBlock in = ec.getMatrixInput(input1.getName(), getExtendedOpcode()); int rows = (int)ec.getScalarInput(_opRows.getName(), _opRows.getValueType(), _opRows.isLiteral()).getLongValue(); //save cast int cols = (int)ec.getScalarInput(_opCols.getName(), _opCols.getValueType(), _opCols.isLiteral()).getLongValue(); //save cast BooleanObject byRow = (BooleanObject) ec.getScalarInput(_opByRow.getName(), ValueType.BOOLEAN, _opByRow.isLiteral()); @@ -78,8 +78,8 @@ public class MatrixReshapeCPInstruction extends UnaryCPInstruction out = LibMatrixReorg.reshape(in, out, rows, cols, byRow.getBooleanValue()); //set output and release inputs - ec.setMatrixOutput(output.getName(), out); - ec.releaseMatrixInput(input1.getName()); + ec.setMatrixOutput(output.getName(), out, getExtendedOpcode()); + ec.releaseMatrixInput(input1.getName(), getExtendedOpcode()); } } http://git-wip-us.apache.org/repos/asf/systemml/blob/648eb21d/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixScalarBuiltinCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixScalarBuiltinCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixScalarBuiltinCPInstruction.java index cd140ef..3cd075b 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixScalarBuiltinCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixScalarBuiltinCPInstruction.java @@ -46,7 +46,7 @@ public class MatrixScalarBuiltinCPInstruction extends BuiltinBinaryCPInstruction CPOperand mat = ( input1.getDataType() == DataType.MATRIX ) ? input1 : input2; CPOperand scalar = ( input1.getDataType() == DataType.MATRIX ) ? input2 : input1; - MatrixBlock inBlock = ec.getMatrixInput(mat.getName()); + MatrixBlock inBlock = ec.getMatrixInput(mat.getName(), getExtendedOpcode()); ScalarObject constant = (ScalarObject) ec.getScalarInput(scalar.getName(), scalar.getValueType(), scalar.isLiteral()); ScalarOperator sc_op = (ScalarOperator) _optr; @@ -54,13 +54,13 @@ public class MatrixScalarBuiltinCPInstruction extends BuiltinBinaryCPInstruction MatrixBlock retBlock = (MatrixBlock) inBlock.scalarOperations(sc_op, new MatrixBlock()); - ec.releaseMatrixInput(mat.getName()); + ec.releaseMatrixInput(mat.getName(), getExtendedOpcode()); // Ensure right dense/sparse output representation (guarded by released input memory) if( checkGuardedRepresentationChange(inBlock, retBlock) ) { retBlock.examSparsity(); } - ec.setMatrixOutput(output.getName(), retBlock); + ec.setMatrixOutput(output.getName(), retBlock, getExtendedOpcode()); } } http://git-wip-us.apache.org/repos/asf/systemml/blob/648eb21d/src/main/java/org/apache/sysml/runtime/instructions/cp/MultiReturnBuiltinCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/MultiReturnBuiltinCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/MultiReturnBuiltinCPInstruction.java index 17f9350..54d206e 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/MultiReturnBuiltinCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/MultiReturnBuiltinCPInstruction.java @@ -111,7 +111,7 @@ public class MultiReturnBuiltinCPInstruction extends ComputationCPInstruction for(int i=0; i < _outputs.size(); i++) { - ec.setMatrixOutput(_outputs.get(i).getName(), out[i]); + ec.setMatrixOutput(_outputs.get(i).getName(), out[i], getExtendedOpcode()); } } } http://git-wip-us.apache.org/repos/asf/systemml/blob/648eb21d/src/main/java/org/apache/sysml/runtime/instructions/cp/MultiReturnParameterizedBuiltinCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/MultiReturnParameterizedBuiltinCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/MultiReturnParameterizedBuiltinCPInstruction.java index 574f7ff..429bb00 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/MultiReturnParameterizedBuiltinCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/MultiReturnParameterizedBuiltinCPInstruction.java @@ -85,7 +85,7 @@ public class MultiReturnParameterizedBuiltinCPInstruction extends ComputationCPI //release input and outputs ec.releaseFrameInput(input1.getName()); - ec.setMatrixOutput(getOutput(0).getName(), data); + ec.setMatrixOutput(getOutput(0).getName(), data, getExtendedOpcode()); ec.setFrameOutput(getOutput(1).getName(), meta); } } http://git-wip-us.apache.org/repos/asf/systemml/blob/648eb21d/src/main/java/org/apache/sysml/runtime/instructions/cp/PMMJCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/PMMJCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/PMMJCPInstruction.java index 99f031c..75deaae 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/PMMJCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/PMMJCPInstruction.java @@ -60,8 +60,8 @@ public class PMMJCPInstruction extends ComputationCPInstruction throws DMLRuntimeException { //get inputs - MatrixBlock matBlock1 = ec.getMatrixInput(input1.getName()); - MatrixBlock matBlock2 = ec.getMatrixInput(input2.getName()); + MatrixBlock matBlock1 = ec.getMatrixInput(input1.getName(), getExtendedOpcode()); + MatrixBlock matBlock2 = ec.getMatrixInput(input2.getName(), getExtendedOpcode()); int rlen = (int)ec.getScalarInput(input3.getName(), input3.getValueType(), input3.isLiteral()).getLongValue(); //execute operations @@ -69,8 +69,8 @@ public class PMMJCPInstruction extends ComputationCPInstruction matBlock1.permutationMatrixMultOperations(matBlock2, ret, null, _numThreads); //set output and release inputs - ec.setMatrixOutput(output.getName(), ret); - ec.releaseMatrixInput(input1.getName()); - ec.releaseMatrixInput(input2.getName()); + ec.setMatrixOutput(output.getName(), ret, getExtendedOpcode()); + ec.releaseMatrixInput(input1.getName(), getExtendedOpcode()); + ec.releaseMatrixInput(input2.getName(), getExtendedOpcode()); } } http://git-wip-us.apache.org/repos/asf/systemml/blob/648eb21d/src/main/java/org/apache/sysml/runtime/instructions/cp/ParameterizedBuiltinCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/ParameterizedBuiltinCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/ParameterizedBuiltinCPInstruction.java index 847d5f9..8a3d517 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/ParameterizedBuiltinCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/ParameterizedBuiltinCPInstruction.java @@ -177,11 +177,11 @@ public class ParameterizedBuiltinCPInstruction extends ComputationCPInstruction } else if ( opcode.equalsIgnoreCase("groupedagg") ) { // acquire locks - MatrixBlock target = ec.getMatrixInput(params.get(Statement.GAGG_TARGET)); - MatrixBlock groups = ec.getMatrixInput(params.get(Statement.GAGG_GROUPS)); + MatrixBlock target = ec.getMatrixInput(params.get(Statement.GAGG_TARGET), getExtendedOpcode()); + MatrixBlock groups = ec.getMatrixInput(params.get(Statement.GAGG_GROUPS), getExtendedOpcode()); MatrixBlock weights= null; if ( params.get(Statement.GAGG_WEIGHTS) != null ) - weights = ec.getMatrixInput(params.get(Statement.GAGG_WEIGHTS)); + weights = ec.getMatrixInput(params.get(Statement.GAGG_WEIGHTS), getExtendedOpcode()); int ngroups = -1; if ( params.get(Statement.GAGG_NUM_GROUPS) != null) { @@ -192,19 +192,19 @@ public class ParameterizedBuiltinCPInstruction extends ComputationCPInstruction int k = Integer.parseInt(params.get("k")); //num threads MatrixBlock soresBlock = groups.groupedAggOperations(target, weights, new MatrixBlock(), ngroups, _optr, k); - ec.setMatrixOutput(output.getName(), soresBlock); + ec.setMatrixOutput(output.getName(), soresBlock, getExtendedOpcode()); // release locks target = groups = weights = null; - ec.releaseMatrixInput(params.get(Statement.GAGG_TARGET)); - ec.releaseMatrixInput(params.get(Statement.GAGG_GROUPS)); + ec.releaseMatrixInput(params.get(Statement.GAGG_TARGET), getExtendedOpcode()); + ec.releaseMatrixInput(params.get(Statement.GAGG_GROUPS), getExtendedOpcode()); if ( params.get(Statement.GAGG_WEIGHTS) != null ) - ec.releaseMatrixInput(params.get(Statement.GAGG_WEIGHTS)); + ec.releaseMatrixInput(params.get(Statement.GAGG_WEIGHTS), getExtendedOpcode()); } else if ( opcode.equalsIgnoreCase("rmempty") ) { // acquire locks - MatrixBlock target = ec.getMatrixInput(params.get("target")); - MatrixBlock select = params.containsKey("select")? ec.getMatrixInput(params.get("select")):null; + MatrixBlock target = ec.getMatrixInput(params.get("target"), getExtendedOpcode()); + MatrixBlock select = params.containsKey("select")? ec.getMatrixInput(params.get("select"), getExtendedOpcode()):null; // compute the result String margin = params.get("margin"); @@ -217,14 +217,14 @@ public class ParameterizedBuiltinCPInstruction extends ComputationCPInstruction throw new DMLRuntimeException("Unspupported margin identifier '"+margin+"'."); //release locks - ec.setMatrixOutput(output.getName(), soresBlock); - ec.releaseMatrixInput(params.get("target")); + ec.setMatrixOutput(output.getName(), soresBlock, getExtendedOpcode()); + ec.releaseMatrixInput(params.get("target"), getExtendedOpcode()); if (params.containsKey("select")) - ec.releaseMatrixInput(params.get("select")); + ec.releaseMatrixInput(params.get("select"), getExtendedOpcode()); } else if ( opcode.equalsIgnoreCase("replace") ) { // acquire locks - MatrixBlock target = ec.getMatrixInput(params.get("target")); + MatrixBlock target = ec.getMatrixInput(params.get("target"), getExtendedOpcode()); // compute the result double pattern = Double.parseDouble( params.get("pattern") ); @@ -232,12 +232,12 @@ public class ParameterizedBuiltinCPInstruction extends ComputationCPInstruction MatrixBlock ret = (MatrixBlock) target.replaceOperations(new MatrixBlock(), pattern, replacement); //release locks - ec.setMatrixOutput(output.getName(), ret); - ec.releaseMatrixInput(params.get("target")); + ec.setMatrixOutput(output.getName(), ret, getExtendedOpcode()); + ec.releaseMatrixInput(params.get("target"), getExtendedOpcode()); } else if ( opcode.equalsIgnoreCase("rexpand") ) { // acquire locks - MatrixBlock target = ec.getMatrixInput(params.get("target")); + MatrixBlock target = ec.getMatrixInput(params.get("target"), getExtendedOpcode()); // compute the result double maxVal = Double.parseDouble( params.get("max") ); @@ -249,8 +249,8 @@ public class ParameterizedBuiltinCPInstruction extends ComputationCPInstruction new MatrixBlock(), maxVal, dirVal, cast, ignore, numThreads); //release locks - ec.setMatrixOutput(output.getName(), ret); - ec.releaseMatrixInput(params.get("target")); + ec.setMatrixOutput(output.getName(), ret, getExtendedOpcode()); + ec.releaseMatrixInput(params.get("target"), getExtendedOpcode()); } else if ( opcode.equalsIgnoreCase("transformapply")) { //acquire locks @@ -263,13 +263,13 @@ public class ParameterizedBuiltinCPInstruction extends ComputationCPInstruction MatrixBlock mbout = encoder.apply(data, new MatrixBlock(data.getNumRows(), data.getNumColumns(), false)); //release locks - ec.setMatrixOutput(output.getName(), mbout); + ec.setMatrixOutput(output.getName(), mbout, getExtendedOpcode()); ec.releaseFrameInput(params.get("target")); ec.releaseFrameInput(params.get("meta")); } else if ( opcode.equalsIgnoreCase("transformdecode")) { //acquire locks - MatrixBlock data = ec.getMatrixInput(params.get("target")); + MatrixBlock data = ec.getMatrixInput(params.get("target"), getExtendedOpcode()); FrameBlock meta = ec.getFrameInput(params.get("meta")); String[] colnames = meta.getColumnNames(); @@ -279,7 +279,7 @@ public class ParameterizedBuiltinCPInstruction extends ComputationCPInstruction //release locks ec.setFrameOutput(output.getName(), fbout); - ec.releaseMatrixInput(params.get("target")); + ec.releaseMatrixInput(params.get("target"), getExtendedOpcode()); ec.releaseFrameInput(params.get("meta")); } else if ( opcode.equalsIgnoreCase("transformmeta")) { http://git-wip-us.apache.org/repos/asf/systemml/blob/648eb21d/src/main/java/org/apache/sysml/runtime/instructions/cp/PlusMultCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/PlusMultCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/PlusMultCPInstruction.java index 12bc465..06d752e 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/PlusMultCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/PlusMultCPInstruction.java @@ -57,8 +57,8 @@ public class PlusMultCPInstruction extends ArithmeticBinaryCPInstruction String output_name = output.getName(); //get all the inputs - MatrixBlock matrix1 = ec.getMatrixInput(input1.getName()); - MatrixBlock matrix2 = ec.getMatrixInput(input2.getName()); + MatrixBlock matrix1 = ec.getMatrixInput(input1.getName(), getExtendedOpcode()); + MatrixBlock matrix2 = ec.getMatrixInput(input2.getName(), getExtendedOpcode()); ScalarObject scalar = ec.getScalarInput(input3.getName(), input3.getValueType(), input3.isLiteral()); //execution @@ -66,9 +66,9 @@ public class PlusMultCPInstruction extends ArithmeticBinaryCPInstruction MatrixBlock out = (MatrixBlock) matrix1.binaryOperations((BinaryOperator) _optr, matrix2, new MatrixBlock()); //release the matrices - ec.releaseMatrixInput(input1.getName()); - ec.releaseMatrixInput(input2.getName()); + ec.releaseMatrixInput(input1.getName(), getExtendedOpcode()); + ec.releaseMatrixInput(input2.getName(), getExtendedOpcode()); - ec.setMatrixOutput(output_name, out); + ec.setMatrixOutput(output_name, out, getExtendedOpcode()); } } http://git-wip-us.apache.org/repos/asf/systemml/blob/648eb21d/src/main/java/org/apache/sysml/runtime/instructions/cp/QuantilePickCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/QuantilePickCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/QuantilePickCPInstruction.java index 693de24..eb9e256 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/QuantilePickCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/QuantilePickCPInstruction.java @@ -105,7 +105,7 @@ public class QuantilePickCPInstruction extends BinaryCPInstruction case VALUEPICK: if( _inmem ) //INMEM VALUEPICK { - MatrixBlock matBlock = ec.getMatrixInput(input1.getName()); + MatrixBlock matBlock = ec.getMatrixInput(input1.getName(), getExtendedOpcode()); if ( input2.getDataType() == DataType.SCALAR ) { ScalarObject quantile = ec.getScalarInput(input2.getName(), input2.getValueType(), input2.isLiteral()); @@ -113,13 +113,13 @@ public class QuantilePickCPInstruction extends BinaryCPInstruction ec.setScalarOutput(output.getName(), new DoubleObject(picked)); } else { - MatrixBlock quantiles = ec.getMatrixInput(input2.getName()); + MatrixBlock quantiles = ec.getMatrixInput(input2.getName(), getExtendedOpcode()); MatrixBlock resultBlock = (MatrixBlock) matBlock.pickValues(quantiles, new MatrixBlock()); quantiles = null; - ec.releaseMatrixInput(input2.getName()); - ec.setMatrixOutput(output.getName(), resultBlock); + ec.releaseMatrixInput(input2.getName(), getExtendedOpcode()); + ec.setMatrixOutput(output.getName(), resultBlock, getExtendedOpcode()); } - ec.releaseMatrixInput(input1.getName()); + ec.releaseMatrixInput(input1.getName(), getExtendedOpcode()); } else //MR VALUEPICK { @@ -145,9 +145,9 @@ public class QuantilePickCPInstruction extends BinaryCPInstruction case MEDIAN: if( _inmem ) //INMEM MEDIAN { - double picked = ec.getMatrixInput(input1.getName()).median(); + double picked = ec.getMatrixInput(input1.getName(), getExtendedOpcode()).median(); ec.setScalarOutput(output.getName(), new DoubleObject(picked)); - ec.releaseMatrixInput(input1.getName()); + ec.releaseMatrixInput(input1.getName(), getExtendedOpcode()); break; } else //MR MEDIAN @@ -173,9 +173,9 @@ public class QuantilePickCPInstruction extends BinaryCPInstruction case IQM: if( _inmem ) //INMEM IQM { - MatrixBlock matBlock1 = ec.getMatrixInput(input1.getName()); + MatrixBlock matBlock1 = ec.getMatrixInput(input1.getName(), getExtendedOpcode()); double iqm = matBlock1.interQuartileMean(); - ec.releaseMatrixInput(input1.getName()); + ec.releaseMatrixInput(input1.getName(), getExtendedOpcode()); ec.setScalarOutput(output.getName(), new DoubleObject(iqm)); } else //MR IQM http://git-wip-us.apache.org/repos/asf/systemml/blob/648eb21d/src/main/java/org/apache/sysml/runtime/instructions/cp/QuantileSortCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/QuantileSortCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/QuantileSortCPInstruction.java index 37c4997..d35f26b 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/QuantileSortCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/QuantileSortCPInstruction.java @@ -86,21 +86,21 @@ public class QuantileSortCPInstruction extends UnaryCPInstruction throws DMLRuntimeException { //acquire inputs matrices - MatrixBlock matBlock = ec.getMatrixInput(input1.getName()); + MatrixBlock matBlock = ec.getMatrixInput(input1.getName(), getExtendedOpcode()); MatrixBlock wtBlock = null; if (input2 != null) { - wtBlock = ec.getMatrixInput(input2.getName()); + wtBlock = ec.getMatrixInput(input2.getName(), getExtendedOpcode()); } //process core instruction MatrixBlock resultBlock = (MatrixBlock) matBlock.sortOperations(wtBlock, new MatrixBlock()); //release inputs - ec.releaseMatrixInput(input1.getName()); + ec.releaseMatrixInput(input1.getName(), getExtendedOpcode()); if (input2 != null) - ec.releaseMatrixInput(input2.getName()); + ec.releaseMatrixInput(input2.getName(), getExtendedOpcode()); //set and release output - ec.setMatrixOutput(output.getName(), resultBlock); + ec.setMatrixOutput(output.getName(), resultBlock, getExtendedOpcode()); } } http://git-wip-us.apache.org/repos/asf/systemml/blob/648eb21d/src/main/java/org/apache/sysml/runtime/instructions/cp/QuaternaryCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/QuaternaryCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/QuaternaryCPInstruction.java index a7fa3b5..4fdea1b 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/QuaternaryCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/QuaternaryCPInstruction.java @@ -109,9 +109,9 @@ public class QuaternaryCPInstruction extends ComputationCPInstruction { QuaternaryOperator qop = (QuaternaryOperator) _optr; - MatrixBlock matBlock1 = ec.getMatrixInput(input1.getName()); - MatrixBlock matBlock2 = ec.getMatrixInput(input2.getName()); - MatrixBlock matBlock3 = ec.getMatrixInput(input3.getName()); + MatrixBlock matBlock1 = ec.getMatrixInput(input1.getName(), getExtendedOpcode()); + MatrixBlock matBlock2 = ec.getMatrixInput(input2.getName(), getExtendedOpcode()); + MatrixBlock matBlock3 = ec.getMatrixInput(input3.getName(), getExtendedOpcode()); MatrixBlock matBlock4 = null; if( qop.hasFourInputs() ) { if (input4.getDataType() == DataType.SCALAR) { @@ -120,7 +120,7 @@ public class QuaternaryCPInstruction extends ComputationCPInstruction matBlock4.quickSetValue(0, 0, eps); } else { - matBlock4 = ec.getMatrixInput(input4.getName()); + matBlock4 = ec.getMatrixInput(input4.getName(), getExtendedOpcode()); } } @@ -128,23 +128,23 @@ public class QuaternaryCPInstruction extends ComputationCPInstruction MatrixValue out = matBlock1.quaternaryOperations(qop, matBlock2, matBlock3, matBlock4, new MatrixBlock(), _numThreads); //release inputs and output - ec.releaseMatrixInput(input1.getName()); - ec.releaseMatrixInput(input2.getName()); - ec.releaseMatrixInput(input3.getName()); + ec.releaseMatrixInput(input1.getName(), getExtendedOpcode()); + ec.releaseMatrixInput(input2.getName(), getExtendedOpcode()); + ec.releaseMatrixInput(input3.getName(), getExtendedOpcode()); if( qop.wtype1 != null || qop.wtype4 != null ) { //wsloss/wcemm if( (qop.wtype1 != null && qop.wtype1.hasFourInputs()) || (qop.wtype4 != null && qop.wtype4.hasFourInputs()) ) if (input4.getDataType() == DataType.MATRIX) { - ec.releaseMatrixInput(input4.getName()); + ec.releaseMatrixInput(input4.getName(), getExtendedOpcode()); } ec.setVariable(output.getName(), new DoubleObject(out.getValue(0, 0))); } else { //wsigmoid / wdivmm / wumm if( qop.wtype3 != null && qop.wtype3.hasFourInputs() ) if (input4.getDataType() == DataType.MATRIX) { - ec.releaseMatrixInput(input4.getName()); + ec.releaseMatrixInput(input4.getName(), getExtendedOpcode()); } - ec.setMatrixOutput(output.getName(), (MatrixBlock)out); + ec.setMatrixOutput(output.getName(), (MatrixBlock)out, getExtendedOpcode()); } } } http://git-wip-us.apache.org/repos/asf/systemml/blob/648eb21d/src/main/java/org/apache/sysml/runtime/instructions/cp/ReorgCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/ReorgCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/ReorgCPInstruction.java index 872a97f..a4cfd38 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/ReorgCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/ReorgCPInstruction.java @@ -117,7 +117,7 @@ public class ReorgCPInstruction extends UnaryCPInstruction throws DMLRuntimeException { //acquire inputs - MatrixBlock matBlock = ec.getMatrixInput(input1.getName()); + MatrixBlock matBlock = ec.getMatrixInput(input1.getName(), getExtendedOpcode()); ReorgOperator r_op = (ReorgOperator) _optr; if( r_op.fn instanceof SortIndex ) { //additional attributes for sort @@ -131,8 +131,8 @@ public class ReorgCPInstruction extends UnaryCPInstruction MatrixBlock soresBlock = (MatrixBlock) (matBlock.reorgOperations(r_op, new MatrixBlock(), 0, 0, 0)); //release inputs/outputs - ec.releaseMatrixInput(input1.getName()); - ec.setMatrixOutput(output.getName(), soresBlock); + ec.releaseMatrixInput(input1.getName(), getExtendedOpcode()); + ec.setMatrixOutput(output.getName(), soresBlock, getExtendedOpcode()); } } http://git-wip-us.apache.org/repos/asf/systemml/blob/648eb21d/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarMatrixArithmeticCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarMatrixArithmeticCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarMatrixArithmeticCPInstruction.java index 50ed490..eb9a4e5 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarMatrixArithmeticCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarMatrixArithmeticCPInstruction.java @@ -46,7 +46,7 @@ public class ScalarMatrixArithmeticCPInstruction extends ArithmeticBinaryCPInstr CPOperand mat = ( input1.getDataType() == DataType.MATRIX ) ? input1 : input2; CPOperand scalar = ( input1.getDataType() == DataType.MATRIX ) ? input2 : input1; - MatrixBlock inBlock = ec.getMatrixInput(mat.getName()); + MatrixBlock inBlock = ec.getMatrixInput(mat.getName(), getExtendedOpcode()); ScalarObject constant = (ScalarObject) ec.getScalarInput(scalar.getName(), scalar.getValueType(), scalar.isLiteral()); ScalarOperator sc_op = (ScalarOperator) _optr; @@ -54,13 +54,13 @@ public class ScalarMatrixArithmeticCPInstruction extends ArithmeticBinaryCPInstr MatrixBlock retBlock = (MatrixBlock) inBlock.scalarOperations(sc_op, new MatrixBlock()); - ec.releaseMatrixInput(mat.getName()); + ec.releaseMatrixInput(mat.getName(), getExtendedOpcode()); // Ensure right dense/sparse output representation (guarded by released input memory) if( checkGuardedRepresentationChange(inBlock, retBlock) ) { retBlock.examSparsity(); } - ec.setMatrixOutput(output.getName(), retBlock); + ec.setMatrixOutput(output.getName(), retBlock, getExtendedOpcode()); } } http://git-wip-us.apache.org/repos/asf/systemml/blob/648eb21d/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarMatrixRelationalCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarMatrixRelationalCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarMatrixRelationalCPInstruction.java index 7a5b0af..e0ff4a0 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarMatrixRelationalCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarMatrixRelationalCPInstruction.java @@ -46,7 +46,7 @@ public class ScalarMatrixRelationalCPInstruction extends RelationalBinaryCPInstr CPOperand mat = ( input1.getDataType() == DataType.MATRIX ) ? input1 : input2; CPOperand scalar = ( input1.getDataType() == DataType.MATRIX ) ? input2 : input1; - MatrixBlock inBlock = ec.getMatrixInput(mat.getName()); + MatrixBlock inBlock = ec.getMatrixInput(mat.getName(), getExtendedOpcode()); ScalarObject constant = (ScalarObject) ec.getScalarInput(scalar.getName(), scalar.getValueType(), scalar.isLiteral()); ScalarOperator sc_op = (ScalarOperator) _optr; @@ -54,13 +54,13 @@ public class ScalarMatrixRelationalCPInstruction extends RelationalBinaryCPInstr MatrixBlock retBlock = (MatrixBlock) inBlock.scalarOperations(sc_op, new MatrixBlock()); - ec.releaseMatrixInput(mat.getName()); + ec.releaseMatrixInput(mat.getName(), getExtendedOpcode()); // Ensure right dense/sparse output representation (guarded by released input memory) if( checkGuardedRepresentationChange(inBlock, retBlock) ) { retBlock.examSparsity(); } - ec.setMatrixOutput(output.getName(), retBlock); + ec.setMatrixOutput(output.getName(), retBlock, getExtendedOpcode()); } } http://git-wip-us.apache.org/repos/asf/systemml/blob/648eb21d/src/main/java/org/apache/sysml/runtime/instructions/cp/SpoofCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/SpoofCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/SpoofCPInstruction.java index 0d0140d..7c16242 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/SpoofCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/SpoofCPInstruction.java @@ -75,7 +75,7 @@ public class SpoofCPInstruction extends ComputationCPInstruction ArrayList<ScalarObject> scalars = new ArrayList<ScalarObject>(); for (CPOperand input : _in) { if(input.getDataType()==DataType.MATRIX) - inputs.add(ec.getMatrixInput(input.getName())); + inputs.add(ec.getMatrixInput(input.getName(), getExtendedOpcode())); else if(input.getDataType()==DataType.SCALAR) { //note: even if literal, it might be compiled as scalar placeholder scalars.add(ec.getScalarInput(input.getName(), input.getValueType(), input.isLiteral())); @@ -86,7 +86,7 @@ public class SpoofCPInstruction extends ComputationCPInstruction if( output.getDataType() == DataType.MATRIX) { MatrixBlock out = new MatrixBlock(); _op.execute(inputs, scalars, out, _numThreads); - ec.setMatrixOutput(output.getName(), out); + ec.setMatrixOutput(output.getName(), out, getExtendedOpcode()); } else if (output.getDataType() == DataType.SCALAR) { ScalarObject out = _op.execute(inputs, scalars, _numThreads); @@ -96,6 +96,6 @@ public class SpoofCPInstruction extends ComputationCPInstruction // release input matrices for (CPOperand input : _in) if(input.getDataType()==DataType.MATRIX) - ec.releaseMatrixInput(input.getName()); + ec.releaseMatrixInput(input.getName(), getExtendedOpcode()); } } http://git-wip-us.apache.org/repos/asf/systemml/blob/648eb21d/src/main/java/org/apache/sysml/runtime/instructions/cp/StringInitCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/StringInitCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/StringInitCPInstruction.java index bac796e..055d17c 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/StringInitCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/StringInitCPInstruction.java @@ -107,6 +107,6 @@ public class StringInitCPInstruction extends UnaryCPInstruction outBlk.examSparsity(); //put output into symbol table - ec.setMatrixOutput(outName, outBlk); + ec.setMatrixOutput(outName, outBlk, getExtendedOpcode()); } } http://git-wip-us.apache.org/repos/asf/systemml/blob/648eb21d/src/main/java/org/apache/sysml/runtime/instructions/cp/TernaryCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/TernaryCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/TernaryCPInstruction.java index 0c48ba1..8327dcd 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/TernaryCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/TernaryCPInstruction.java @@ -97,7 +97,7 @@ public class TernaryCPInstruction extends ComputationCPInstruction public void processInstruction(ExecutionContext ec) throws DMLRuntimeException { - MatrixBlock matBlock1 = ec.getMatrixInput(input1.getName()); + MatrixBlock matBlock1 = ec.getMatrixInput(input1.getName(), getExtendedOpcode()); MatrixBlock matBlock2=null, wtBlock=null; double cst1, cst2; @@ -126,19 +126,19 @@ public class TernaryCPInstruction extends ComputationCPInstruction switch(ctableOp) { case CTABLE_TRANSFORM: //(VECTOR) // F=ctable(A,B,W) - matBlock2 = ec.getMatrixInput(input2.getName()); - wtBlock = ec.getMatrixInput(input3.getName()); + matBlock2 = ec.getMatrixInput(input2.getName(), getExtendedOpcode()); + wtBlock = ec.getMatrixInput(input3.getName(), getExtendedOpcode()); matBlock1.ternaryOperations((SimpleOperator)_optr, matBlock2, wtBlock, resultMap, resultBlock); break; case CTABLE_TRANSFORM_SCALAR_WEIGHT: //(VECTOR/MATRIX) // F = ctable(A,B) or F = ctable(A,B,1) - matBlock2 = ec.getMatrixInput(input2.getName()); + matBlock2 = ec.getMatrixInput(input2.getName(), getExtendedOpcode()); cst1 = ec.getScalarInput(input3.getName(), input3.getValueType(), input3.isLiteral()).getDoubleValue(); matBlock1.ternaryOperations((SimpleOperator)_optr, matBlock2, cst1, _ignoreZeros, resultMap, resultBlock); break; case CTABLE_EXPAND_SCALAR_WEIGHT: //(VECTOR) // F = ctable(seq,A) or F = ctable(seq,B,1) - matBlock2 = ec.getMatrixInput(input2.getName()); + matBlock2 = ec.getMatrixInput(input2.getName(), getExtendedOpcode()); cst1 = ec.getScalarInput(input3.getName(), input3.getValueType(), input3.isLiteral()).getDoubleValue(); // only resultBlock.rlen known, resultBlock.clen set in operation matBlock1.ternaryOperations((SimpleOperator)_optr, matBlock2, cst1, resultBlock); @@ -151,7 +151,7 @@ public class TernaryCPInstruction extends ComputationCPInstruction break; case CTABLE_TRANSFORM_WEIGHTED_HISTOGRAM: //(VECTOR) // F=ctable(A,1,W) - wtBlock = ec.getMatrixInput(input3.getName()); + wtBlock = ec.getMatrixInput(input3.getName(), getExtendedOpcode()); cst1 = ec.getScalarInput(input2.getName(), input2.getValueType(), input2.isLiteral()).getDoubleValue(); matBlock1.ternaryOperations((SimpleOperator)_optr, cst1, wtBlock, resultMap, resultBlock); break; @@ -161,11 +161,11 @@ public class TernaryCPInstruction extends ComputationCPInstruction } if(input1.getDataType() == DataType.MATRIX) - ec.releaseMatrixInput(input1.getName()); + ec.releaseMatrixInput(input1.getName(), getExtendedOpcode()); if(input2.getDataType() == DataType.MATRIX) - ec.releaseMatrixInput(input2.getName()); + ec.releaseMatrixInput(input2.getName(), getExtendedOpcode()); if(input3.getDataType() == DataType.MATRIX) - ec.releaseMatrixInput(input3.getName()); + ec.releaseMatrixInput(input3.getName(), getExtendedOpcode()); if ( resultBlock == null ){ //we need to respect potentially specified output dimensions here, because we might have @@ -178,6 +178,6 @@ public class TernaryCPInstruction extends ComputationCPInstruction else resultBlock.examSparsity(); - ec.setMatrixOutput(output.getName(), resultBlock); + ec.setMatrixOutput(output.getName(), resultBlock, getExtendedOpcode()); } } http://git-wip-us.apache.org/repos/asf/systemml/blob/648eb21d/src/main/java/org/apache/sysml/runtime/instructions/cp/UaggOuterChainCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/UaggOuterChainCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/UaggOuterChainCPInstruction.java index fcd2d56..746ee04 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/UaggOuterChainCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/UaggOuterChainCPInstruction.java @@ -87,19 +87,19 @@ public class UaggOuterChainCPInstruction extends UnaryCPInstruction MatrixBlock mbLeft = null, mbRight = null, mbOut = null; //get the main data input if( rightCached ) { - mbLeft = ec.getMatrixInput(input1.getName()); - mbRight = ec.getMatrixInput(input2.getName()); + mbLeft = ec.getMatrixInput(input1.getName(), getExtendedOpcode()); + mbRight = ec.getMatrixInput(input2.getName(), getExtendedOpcode()); } else { - mbLeft = ec.getMatrixInput(input2.getName()); - mbRight = ec.getMatrixInput(input1.getName()); + mbLeft = ec.getMatrixInput(input2.getName(), getExtendedOpcode()); + mbRight = ec.getMatrixInput(input1.getName(), getExtendedOpcode()); } mbOut = mbLeft.uaggouterchainOperations(mbLeft, mbRight, mbOut, _bOp, _uaggOp); //release locks - ec.releaseMatrixInput(input1.getName()); - ec.releaseMatrixInput(input2.getName()); + ec.releaseMatrixInput(input1.getName(), getExtendedOpcode()); + ec.releaseMatrixInput(input2.getName(), getExtendedOpcode()); if( _uaggOp.aggOp.correctionExists ) mbOut.dropLastRowsOrColums(_uaggOp.aggOp.correctionLocation); @@ -122,7 +122,7 @@ public class UaggOuterChainCPInstruction extends UnaryCPInstruction { //Additional memory requirement to convert from dense to sparse can be leveraged from released memory needed for input data above. mbOut.examSparsity(); - ec.setMatrixOutput(output_name, mbOut); + ec.setMatrixOutput(output_name, mbOut, getExtendedOpcode()); } } http://git-wip-us.apache.org/repos/asf/systemml/blob/648eb21d/src/main/java/org/apache/sysml/runtime/instructions/cp/VariableCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/VariableCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/VariableCPInstruction.java index 3b9ef66..336cfbf 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/VariableCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/VariableCPInstruction.java @@ -585,11 +585,11 @@ public class VariableCPInstruction extends CPInstruction ScalarObjectFactory.createScalarObject(fBlock.getSchema()[0], value)); } else { //assume DataType.MATRIX otherwise - MatrixBlock mBlock = ec.getMatrixInput(getInput1().getName()); + MatrixBlock mBlock = ec.getMatrixInput(getInput1().getName(), getExtendedOpcode()); if( mBlock.getNumRows()!=1 || mBlock.getNumColumns()!=1 ) throw new DMLRuntimeException("Dimension mismatch - unable to cast matrix '"+getInput1().getName()+"' of dimension ("+mBlock.getNumRows()+" x "+mBlock.getNumColumns()+") to scalar."); double value = mBlock.getValue(0,0); - ec.releaseMatrixInput(getInput1().getName()); + ec.releaseMatrixInput(getInput1().getName(), getExtendedOpcode()); ec.setScalarOutput(output.getName(), new DoubleObject(value)); } break; @@ -605,7 +605,7 @@ public class VariableCPInstruction extends CPInstruction out = new MatrixBlock(1,1,false); out.quickSetValue(0, 0, scalarInput.getDoubleValue()); } - ec.setMatrixOutput(output.getName(), out); + ec.setMatrixOutput(output.getName(), out, getExtendedOpcode()); break; } case CastAsFrameVariable:{ @@ -617,9 +617,9 @@ public class VariableCPInstruction extends CPInstruction out.set(0, 0, scalarInput.getStringValue()); } else { //DataType.FRAME - MatrixBlock min = ec.getMatrixInput(getInput1().getName()); + MatrixBlock min = ec.getMatrixInput(getInput1().getName(), getExtendedOpcode()); out = DataConverter.convertToFrameBlock(min); - ec.releaseMatrixInput(getInput1().getName()); + ec.releaseMatrixInput(getInput1().getName(), getExtendedOpcode()); } ec.setFrameOutput(output.getName(), out); break; http://git-wip-us.apache.org/repos/asf/systemml/blob/648eb21d/src/main/java/org/apache/sysml/runtime/instructions/cpfile/MatrixIndexingCPFileInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cpfile/MatrixIndexingCPFileInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cpfile/MatrixIndexingCPFileInstruction.java index a1e9ca1..70bff67 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cpfile/MatrixIndexingCPFileInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cpfile/MatrixIndexingCPFileInstruction.java @@ -137,7 +137,7 @@ public final class MatrixIndexingCPFileInstruction extends IndexingCPInstruction { //will return an empty matrix partition MatrixBlock resultBlock = mo.readMatrixPartition( ixrange ); - ec.setMatrixOutput(output.getName(), resultBlock); + ec.setMatrixOutput(output.getName(), resultBlock, getExtendedOpcode()); } } else http://git-wip-us.apache.org/repos/asf/systemml/blob/648eb21d/src/main/java/org/apache/sysml/runtime/instructions/spark/AggregateTernarySPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/AggregateTernarySPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/AggregateTernarySPInstruction.java index 6a494b7..7ac1e5b 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/AggregateTernarySPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/AggregateTernarySPInstruction.java @@ -111,7 +111,7 @@ public class AggregateTernarySPInstruction extends ComputationSPInstruction //put output block into symbol table (no lineage because single block) //this also includes implicit maintenance of matrix characteristics - sec.setMatrixOutput(output.getName(), ret); + sec.setMatrixOutput(output.getName(), ret, getExtendedOpcode()); } else //tack+* multi block { http://git-wip-us.apache.org/repos/asf/systemml/blob/648eb21d/src/main/java/org/apache/sysml/runtime/instructions/spark/AggregateUnarySPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/AggregateUnarySPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/AggregateUnarySPInstruction.java index 73f67a3..352a72e 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/AggregateUnarySPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/AggregateUnarySPInstruction.java @@ -106,7 +106,7 @@ public class AggregateUnarySPInstruction extends UnarySPInstruction //put output block into symbol table (no lineage because single block) //this also includes implicit maintenance of matrix characteristics - sec.setMatrixOutput(output.getName(), out3); + sec.setMatrixOutput(output.getName(), out3, getExtendedOpcode()); } else //MULTI_BLOCK or NONE { http://git-wip-us.apache.org/repos/asf/systemml/blob/648eb21d/src/main/java/org/apache/sysml/runtime/instructions/spark/ConvolutionSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/ConvolutionSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/ConvolutionSPInstruction.java index fcf90e9..c3101c2 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/ConvolutionSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/ConvolutionSPInstruction.java @@ -237,8 +237,8 @@ public class ConvolutionSPInstruction extends UnarySPInstruction { } private Broadcast<MatrixBlock> getBroadcast(SparkExecutionContext sec, String name) throws DMLRuntimeException { - MatrixBlock mb = sec.getMatrixInput( name ); - sec.releaseMatrixInput(name); + MatrixBlock mb = sec.getMatrixInput( name, getExtendedOpcode() ); + sec.releaseMatrixInput(name, getExtendedOpcode()); return sec.getSparkContext().broadcast(mb); } http://git-wip-us.apache.org/repos/asf/systemml/blob/648eb21d/src/main/java/org/apache/sysml/runtime/instructions/spark/CpmmSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/CpmmSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/CpmmSPInstruction.java index 4a29c5e..4b46a96 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/CpmmSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/CpmmSPInstruction.java @@ -107,7 +107,7 @@ public class CpmmSPInstruction extends BinarySPInstruction //put output block into symbol table (no lineage because single block) //this also includes implicit maintenance of matrix characteristics - sec.setMatrixOutput(output.getName(), out2); + sec.setMatrixOutput(output.getName(), out2, getExtendedOpcode()); } else //DEFAULT: MULTI_BLOCK { http://git-wip-us.apache.org/repos/asf/systemml/blob/648eb21d/src/main/java/org/apache/sysml/runtime/instructions/spark/MapmmChainSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/MapmmChainSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/MapmmChainSPInstruction.java index 89cdaa5..f5a6312 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/MapmmChainSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/MapmmChainSPInstruction.java @@ -134,7 +134,7 @@ public class MapmmChainSPInstruction extends SPInstruction //put output block into symbol table (no lineage because single block) //this also includes implicit maintenance of matrix characteristics - sec.setMatrixOutput(_output.getName(), out); + sec.setMatrixOutput(_output.getName(), out, getExtendedOpcode()); } /** http://git-wip-us.apache.org/repos/asf/systemml/blob/648eb21d/src/main/java/org/apache/sysml/runtime/instructions/spark/MapmmSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/MapmmSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/MapmmSPInstruction.java index c1fdea6..14e04ee 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/MapmmSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/MapmmSPInstruction.java @@ -143,7 +143,7 @@ public class MapmmSPInstruction extends BinarySPInstruction //put output block into symbol table (no lineage because single block) //this also includes implicit maintenance of matrix characteristics - sec.setMatrixOutput(output.getName(), out2); + sec.setMatrixOutput(output.getName(), out2, getExtendedOpcode()); } else //MULTI_BLOCK or NONE { http://git-wip-us.apache.org/repos/asf/systemml/blob/648eb21d/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixIndexingSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixIndexingSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixIndexingSPInstruction.java index 0d4d3c4..b8aab2c 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixIndexingSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/MatrixIndexingSPInstruction.java @@ -116,10 +116,10 @@ public class MatrixIndexingSPInstruction extends IndexingSPInstruction JavaPairRDD<MatrixIndexes,MatrixBlock> in1 = sec.getBinaryBlockRDDHandleForVariable( input1.getName() ); if( isSingleBlockLookup(mcIn, ixrange) ) { - sec.setMatrixOutput(output.getName(), singleBlockIndexing(in1, mcIn, mcOut, ixrange)); + sec.setMatrixOutput(output.getName(), singleBlockIndexing(in1, mcIn, mcOut, ixrange), getExtendedOpcode()); } else if( isMultiBlockLookup(in1, mcIn, mcOut, ixrange) ) { - sec.setMatrixOutput(output.getName(), multiBlockIndexing(in1, mcIn, mcOut, ixrange)); + sec.setMatrixOutput(output.getName(), multiBlockIndexing(in1, mcIn, mcOut, ixrange), getExtendedOpcode()); } else { //rdd output for general case JavaPairRDD<MatrixIndexes,MatrixBlock> out = generalCaseRightIndexing(in1, mcIn, mcOut, ixrange, _aggType); http://git-wip-us.apache.org/repos/asf/systemml/blob/648eb21d/src/main/java/org/apache/sysml/runtime/instructions/spark/ParameterizedBuiltinSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/ParameterizedBuiltinSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/ParameterizedBuiltinSPInstruction.java index 179ef9e..e62dd60 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/ParameterizedBuiltinSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/ParameterizedBuiltinSPInstruction.java @@ -213,7 +213,7 @@ public class ParameterizedBuiltinSPInstruction extends ComputationSPInstruction //put output block into symbol table (no lineage because single block) //this also includes implicit maintenance of matrix characteristics - sec.setMatrixOutput(output.getName(), out2); + sec.setMatrixOutput(output.getName(), out2, getExtendedOpcode()); } //multi-block aggregation else { @@ -369,7 +369,7 @@ public class ParameterizedBuiltinSPInstruction extends ComputationSPInstruction else //special case: empty output (ensure valid dims) { MatrixBlock out = new MatrixBlock(rows?1:(int)mcIn.getRows(), rows?(int)mcIn.getCols():1, true); - sec.setMatrixOutput(output.getName(), out); + sec.setMatrixOutput(output.getName(), out, getExtendedOpcode()); } } else if ( opcode.equalsIgnoreCase("replace") ) http://git-wip-us.apache.org/repos/asf/systemml/blob/648eb21d/src/main/java/org/apache/sysml/runtime/instructions/spark/RandSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/RandSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/RandSPInstruction.java index e96cd63..9d89ae1 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/RandSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/RandSPInstruction.java @@ -345,7 +345,7 @@ public class RandSPInstruction extends UnarySPInstruction sparsity, minValue, maxValue, pdfParams); MatrixBlock mb = MatrixBlock.randOperations(rgen, lSeed); - sec.setMatrixOutput(output.getName(), mb); + sec.setMatrixOutput(output.getName(), mb, getExtendedOpcode()); Statistics.decrementNoOfExecutedSPInst(); return; } http://git-wip-us.apache.org/repos/asf/systemml/blob/648eb21d/src/main/java/org/apache/sysml/runtime/instructions/spark/SpoofSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/SpoofSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/SpoofSPInstruction.java index 2be7b2c..1d360a1 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/SpoofSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/SpoofSPInstruction.java @@ -161,7 +161,7 @@ public class SpoofSPInstruction extends SPInstruction .mapToPair(new MultiAggregateFunction(_class.getName(), _classBytes, bcMatrices, scalars)) .values().fold(new MatrixBlock(), new MultiAggAggregateFunction(aggOps) ); - sec.setMatrixOutput(_out.getName(), tmpMB); + sec.setMatrixOutput(_out.getName(), tmpMB, getExtendedOpcode()); return; } else if(_class.getSuperclass() == SpoofOuterProduct.class) // outer product operator @@ -205,7 +205,7 @@ public class SpoofSPInstruction extends SPInstruction if( op.getRowType().isColumnAgg() || op.getRowType()==RowType.FULL_AGG ) { MatrixBlock tmpMB = RDDAggregateUtils.sumStable(out); if( op.getRowType().isColumnAgg() ) - sec.setMatrixOutput(_out.getName(), tmpMB); + sec.setMatrixOutput(_out.getName(), tmpMB, getExtendedOpcode()); else sec.setScalarOutput(_out.getName(), new DoubleObject(tmpMB.quickGetValue(0, 0))); http://git-wip-us.apache.org/repos/asf/systemml/blob/648eb21d/src/main/java/org/apache/sysml/runtime/instructions/spark/Tsmm2SPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/Tsmm2SPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/Tsmm2SPInstruction.java index 1f1b3e4..26461a6 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/Tsmm2SPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/Tsmm2SPInstruction.java @@ -114,7 +114,7 @@ public class Tsmm2SPInstruction extends UnarySPInstruction //put output block into symbol table (no lineage because single block) //this also includes implicit maintenance of matrix characteristics - sec.setMatrixOutput(output.getName(), out); + sec.setMatrixOutput(output.getName(), out, getExtendedOpcode()); } else { //output individual output blocks and aggregate by key (no action) http://git-wip-us.apache.org/repos/asf/systemml/blob/648eb21d/src/main/java/org/apache/sysml/runtime/instructions/spark/TsmmSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/TsmmSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/TsmmSPInstruction.java index 4386b02..61a9130 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/TsmmSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/TsmmSPInstruction.java @@ -82,7 +82,7 @@ public class TsmmSPInstruction extends UnarySPInstruction //put output block into symbol table (no lineage because single block) //this also includes implicit maintenance of matrix characteristics - sec.setMatrixOutput(output.getName(), out); + sec.setMatrixOutput(output.getName(), out, getExtendedOpcode()); } private static class RDDTSMMFunction implements Function<Tuple2<MatrixIndexes,MatrixBlock>, MatrixBlock> http://git-wip-us.apache.org/repos/asf/systemml/blob/648eb21d/src/main/java/org/apache/sysml/runtime/instructions/spark/UaggOuterChainSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/UaggOuterChainSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/UaggOuterChainSPInstruction.java index d6cc8e8..8f74b9d 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/UaggOuterChainSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/UaggOuterChainSPInstruction.java @@ -132,8 +132,8 @@ public class UaggOuterChainSPInstruction extends BinarySPInstruction if (LibMatrixOuterAgg.isSupportedUaggOp(_uaggOp, _bOp)) { //create sorted broadcast matrix - MatrixBlock mb = sec.getMatrixInput(bcastVar); - sec.releaseMatrixInput(bcastVar); + MatrixBlock mb = sec.getMatrixInput(bcastVar, getExtendedOpcode()); + sec.releaseMatrixInput(bcastVar, getExtendedOpcode()); bcastVar = null; //prevent lineage tracking double[] vmb = DataConverter.convertToDoubleVector(mb); Broadcast<int[]> bvi = null; @@ -166,7 +166,7 @@ public class UaggOuterChainSPInstruction extends BinarySPInstruction tmp.dropLastRowsOrColums(_aggOp.correctionLocation); //put output block into symbol table (no lineage because single block) - sec.setMatrixOutput(output.getName(), tmp); + sec.setMatrixOutput(output.getName(), tmp, getExtendedOpcode()); } else //R/C AGG (output is rdd) { http://git-wip-us.apache.org/repos/asf/systemml/blob/648eb21d/src/main/java/org/apache/sysml/runtime/instructions/spark/ZipmmSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/ZipmmSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/ZipmmSPInstruction.java index e21eefa..e61e39b 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/ZipmmSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/ZipmmSPInstruction.java @@ -103,7 +103,7 @@ public class ZipmmSPInstruction extends BinarySPInstruction //put output block into symbol table (no lineage because single block) //this also includes implicit maintenance of matrix characteristics - sec.setMatrixOutput(output.getName(), out2); + sec.setMatrixOutput(output.getName(), out2, getExtendedOpcode()); } private static class ZipMultiplyFunction implements Function<Tuple2<MatrixBlock,MatrixBlock>, MatrixBlock>