Repository: systemml Updated Branches: refs/heads/master 1fbf939d7 -> 735c4119c
[SYSTEMML-2382] Fix robustness sparse-dense matrix mult, part II The recent fix for special cases of sparse-dense matrix mult fixed overruns of the nnz range but corrupted the check for underruns of the start position. This patch now restores this additional check to make it robust into both directions. Project: http://git-wip-us.apache.org/repos/asf/systemml/repo Commit: http://git-wip-us.apache.org/repos/asf/systemml/commit/735c4119 Tree: http://git-wip-us.apache.org/repos/asf/systemml/tree/735c4119 Diff: http://git-wip-us.apache.org/repos/asf/systemml/diff/735c4119 Branch: refs/heads/master Commit: 735c4119c4edca54c495fd0bc647163d80ff7e43 Parents: 1fbf939 Author: Matthias Boehm <[email protected]> Authored: Tue Jun 12 18:06:28 2018 -0700 Committer: Matthias Boehm <[email protected]> Committed: Tue Jun 12 18:06:28 2018 -0700 ---------------------------------------------------------------------- .../java/org/apache/sysml/runtime/matrix/data/LibMatrixMult.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/systemml/blob/735c4119/src/main/java/org/apache/sysml/runtime/matrix/data/LibMatrixMult.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/matrix/data/LibMatrixMult.java b/src/main/java/org/apache/sysml/runtime/matrix/data/LibMatrixMult.java index 0545ff0..9241d7e 100644 --- a/src/main/java/org/apache/sysml/runtime/matrix/data/LibMatrixMult.java +++ b/src/main/java/org/apache/sysml/runtime/matrix/data/LibMatrixMult.java @@ -1301,7 +1301,9 @@ public class LibMatrixMult int k2 = (ru==cd) ? alen : a.posFIndexGTE(i, ru); k2 = (k2>=0) ? apos+k2 : apos+alen; - if( k1<apos+alen && b.isContiguous(aix[k1], aix[k2-1]) ) { + //note: guard k1 (and thus also k2) against overrun nnz, and guard + //contiguous check for k2-1 against underrun of start pos for k1==k2. + if( k1<apos+alen && (k1==k2 || b.isContiguous(aix[k1], aix[k2-1])) ) { double[] bvals = b.values(aix[k1]); int base = aix[k1]*n - b.pos(aix[k1]); //rest not aligned to blocks of 4 rows
