[m-rev.] for review: inline par_conj primitives
Peter Wang
novalazy at gmail.com
Thu Jun 11 13:08:24 AEST 2009
2009/6/10 Zoltan Somogyi <zs at csse.unimelb.edu.au>:
> For review by Peter Wang or Paul Bone.
>
> Zoltan.
>
> A first step in allowing users to ask the compiler to implement the primitive
> operations needed for dependent parallel conjunctions *either* as calls to
> library/par_builtin (as at present), *or* as inline C code.
>
> The second option should be faster, and should also solve the problem
> of the compiler not optimizing away unnecessary calls to par_builtin.get.
> The reason was that in the absence of access to the code of par_builtin.get,
> simplify.m does not know whether that predicate can loop forever or throw
> an exception. The corresponding foreign proc can be marked to show that
> it can do neither.
> Index: compiler/dep_par_conj.m
> ===================================================================
> RCS file: /home/mercury/mercury1/repository/mercury/compiler/dep_par_conj.m,v
> retrieving revision 1.34
> diff -u -r1.34 dep_par_conj.m
> --- compiler/dep_par_conj.m 19 Feb 2009 03:49:17 -0000 1.34
> +++ compiler/dep_par_conj.m 20 Feb 2009 07:42:33 -0000
> @@ -2560,90 +2569,193 @@
> allocate_future(ModuleInfo, SharedVar, AllocGoal, !VarSet, !VarTypes,
> !FutureMap) :-
> map.lookup(!.VarTypes, SharedVar, SharedVarType),
> - make_future_var(SharedVar, SharedVarType, !VarSet, !VarTypes, FutureVar),
> + make_future_var(SharedVar, SharedVarType, !VarSet, !VarTypes,
> + FutureVar, FutureVarType),
> svmap.det_insert(SharedVar, FutureVar, !FutureMap),
>
> ModuleName = mercury_par_builtin_module,
> - PredName = "new_future",
> - Args = [FutureVar],
> + PredName = new_pred_name,
new_future_pred_name would be better.
> Index: compiler/options.m
> ===================================================================
> RCS file: /home/mercury/mercury1/repository/mercury/compiler/options.m,v
> retrieving revision 1.648
> diff -u -r1.648 options.m
> --- compiler/options.m 21 May 2009 04:42:15 -0000 1.648
> +++ compiler/options.m 1 Jun 2009 02:48:29 -0000
> @@ -1497,6 +1498,7 @@
> tuple_trace_counts_file - string(""),
> tuple_costs_ratio - int(100),
> tuple_min_args - int(4),
> + inline_par_builtins - bool(no),
> always_specialize_in_dep_par_conjs - bool(no),
> allow_some_paths_only_waits - bool(yes),
> control_granularity - bool(no),
> @@ -4833,19 +4836,22 @@
> % "\ttransformation will consider passing together as a",
> % "\ttuple. This is mostly to speed up the compilation",
> % "\tprocess by not pursuing (presumably) unfruitful searches.",
> +% This is for measurements by implementors only.
> +% "--no-inline-par-builtins",
> +% "\tGenerate calls to the predicates of par_builtin.m, instead of",
> +% "\tbodily including their definitions as C code.",
> +% Actually, this is the default for now.
The documentation is inverted, but I suppose you mean to make
--inline-par-builtins the default, once it works.
> Index: library/par_builtin.m
> ===================================================================
> RCS file: /home/mercury/mercury1/repository/mercury/library/par_builtin.m,v
> retrieving revision 1.18
> @@ -302,6 +209,8 @@
> #endif
> ").
>
> +<<<<<<< par_builtin.m
> +=======
> :- pragma foreign_proc("C",
> get(Future::in, Value::out),
> [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail],
> @@ -398,5 +307,6 @@
> IO = IO0;
> ").
>
> +>>>>>>> 1.18
Obviously.
> +++ runtime/mercury_par_builtin.c 25 Oct 2008 06:24:40 -0000
> @@ -0,0 +1,27 @@
> +/*
> +vim: ft=c ts=4 sw=4 et
> +*/
> +/*
> +** Copyright (C) 2008 The University of Melbourne.
> +++ runtime/mercury_par_builtin.h 3 Nov 2008 04:29:47 -0000
> @@ -0,0 +1,208 @@
> +/*
> +vim: ft=c ts=4 sw=4 et
> +*/
> +/*
> +** Copyright (C) 2008 The University of Melbourne.
2006-2009
Looks fine.
Peter
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to: mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions: mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the reviews
mailing list