Skip to content

Commit 71b6c22

Browse files
committed
Identity Matrix exploit
1 parent 24e6da7 commit 71b6c22

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupDDC.java

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,30 @@ public void leftMMIdentityPreAggregateDense(MatrixBlock that, MatrixBlock ret, i
601601

602602
@Override
603603
public void rightDecompressingMult(MatrixBlock right, MatrixBlock ret, int rl, int ru, int nRows, int crl, int cru) {
604+
if(_dict instanceof IdentityDictionary)
605+
identityRightDecompressingMult(right, ret, rl, ru, crl, cru);
606+
else
607+
defaultRightDecompressingMult(right, ret, rl, ru, crl, cru);
608+
}
609+
610+
private void identityRightDecompressingMult(MatrixBlock right, MatrixBlock ret, int rl, int ru, int crl, int cru) {
611+
final double[] b = right.getDenseBlockValues();
612+
final double[] c = ret.getDenseBlockValues();
613+
final int jd = right.getNumColumns();
614+
final int vLen = 8;
615+
final int lenJ = cru - crl;
616+
final int end = cru - (lenJ % vLen);
617+
for(int i = rl; i < ru; i++) {
618+
int k = _data.getIndex(i);
619+
final int offOut = i * jd + crl;
620+
final double aa = 1;
621+
final int k_right = _colIndexes.get(k);
622+
vectMM(aa, b, c, end, jd, crl, cru, offOut, k_right, vLen);
623+
624+
}
625+
}
626+
627+
private void defaultRightDecompressingMult(MatrixBlock right, MatrixBlock ret, int rl, int ru, int crl, int cru) {
604628
final double[] a = _dict.getValues();
605629
final double[] b = right.getDenseBlockValues();
606630
final double[] c = ret.getDenseBlockValues();
@@ -930,8 +954,6 @@ protected void denseSelection(MatrixBlock selection, P[] points, MatrixBlock ret
930954
}
931955
}
932956

933-
934-
935957
private void leftMMIdentityPreAggregateDenseSingleRow(double[] values, int pos, double[] values2, int pos2, int cl,
936958
int cu) {
937959
IdentityDictionary a = (IdentityDictionary) _dict;

0 commit comments

Comments
 (0)