[m-rev.] diff: Add a new option --ignore-par-conjunctions.
Paul Bone
pbone at csse.unimelb.edu.au
Thu Oct 13 11:39:10 AEDT 2011
Introduce an undocumented option to help me test code.
--ignore-par-conjunctions has been created to replace parallel conjunctions
with plain conjunctions, this is helpful for testing. Note that this does not
affect implicit parallelism.
compiler/options.m:
Created new option.
compiler/simplify.m:
Handle the new option within the simplification pass.
doc/user_guide.texi:
Document new option.
Index: compiler/options.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/options.m,v
retrieving revision 1.701
diff -u -p -b -r1.701 options.m
--- compiler/options.m 27 Sep 2011 04:41:25 -0000 1.701
+++ compiler/options.m 12 Oct 2011 12:55:07 -0000
@@ -1008,6 +1008,7 @@
% recompiling most of the modules in the compiler. Having this
% option permanently here should reduce the need for that.
+ ; ignore_par_conjunctions
; control_granularity
; distance_granularity
; implicit_parallelism
@@ -1877,6 +1878,7 @@ option_defaults_2(miscellaneous_option,
analysis_file_cache_dir - string(""),
compiler_sufficiently_recent - bool(no),
experiment - string(""),
+ ignore_par_conjunctions - bool(no),
control_granularity - bool(no),
distance_granularity - int(0),
implicit_parallelism - bool(no),
@@ -2846,6 +2848,8 @@ long_option("java-export-ref-out", comp
long_option("java-generics-2010-04-13",
compiler_sufficiently_recent).
long_option("experiment", experiment).
+long_option("ignore-par-conjunctions",
+ ignore_par_conjunctions).
long_option("control-granularity", control_granularity).
long_option("distance-granularity", distance_granularity).
long_option("implicit-parallelism", implicit_parallelism).
@@ -5764,6 +5768,11 @@ options_help_misc -->
% The `--local-module-id' option is used by `mmc --make'.
% The `--analysis-file-cache-dir' option is used by `mmc --make'.
+% "--ignore-parallel-conjunctions",
+% "\tReplace parallel conjunctions with plain ones, this is useful",
+% "\tfor benchmarking. Note that it does not affect implicit",
+% "\tparallelism",
+
"--control-granularity",
"\tDon't try to generate more parallelism than the machine can",
"\thandle, which may be specified at runtime or detected",
Index: compiler/simplify.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/simplify.m,v
retrieving revision 1.272
diff -u -p -b -r1.272 simplify.m
--- compiler/simplify.m 13 Sep 2011 06:46:03 -0000 1.272
+++ compiler/simplify.m 12 Oct 2011 12:53:53 -0000
@@ -96,6 +96,8 @@
; simp_extra_common_struct % do common structure elimination
% even when it might increase stack
% usage (used by deforestation).
+ ; simp_ignore_par_conjs % Replace parallel conjunctions with
+ % plain conjunctions.
.
:- type simplifications.
@@ -117,6 +119,7 @@
:- pred simplify_do_const_prop(simplify_info::in) is semidet.
:- pred simplify_do_common_struct(simplify_info::in) is semidet.
:- pred simplify_do_extra_common_struct(simplify_info::in) is semidet.
+:- pred simplify_do_ignore_par_conjunctions(simplify_info::in) is semidet.
%-----------------------------------------------------------------------------%
%-----------------------------------------------------------------------------%
@@ -181,14 +184,15 @@
do_opt_duplicate_calls :: bool,
do_constant_prop :: bool,
do_common_struct :: bool,
- do_extra_common_struct :: bool
+ do_extra_common_struct :: bool,
+ do_ignore_par_conjunctions :: bool
).
simplifications_to_list(Simplifications) = List :-
Simplifications = simplifications(WarnSimpleCode, WarnDupCalls,
DoFormatCalls, WarnObsolete, DoOnce,
AfterFrontEnd, ExcessAssign, ElimRemovableScopes, OptDuplicateCalls,
- ConstantProp, CommonStruct, ExtraCommonStruct),
+ ConstantProp, CommonStruct, ExtraCommonStruct, RemoveParConjunctions),
List =
( WarnSimpleCode = yes -> [simp_warn_simple_code] ; [] ) ++
( WarnDupCalls = yes -> [simp_warn_duplicate_calls] ; [] ) ++
@@ -201,7 +205,8 @@ simplifications_to_list(Simplifications)
( OptDuplicateCalls = yes -> [simp_opt_duplicate_calls] ; [] ) ++
( ConstantProp = yes -> [simp_constant_prop] ; [] ) ++
( CommonStruct = yes -> [simp_common_struct] ; [] ) ++
- ( ExtraCommonStruct = yes -> [simp_extra_common_struct] ; [] ).
+ ( ExtraCommonStruct = yes -> [simp_extra_common_struct] ; [] ) ++
+ ( RemoveParConjunctions = yes -> [simp_ignore_par_conjs] ; [] ).
list_to_simplifications(List) =
simplifications(
@@ -216,7 +221,8 @@ list_to_simplifications(List) =
( list.member(simp_opt_duplicate_calls, List) -> yes ; no ),
( list.member(simp_constant_prop, List) -> yes ; no ),
( list.member(simp_common_struct, List) -> yes ; no ),
- ( list.member(simp_extra_common_struct, List) -> yes ; no )
+ ( list.member(simp_extra_common_struct, List) -> yes ; no ),
+ ( list.member(simp_ignore_par_conjs, List) -> yes ; no )
).
find_simplifications(WarnThisPass, Globals, Simplifications) :-
@@ -250,6 +256,8 @@ find_simplifications(WarnThisPass, Globa
AfterFrontEnd = no,
ElimRemovableScopes = no,
ExtraCommonStruct = no,
+ globals.lookup_bool_option(Globals, ignore_par_conjunctions,
+ RemoveParConjunctions),
Simplifications = simplifications(
( WarnSimple = yes, WarnThisPass = yes -> yes ; no),
@@ -263,7 +271,8 @@ find_simplifications(WarnThisPass, Globa
OptDuplicateCalls,
ConstantProp,
CommonStruct,
- ExtraCommonStruct
+ ExtraCommonStruct,
+ RemoveParConjunctions
).
simplify_do_warn_simple_code(Info) :-
@@ -302,6 +311,9 @@ simplify_do_common_struct(Info) :-
simplify_do_extra_common_struct(Info) :-
simplify_info_get_simplifications(Info, Simplifications),
Simplifications ^ do_extra_common_struct = yes.
+simplify_do_ignore_par_conjunctions(Info) :-
+ simplify_info_get_simplifications(Info, Simplifications),
+ Simplifications ^ do_ignore_par_conjunctions = yes.
%-----------------------------------------------------------------------------%
@@ -1087,10 +1099,15 @@ simplify_goal_parallel_conj(Goals0, Goal
GoalInfo, !Info)
;
Goals0 = [_, _ | _],
+ ( simplify_do_ignore_par_conjunctions(!.Info) ->
+ simplify_goal_plain_conj(Goals0, GoalExpr, GoalInfo0, GoalInfo,
+ !Info)
+ ;
GoalInfo = GoalInfo0,
simplify_par_conj(Goals0, Goals, !.Info, !Info),
GoalExpr = conj(parallel_conj, Goals),
simplify_info_set_has_parallel_conj(yes, !Info)
+ )
).
:- pred simplify_goal_disj(
Index: doc/user_guide.texi
===================================================================
RCS file: /home/mercury1/repository/mercury/doc/user_guide.texi,v
retrieving revision 1.638
diff -u -p -b -r1.638 user_guide.texi
--- doc/user_guide.texi 27 Sep 2011 00:49:26 -0000 1.638
+++ doc/user_guide.texi 12 Oct 2011 12:55:31 -0000
@@ -9486,6 +9486,13 @@ excessively ambiguous overloading to @va
If this limit is reached,
the typechecker will not process the predicate or function any further.
+ at c @sp 1
+ at c @item --ignore-par-conjunctions
+ at c @findex --ignore-par-conjunctions
+ at c Replace parallel conjunctions with plain ones.
+ at c This can help developers benchmark their code.
+ at c This does not affect implicit parallelism.
+
@sp 1
@item --control-granularity
@findex --control-granularity
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20111013/dfe503f0/attachment.sig>
More information about the reviews
mailing list