[m-rev.] diff: Use a clique-wise search when looking for parallelism opertunities.

Paul Bone pbone at csse.unimelb.edu.au
Thu Mar 12 14:52:41 AEDT 2009


On Thu, Mar 12, 2009 at 02:33:12PM +1100, Paul Bone wrote:
> 
> Estimated hours taken: 25 
> Branches: main
> 
> Search for parallelism opportunities in a clique-wise manner.  Starting at the
> root clique traverse expensive calls to find cliques with procedures that
> should be parallelised.  This has several advantages, namely it gives a simple
> method for calculating an approximation of the cost of a recursive call site.
> In the future it will make it easier to perform specialise parallel versions
> of procedures.
> 

This diff contains code that won't compile.  The following changeset
corrects this.

Estimated hours taken: 0.20.
Branches: main

This change fixes a compilation error the last version of this code that I
committed.

deep_profiler/mdprof_feedback.m:
	Fix error.

Index: deep_profiler/mdprof_feedback.m
===================================================================
RCS file: /home/mercury1/repository/mercury/deep_profiler/mdprof_feedback.m,v
retrieving revision 1.16
diff -u -p -b -r1.16 mdprof_feedback.m
--- deep_profiler/mdprof_feedback.m	12 Mar 2009 03:33:41 -0000	1.16
+++ deep_profiler/mdprof_feedback.m	12 Mar 2009 03:48:52 -0000
@@ -610,6 +610,11 @@ message_level_to_int(message_error) = 1.
                 %
     ;       notice_cannot_parallelise_over_nonatomic_goal
                 
+                % A pair of calls that could be parallelised have many
+                % dependant variables.  We don't yet calculate the speedup in
+                % these situations.
+    ;       notice_callpair_has_more_than_one_dependant_var
+                
                 % Couldn't find the proc defn in the progrep data, maybe the
                 % procedure is built-in.
                 %
@@ -649,6 +654,8 @@ message_type_to_level(notice_cannot_para
     message_notice.
 message_type_to_level(notice_cannot_parallelise_over_nonatomic_goal) =
     message_notice.
+message_type_to_level(notice_callpair_has_more_than_one_dependant_var) =
+    message_notice.
 message_type_to_level(warning_cannot_lookup_proc_defn) = message_warning.
 message_type_to_level(error_extra_proc_dynamics_in_clique_proc) = 
     message_error.
@@ -684,6 +691,10 @@ message_type_to_string(MessageType) = St
         String = "Parallelising call goals with non-atomic goals between them"
             ++ " is not supported"
     ;
+        MessageType = notice_callpair_has_more_than_one_dependant_var,
+        String = "Parallelising call pairs that have more than one dependant"
+            ++ " variable is not yet supported."
+    ;
         MessageType = warning_cannot_lookup_proc_defn,
         String = "Could not look up proc defn, perhaps this procedure is"
             ++ " built-in"
@@ -1604,7 +1615,8 @@ build_candidate_conjunctions_2(Info, Ins
                     Dependance = conjuncts_are_dependant(DepVars),
                     compute_optimal_dependant_parallelisation(Info, 
                         CallA, CallB, DepVars, IntermediateGoals, InstMap,
-                        CPCA, CPCB, Speedup)
+                        CPCA, CPCB, Speedup, CODPMessages),
+                    !:Messages = !.Messages ++ CODPMessages
                 ;
                     Dependance = conjuncts_are_independent,
                     compute_independent_parallelisation_speedup(Info, 
@@ -1759,11 +1771,11 @@ compute_independent_parallelisation_spee
     maybe_call_conjunct::in(call), maybe_call_conjunct::in(call),
     set(var_rep)::in, cord(maybe_call_conjunct)::in, inst_map::in,
     candidate_par_conjunct::out, candidate_par_conjunct::out,
-    float::out) is det.
+    float::out, cord(message)::out) is det.
 
 compute_optimal_dependant_parallelisation(Info, CallA, CallB,
         DepVars, _IntermediateGoals, InstMap, CPCA, CPCB,
-        Speedup) :-
+        Speedup, Messages) :-
     CostA = percall_cost(get_call_site_cost(Info, CallA ^ mccc_call_site)),
     CostB = percall_cost(get_call_site_cost(Info, CallB ^ mccc_call_site)),
     SequentialCost = CostA + CostB,
@@ -1827,18 +1839,19 @@ compute_optimal_dependant_parallelisatio
         ;
             error("Dependant var not in consumer's arguments")
         ),
-        Messages = cord.mepty
+        Messages = cord.empty
     ;
         % Post a notice saying that we tried to parallelise this but gave up.
         CallSiteDesc = 
             CallA ^ mccc_call_site ^ ccsr_call_site_summary ^ perf_row_subject,
         PSPtr = CallSiteDesc ^ csdesc_container,
-        deep_lookup_proc_statics(Deep, PSPtr, ProcStatic),
-        ProcLabel = ProcStatic ^ ps_id.
+        deep_lookup_proc_statics(Info ^ ipi_deep, PSPtr, ProcStatic),
+        ProcLabel = ProcStatic ^ ps_id,
         GoalPath = CallSiteDesc ^ csdesc_goal_path,
         append_message(goal(ProcLabel, GoalPath), 
             notice_callpair_has_more_than_one_dependant_var,
-            cord.empty, Messages)
+            cord.empty, Messages),
+        Speedup = -1.0
     ),
     call_site_conj_to_candidate_par_conjunct(Info, CallA, CPCA),
     call_site_conj_to_candidate_par_conjunct(Info, CallB, CPCB).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20090312/37af6952/attachment.sig>


More information about the reviews mailing list