Repository: systemml Updated Branches: refs/heads/master 942696a2f -> 86b3090ba
[SYSTEMML-2427] Fix nnz maintenance large dense blocks >16GB This patch fixes special cases of maintaining nnz for a large dense block >16GB in a thread-local manner. Specifically, if a thread-local slice started in the middle of a chunk but crossed multiple chunks, the partial length was incorrectly computed leading to overflows and potential index-out-of-bounds exceptions. Project: http://git-wip-us.apache.org/repos/asf/systemml/repo Commit: http://git-wip-us.apache.org/repos/asf/systemml/commit/86b3090b Tree: http://git-wip-us.apache.org/repos/asf/systemml/tree/86b3090b Diff: http://git-wip-us.apache.org/repos/asf/systemml/diff/86b3090b Branch: refs/heads/master Commit: 86b3090badbe7481cb8a834218b6780678acd960 Parents: 942696a Author: Matthias Boehm <mboe...@gmail.com> Authored: Thu Jun 28 12:47:59 2018 -0700 Committer: Matthias Boehm <mboe...@gmail.com> Committed: Thu Jun 28 12:48:25 2018 -0700 ---------------------------------------------------------------------- .../java/org/apache/sysml/runtime/matrix/data/DenseBlockLDRB.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/systemml/blob/86b3090b/src/main/java/org/apache/sysml/runtime/matrix/data/DenseBlockLDRB.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/matrix/data/DenseBlockLDRB.java b/src/main/java/org/apache/sysml/runtime/matrix/data/DenseBlockLDRB.java index 245ecb4..725bdbe 100644 --- a/src/main/java/org/apache/sysml/runtime/matrix/data/DenseBlockLDRB.java +++ b/src/main/java/org/apache/sysml/runtime/matrix/data/DenseBlockLDRB.java @@ -159,7 +159,8 @@ public class DenseBlockLDRB extends DenseBlock final int biu = index(ru-1); for(int bi=bil; bi<=biu; bi++) { int lpos = (bi==bil) ? pos(rl) : 0; - int len = (bi==biu) ? pos(ru-1)-lpos+clen : blockSize(bi)*clen; + int len = ((bi==biu) ? pos(ru-1)+clen : + blockSize(bi)*clen) - lpos; if( rowBlock ) nnz += UtilFunctions.computeNnz(data[bi], lpos, len); else