[m-rev.] Push goals as far as possible without re-ordering them in automatic parallelism.

Paul Bone pbone at csse.unimelb.edu.au
Tue Jan 25 21:42:45 AEDT 2011


The push goals analysis for automatic parallelism throws an exception in the
case that it attempts to re-order goals.  Rather than throwing an exception
this change pushes the goals as far as possible but no further before
evaluating whether the parallelisation is worthwhile.  This allows us to push
the goals, but not as far as we'd like, and might still allow for profitable
parallelism.

deep_profiler/mdprof_fb.automatic_parallelism.m:
    As above.

Index: deep_profiler/mdprof_fb.automatic_parallelism.m
===================================================================
RCS file: /home/mercury1/repository/mercury/deep_profiler/mdprof_fb.automatic_parallelism.m,v
retrieving revision 1.37
diff -u -p -b -r1.37 mdprof_fb.automatic_parallelism.m
--- deep_profiler/mdprof_fb.automatic_parallelism.m	22 Jan 2011 04:27:01 -0000	1.37
+++ deep_profiler/mdprof_fb.automatic_parallelism.m	25 Jan 2011 10:36:00 -0000
@@ -1269,7 +1269,20 @@ push_goals_create_candidate(Info, RevCur
                         TailRelSteps, SubGoal, GoalsToPush0,
                         RevCandidateGoalPathSteps, CandidateConjs)
                 ;
-                    unexpected($module, $pred, "push into non-last conjunct")
+                    % We can't push goals into the non-last conjunct without
+                    % re-ordering, which is currently not supported.  By
+                    % building a conjunction here we may still be able to
+                    % create a worthwhile parallelisation.  However, there is a
+                    % trade-off to explore between this and not generating the
+                    % single expensive goal from within the conjunction and
+                    % therefore possibly finding other single expensive goals
+                    % later in this conjunction.
+                    RevCandidateGoalPathSteps = RevCurPathSteps,
+                    Cost = GoalToPushInto ^ goal_annotation ^ pgd_cost,
+                    Calls = goal_cost_get_calls(Cost),
+                    map(fix_goal_counts(Info, Calls), GoalsToPush0,
+                        GoalsToPush),
+                    CandidateConjs = Goals ++ GoalsToPush
                 )
             )
         ;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 489 bytes
Desc: Digital signature
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20110125/be8a07b4/attachment.sig>


More information about the reviews mailing list