Matthias Boehm created SYSTEMML-1843: ----------------------------------------
Summary: Wrong loop update-in-place decisions Key: SYSTEMML-1843 URL: https://issues.apache.org/jira/browse/SYSTEMML-1843 Project: SystemML Issue Type: Bug Reporter: Matthias Boehm For special cases, where a matrix is simply updated in a loop, the rewrite for marking updated loop variables as update-in-place mistakenly flags these variables. For example, consider the following script: {code} ... for(i in 1:100) { q = as.matrix(sum(X * U%*%t(V))) print("at iteration "+i); } {code} and the related hop explain output {code} FOR (lines 9-13) [in-place=[q]] ------GENERIC (lines 10-12) [recompile=true] --------(46) TRead X [8026324,2330066,1000,1000,22507155] [0,0,1317 -> 1317MB], CP --------(48) TRead U [8026324,10,1000,1000,80263240] [0,0,612 -> 612MB], CP --------(49) TRead V [2330066,10,1000,1000,23300660] [0,0,178 -> 178MB], CP --------(50) r(t) (49) [10,2330066,1000,1000,23300660] [178,0,178 -> 356MB], CP --------(51) ba(+*) (48,50) [8026324,2330066,1000,1000,-1] [790,85611347,142683904 -> 228296041MB], SPARK --------(52) b(*) (46,51) [8026324,2330066,1000,1000,-1] [142685221,0,1317 -> 142686537MB], SPARK --------(53) ua(+RC) (52) [0,0,-1,-1,-1] [1317,0,0 -> 1317MB], SPARK --------(54) u(cast_as_matrix) (53) [1,1,1000,1000,-1] [0,0,0 -> 0MB] --------(55) TWrite q (54) [1,1,1000,1000,-1] [0,0,0 -> 0MB], CP --------(47) TRead i [0,0,0,0,-1] [0,0,0 -> 0MB], CP --------(57) b(+) (47) [0,0,-1,-1,-1] [0,0,0 -> 0MB], CP --------(58) u(print) (57) [-1,-1,-1,-1,-1] [0,0,0 -> 0MB] {code} As can be seen above variable q is mistakenly marked as update in place, which causes unnecessary copies and thus can negatively affect performance. -- This message was sent by Atlassian JIRA (v6.4.14#64029)