[m-rev.] diff: benchmarking minimal model overheads
Zoltan Somogyi
zs at cs.mu.OZ.AU
Tue May 17 14:18:28 AEST 2005
Provide mechanisms for measuring individually the main sources of overheads
of minimal model tabling. This was required for the paper I have just finished
with Kostis.
runtime/mercury_stacks.h:
Allow the inclusion of the extra nondet stack slot needed in
minimal-model grades to be added even in non-minimal-model grades.
compiler/options.m:
Add two new options, --disable-mm-pneg and --disable-mm-cut, that
ask the code generator not to generate code for manipulating the pneg
stack and the cut stack respectively. Add two new options for internal
use by the compiler only, that say whether the compiler should emit
code for handling the pneg stack and cut stack respectively. None of
the options is documented, since they are not for users.
compiler/handle_options.m:
Set the options to ask for the code for the pneg and cut stacks in
minimal-model grades, unless the relevant disable option is given.
compiler/code_info.m:
compiler/ite_gen.m:
Instead of testing the minimal model grade option to see whether to
emit code for the cut stack and pneg stack respectively, test the
relevant new option.
Zoltan.
cvs diff: Diffing .
cvs diff: Diffing analysis
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/doc
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
Index: compiler/code_info.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/code_info.m,v
retrieving revision 1.297
diff -u -b -r1.297 code_info.m
--- compiler/code_info.m 24 Mar 2005 02:00:17 -0000 1.297
+++ compiler/code_info.m 5 May 2005 11:05:44 -0000
@@ -1836,12 +1836,12 @@
"prepare for temp frame commit", TempFrameCode, !CI),
code_info__get_globals(!.CI, Globals),
globals__lookup_bool_option(Globals,
- use_minimal_model_stack_copy,
- UseMinimalModelStackCopy),
+ use_minimal_model_stack_copy_cut,
+ UseMinimalModelStackCopyCut),
HijackInfo = commit_temp_frame(MaxfrSlot,
- UseMinimalModelStackCopy),
+ UseMinimalModelStackCopyCut),
(
- UseMinimalModelStackCopy = yes,
+ UseMinimalModelStackCopyCut = yes,
% If the code we are committing across starts but
% does not complete the evaluation of a tabled subgoal,
% the cut will remove the generator's choice point,
@@ -1868,7 +1868,7 @@
no, no, no, no, no, yes) - ""
])
;
- UseMinimalModelStackCopy = no,
+ UseMinimalModelStackCopyCut = no,
MarkCode = empty
),
HijackCode = tree(MaxfrCode, tree(TempFrameCode, MarkCode))
Index: compiler/handle_options.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/handle_options.m,v
retrieving revision 1.228
diff -u -b -r1.228 handle_options.m
--- compiler/handle_options.m 7 Apr 2005 06:32:07 -0000 1.228
+++ compiler/handle_options.m 5 May 2005 11:45:46 -0000
@@ -1158,6 +1158,35 @@
% XXX we should allow hijacks in table_builtin.m
option_implies(use_minimal_model_stack_copy, allow_hijacks, bool(no)),
+ % Stack copy minimal model tabling needs to generate extra code
+ % at possibly negated contexts to handle the pneg stack and at commits
+ % to handle the cut stack. The code below allows the generation of
+ % these extra pieces of code to be disabled. The disabled program will
+ % work only if the program doesn't actually use minimal model tabling,
+ % which makes it useful only for performance testing.
+ globals__io_lookup_bool_option(disable_minimal_model_stack_copy_pneg,
+ DisablePneg),
+ globals__io_lookup_bool_option(disable_minimal_model_stack_copy_cut,
+ DisableCut),
+ (
+ { UseMinimalModelStackCopy = yes },
+ { DisablePneg = no }
+ ->
+ globals__io_set_option(use_minimal_model_stack_copy_pneg,
+ bool(yes))
+ ;
+ []
+ ),
+ (
+ { UseMinimalModelStackCopy = yes },
+ { DisableCut = no }
+ ->
+ globals__io_set_option(use_minimal_model_stack_copy_cut,
+ bool(yes))
+ ;
+ []
+ ),
+
% --dump-hlds and --statistics require compilation by phases
globals__io_lookup_accumulating_option(dump_hlds, DumpStages),
globals__io_lookup_bool_option(statistics, Statistics),
Index: compiler/ite_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/ite_gen.m,v
retrieving revision 1.77
diff -u -b -r1.77 ite_gen.m
--- compiler/ite_gen.m 22 Mar 2005 06:40:02 -0000 1.77
+++ compiler/ite_gen.m 5 May 2005 11:05:44 -0000
@@ -410,10 +410,10 @@
make_pneg_context_wrappers(Globals, PNegCondCode, PNegThenCode, PNegElseCode)
:-
- globals__lookup_bool_option(Globals, use_minimal_model_stack_copy,
- UseMinimalModelStackCopy),
+ globals__lookup_bool_option(Globals, use_minimal_model_stack_copy_pneg,
+ UseMinimalModelStackCopyPNeg),
(
- UseMinimalModelStackCopy = yes,
+ UseMinimalModelStackCopyPNeg = yes,
PNegCondComponents = [
pragma_c_raw_code(
@@ -443,7 +443,7 @@
no, no, no, no, yes, yes) - ""
])
;
- UseMinimalModelStackCopy = no,
+ UseMinimalModelStackCopyPNeg = no,
PNegCondCode = empty,
PNegThenCode = empty,
PNegElseCode = empty
Index: compiler/options.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/options.m,v
retrieving revision 1.457
diff -u -b -r1.457 options.m
--- compiler/options.m 27 Apr 2005 03:21:21 -0000 1.457
+++ compiler/options.m 5 May 2005 11:30:07 -0000
@@ -404,6 +404,12 @@
% only -- if you turn this off, then the
% debugger may dereference garbage pointers.
; rtti_line_numbers
+ % These four are used to analyze the
+ % performance effects of minimal model tabling.
+ ; disable_minimal_model_stack_copy_pneg
+ ; disable_minimal_model_stack_copy_cut
+ ; use_minimal_model_stack_copy_pneg
+ ; use_minimal_model_stack_copy_cut
% Code generation options
; low_level_debug
; trad_passes
@@ -1044,7 +1050,11 @@
type_ctor_layout - bool(yes),
type_ctor_functors - bool(yes),
rtti_line_numbers - bool(yes),
- new_type_class_rtti - bool(no)
+ new_type_class_rtti - bool(no),
+ disable_minimal_model_stack_copy_pneg - bool(no),
+ disable_minimal_model_stack_copy_cut - bool(no),
+ use_minimal_model_stack_copy_pneg - bool(no),
+ use_minimal_model_stack_copy_cut - bool(no)
]).
option_defaults_2(code_gen_option, [
% Code Generation Options
@@ -1719,6 +1729,8 @@
long_option("type-ctor-functors", type_ctor_functors).
long_option("new-type-class-rtti", new_type_class_rtti).
long_option("rtti-line-numbers", rtti_line_numbers).
+long_option("disable-mm-pneg", disable_minimal_model_stack_copy_pneg).
+long_option("disable-mm-cut", disable_minimal_model_stack_copy_cut).
% code generation options
long_option("low-level-debug", low_level_debug).
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing deep_profiler
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
cvs diff: Diffing extras
cvs diff: Diffing extras/aditi
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/concurrency
cvs diff: Diffing extras/curs
cvs diff: Diffing extras/curs/samples
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/error
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/easyx
cvs diff: Diffing extras/graphics/easyx/samples
cvs diff: Diffing extras/graphics/mercury_glut
cvs diff: Diffing extras/graphics/mercury_opengl
cvs diff: Diffing extras/graphics/mercury_tcltk
cvs diff: Diffing extras/graphics/samples
cvs diff: Diffing extras/graphics/samples/calc
cvs diff: Diffing extras/graphics/samples/gears
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/lex
cvs diff: Diffing extras/lex/samples
cvs diff: Diffing extras/lex/tests
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/moose/tests
cvs diff: Diffing extras/morphine
cvs diff: Diffing extras/morphine/non-regression-tests
cvs diff: Diffing extras/morphine/scripts
cvs diff: Diffing extras/morphine/source
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/quickcheck
cvs diff: Diffing extras/quickcheck/tutes
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/stream
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/xml
cvs diff: Diffing extras/xml/samples
cvs diff: Diffing extras/xml_stylesheets
cvs diff: Diffing java
cvs diff: Diffing java/runtime
cvs diff: Diffing library
cvs diff: Diffing mdbcomp
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
Index: runtime/mercury_stacks.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_stacks.h,v
retrieving revision 1.49
diff -u -b -r1.49 mercury_stacks.h
--- runtime/mercury_stacks.h 20 Jul 2004 04:41:24 -0000 1.49
+++ runtime/mercury_stacks.h 5 May 2005 11:10:38 -0000
@@ -126,6 +126,16 @@
#define MR_TABLE_DETFR (-5) /* sp, in minimal model main frames only */
/*
+** This setup allows MR_USE_MINIMAL_MODEL_STACK_COPY_EXTRA_SLOT to be defined
+** even if MR_USE_MINIMAL_MODEL_STACK_COPY isn't, which can be useful for
+** performance testing.
+*/
+
+#ifdef MR_USE_MINIMAL_MODEL_STACK_COPY
+ #define MR_USE_MINIMAL_MODEL_STACK_COPY_EXTRA_SLOT
+#endif
+
+/*
** MR_Code that traverses the nondet stack depends on the relationship
** MR_NONDET_TEMP_SIZE < MR_DET_TEMP_SIZE < MR_NONDET_FIXED_SIZE.
** All three sizes are measured in words.
@@ -133,7 +143,7 @@
#define MR_NONDET_TEMP_SIZE 3 /* prevfr, redoip, redofr */
#define MR_DET_TEMP_SIZE 4 /* prevfr, redoip, redofr, detfr */
-#ifdef MR_USE_MINIMAL_MODEL_STACK_COPY
+#ifdef MR_USE_MINIMAL_MODEL_STACK_COPY_EXTRA_SLOT
#define MR_NONDET_FIXED_SIZE 6 /* prevfr, redoip, redofr, succip, succfr,
sp */
#else
@@ -179,7 +189,7 @@
/* DEFINITIONS FOR MANIPULATING THE NONDET STACK */
-#ifdef MR_USE_MINIMAL_MODEL_STACK_COPY
+#ifdef MR_USE_MINIMAL_MODEL_STACK_COPY_EXTRA_SLOT
#define MR_maybe_fill_table_detfr_slot() \
do { \
MR_table_detfr_slot_word(MR_curfr) = \
cvs diff: Diffing runtime/GETOPT
cvs diff: Diffing runtime/machdeps
cvs diff: Diffing samples
cvs diff: Diffing samples/c_interface
cvs diff: Diffing samples/c_interface/c_calls_mercury
cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/mercury_calls_c
cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/tests
cvs diff: Diffing samples/tests/c_interface
cvs diff: Diffing samples/tests/c_interface/c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/tests/c_interface/mercury_calls_c
cvs diff: Diffing samples/tests/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/tests/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/tests/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/tests/diff
cvs diff: Diffing samples/tests/muz
cvs diff: Diffing samples/tests/rot13
cvs diff: Diffing samples/tests/solutions
cvs diff: Diffing samples/tests/toplevel
cvs diff: Diffing scripts
cvs diff: Diffing slice
cvs diff: Diffing tests
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
cvs diff: Diffing tests/debugger/declarative
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/general
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/general/string_format
cvs diff: Diffing tests/general/structure_reuse
cvs diff: Diffing tests/grade_subdirs
cvs diff: Diffing tests/hard_coded
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/purity
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
cvs diff: Diffing tests/invalid/purity
cvs diff: Diffing tests/misc_tests
cvs diff: Diffing tests/mmc_make
cvs diff: Diffing tests/mmc_make/lib
cvs diff: Diffing tests/recompilation
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
cvs diff: Diffing trace
cvs diff: Diffing util
cvs diff: Diffing vim
cvs diff: Diffing vim/after
cvs diff: Diffing vim/ftplugin
cvs diff: Diffing vim/syntax
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list