[ https://issues.apache.org/jira/browse/SYSTEMML-714?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Matthias Boehm updated SYSTEMML-714: ------------------------------------ Description: The dynamic simplification rewrite 'pushdown sum on binary +' with multiple consumes creates a HOP DAG corruption leading to compilation errors. Consider the following script as an example {code} A = rand(rows=10, cols=1); B = rand(rows=10, cols=1); C = rand(rows=10, cols=1); D = rand(rows=10, cols=1); r1 = sum(A*B + C*D); r2 = r1; print("ret1="+r1+", ret2="+r2); {code} The trace of applied rewrites is as follows {code} DEBUG rewrite.RewriteAlgebraicSimplificationDynamic: Applied pushdownSumOnAdditiveBinary. DEBUG rewrite.RewriteAlgebraicSimplificationDynamic: Applied simplifyDotProductSum. DEBUG rewrite.RewriteAlgebraicSimplificationDynamic: Applied fuseDatagenReorgOperation. DEBUG rewrite.RewriteAlgebraicSimplificationDynamic: Applied simplifyDotProductSum. DEBUG rewrite.RewriteAlgebraicSimplificationDynamic: Applied fuseDatagenReorgOperation {code} Finally, this issue results in the following or similar exception on subsequent rewrites: {code} Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at java.util.ArrayList.rangeCheck(ArrayList.java:653) at java.util.ArrayList.get(ArrayList.java:429) at org.apache.sysml.hops.rewrite.RewriteAlgebraicSimplificationDynamic.simplifyColwiseAggregate(RewriteAlgebraicSimplificationDynamic.java:566) at org.apache.sysml.hops.rewrite.RewriteAlgebraicSimplificationDynamic.rule_AlgebraicSimplification(RewriteAlgebraicSimplificationDynamic.java:154) at org.apache.sysml.hops.rewrite.RewriteAlgebraicSimplificationDynamic.rule_AlgebraicSimplification(RewriteAlgebraicSimplificationDynamic.java:185) at org.apache.sysml.hops.rewrite.RewriteAlgebraicSimplificationDynamic.rewriteHopDAGs(RewriteAlgebraicSimplificationDynamic.java:91) at org.apache.sysml.hops.rewrite.ProgramRewriter.rewriteHopDAGs(ProgramRewriter.java:279) at org.apache.sysml.hops.rewrite.ProgramRewriter.rewriteStatementBlockHopDAGs(ProgramRewriter.java:263) at org.apache.sysml.hops.rewrite.ProgramRewriter.rewriteProgramHopDAGs(ProgramRewriter.java:206) at org.apache.sysml.parser.DMLTranslator.rewriteHopsDAG(DMLTranslator.java:273) at org.apache.sysml.api.DMLScript.execute(DMLScript.java:602) at org.apache.sysml.api.DMLScript.executeScript(DMLScript.java:337) {code} The issue is caused by incorrect handling of multiple parents in the rewrite 'pushdown sum on binary +'. The workaround is to disable rewrites (optimization level 1 instead 2) or to create a "if(1==1){}" cut right after the sum (preferred workaround). > Compile error on rewrite 'pushdown sum on binary' w/ multiple consumers > ----------------------------------------------------------------------- > > Key: SYSTEMML-714 > URL: https://issues.apache.org/jira/browse/SYSTEMML-714 > Project: SystemML > Issue Type: Bug > Components: Compiler > Affects Versions: SystemML 0.10 > Reporter: Matthias Boehm > Fix For: SystemML 0.11 > > > The dynamic simplification rewrite 'pushdown sum on binary +' with multiple > consumes creates a HOP DAG corruption leading to compilation errors. Consider > the following script as an example > {code} > A = rand(rows=10, cols=1); > B = rand(rows=10, cols=1); > C = rand(rows=10, cols=1); > D = rand(rows=10, cols=1); > r1 = sum(A*B + C*D); > r2 = r1; > print("ret1="+r1+", ret2="+r2); > {code} > The trace of applied rewrites is as follows > {code} > DEBUG rewrite.RewriteAlgebraicSimplificationDynamic: Applied > pushdownSumOnAdditiveBinary. > DEBUG rewrite.RewriteAlgebraicSimplificationDynamic: Applied > simplifyDotProductSum. > DEBUG rewrite.RewriteAlgebraicSimplificationDynamic: Applied > fuseDatagenReorgOperation. > DEBUG rewrite.RewriteAlgebraicSimplificationDynamic: Applied > simplifyDotProductSum. > DEBUG rewrite.RewriteAlgebraicSimplificationDynamic: Applied > fuseDatagenReorgOperation > {code} > Finally, this issue results in the following or similar exception on > subsequent rewrites: > {code} > Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 > at java.util.ArrayList.rangeCheck(ArrayList.java:653) > at java.util.ArrayList.get(ArrayList.java:429) > at > org.apache.sysml.hops.rewrite.RewriteAlgebraicSimplificationDynamic.simplifyColwiseAggregate(RewriteAlgebraicSimplificationDynamic.java:566) > at > org.apache.sysml.hops.rewrite.RewriteAlgebraicSimplificationDynamic.rule_AlgebraicSimplification(RewriteAlgebraicSimplificationDynamic.java:154) > at > org.apache.sysml.hops.rewrite.RewriteAlgebraicSimplificationDynamic.rule_AlgebraicSimplification(RewriteAlgebraicSimplificationDynamic.java:185) > at > org.apache.sysml.hops.rewrite.RewriteAlgebraicSimplificationDynamic.rewriteHopDAGs(RewriteAlgebraicSimplificationDynamic.java:91) > at > org.apache.sysml.hops.rewrite.ProgramRewriter.rewriteHopDAGs(ProgramRewriter.java:279) > at > org.apache.sysml.hops.rewrite.ProgramRewriter.rewriteStatementBlockHopDAGs(ProgramRewriter.java:263) > at > org.apache.sysml.hops.rewrite.ProgramRewriter.rewriteProgramHopDAGs(ProgramRewriter.java:206) > at > org.apache.sysml.parser.DMLTranslator.rewriteHopsDAG(DMLTranslator.java:273) > at org.apache.sysml.api.DMLScript.execute(DMLScript.java:602) > at org.apache.sysml.api.DMLScript.executeScript(DMLScript.java:337) > {code} > The issue is caused by incorrect handling of multiple parents in the rewrite > 'pushdown sum on binary +'. The workaround is to disable rewrites > (optimization level 1 instead 2) or to create a "if(1==1){}" cut right after > the sum (preferred workaround). -- This message was sent by Atlassian JIRA (v6.3.4#6332)