Repository: systemml Updated Branches: refs/heads/master d907efc17 -> 381d1d6a9
[MINOR][SYSTEMML-1979] Fix codegen plan enumeration (cost bound) A recent fix re-enabled the structual pruning in the codegen optimizer. So far, we passed the current cost bound into recursive calls for conditionally independent subproblems. In rare cases, this lead to invalid pruning because the subproblem is solved with a constant assignment for points not included in the subproblem. Project: http://git-wip-us.apache.org/repos/asf/systemml/repo Commit: http://git-wip-us.apache.org/repos/asf/systemml/commit/381d1d6a Tree: http://git-wip-us.apache.org/repos/asf/systemml/tree/381d1d6a Diff: http://git-wip-us.apache.org/repos/asf/systemml/diff/381d1d6a Branch: refs/heads/master Commit: 381d1d6a9ac356d4b834963c71f8872837acf35e Parents: d907efc Author: Matthias Boehm <[email protected]> Authored: Mon Oct 30 22:13:33 2017 -0700 Committer: Matthias Boehm <[email protected]> Committed: Mon Oct 30 22:13:33 2017 -0700 ---------------------------------------------------------------------- .../hops/codegen/opt/PlanSelectionFuseCostBasedV2.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/systemml/blob/381d1d6a/src/main/java/org/apache/sysml/hops/codegen/opt/PlanSelectionFuseCostBasedV2.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/hops/codegen/opt/PlanSelectionFuseCostBasedV2.java b/src/main/java/org/apache/sysml/hops/codegen/opt/PlanSelectionFuseCostBasedV2.java index 4d8a7bc..1f670b3 100644 --- a/src/main/java/org/apache/sysml/hops/codegen/opt/PlanSelectionFuseCostBasedV2.java +++ b/src/main/java/org/apache/sysml/hops/codegen/opt/PlanSelectionFuseCostBasedV2.java @@ -160,8 +160,8 @@ public class PlanSelectionFuseCostBasedV2 extends PlanSelection } //enumerate and cost plans, returns optional plan - boolean[] bestPlan = enumPlans(memo, part, costs, rgraph, - part.getMatPointsExt(), 0, Double.MAX_VALUE); + boolean[] bestPlan = enumPlans(memo, part, + costs, rgraph, part.getMatPointsExt(), 0); //prune memo table wrt best plan and select plans HashSet<Long> visited = new HashSet<>(); @@ -194,17 +194,17 @@ public class PlanSelectionFuseCostBasedV2 extends PlanSelection * @param rgraph reachability graph of interesting materialization points * @param matPoints sorted materialization points (defined the search space) * @param off offset for recursive invocation, indicating the fixed plan part - * @param bestC currently known best plan costs (used of upper bound) * @return optimal assignment of materialization points */ private static boolean[] enumPlans(CPlanMemoTable memo, PlanPartition part, StaticCosts costs, - ReachabilityGraph rgraph, InterestingPoint[] matPoints, int off, double bestC) + ReachabilityGraph rgraph, InterestingPoint[] matPoints, int off) { //scan linearized search space, w/ skips for branch and bound pruning //and structural pruning (where we solve conditionally independent problems) //bestC is monotonically non-increasing and serves as the upper bound - long len = UtilFunctions.pow(2, matPoints.length-off); + final long len = UtilFunctions.pow(2, matPoints.length-off); boolean[] bestPlan = null; + double bestC = Double.MAX_VALUE; long numEvalPlans = 0, numEvalPartPlans = 0; for( long i=0; i<len; i++ ) { @@ -227,7 +227,7 @@ public class PlanSelectionFuseCostBasedV2 extends PlanSelection if( LOG.isTraceEnabled() ) LOG.trace("Enum: Subproblem "+(j+1)+"/"+prob.length+": "+prob[j]); boolean[] bestTmp = enumPlans(memo, part, - costs, null, prob[j].freeMat, prob[j].offset, bestC); + costs, null, prob[j].freeMat, prob[j].offset); LibSpoofPrimitives.vectWrite(bestTmp, plan, prob[j].freePos); }
