[m-rev.] for review: minimal model tabling analysis

Julien Fischer juliensf at cs.mu.OZ.AU
Mon Mar 13 16:42:30 AEDT 2006


On Mon, 13 Mar 2006, Julien Fischer wrote:

> Estimated hours taken: 9
> Branches: main
>
> Add a first draft of an analysis that determines what procedures might call
> code that uses minimal model tabling.  We can use this information to avoid
> adding redundant pneg context wrappers during code generation.  This reduces
> the overhead of minimal model tabling.
>
> Add two new foreign_proc attributes: `may_call_mm_tabled' and
> `will_not_call_mm_tabled' that can be used for annotating foreign_procs that
> may call mercury with information about whether they may call minimal model
> tabled procedures.
>
> Fix a minor bug with trail usage analysis: we weren't handling unsafe casts
> correctly during the second phase of the analysis.

Here are some results using the new analysis/optimization.  These were all run
on saturn using the variant of the analysis that considers builtin.unify and
builtin.compare to maybe call minimal model tabled procedures (via
user-defined equality or comparison), although that seems to make little
difference in the end.

EXTRA_MCFLAGS = --intermodule-optimization
GRADE = asm_fast.gc
mercury_compile.01 average of 6 with ignore=1     22.00
EXTRA_MCFLAGS = --intermodule-optimization --no-analyse-mm-tabling
GRADE = asm_fast.gc.mm
mercury_compile.02 average of 6 with ignore=1     27.68
EXTRA_MCFLAGS = --intermodule-optimization --analyse-mm-tabling
GRADE = asm_fast.gc.mm
mercury_compile.03 average of 6 with ignore=1     22.70

table_opt.sizes

9903913	 	 205280	4991920	15101113	 e66cb9	table_opt.01
10566657	 206112	4992080	15764849	 f08d71	table_opt.02
10122265	 205760	4992080	15320105	 e9c429	table_opt.03

grep "MR_pneg_enter" *.c | wc -l in the stage 2 compiler directories

table_opt.01:	N/A
table_opt.02:	51405
table_opt.03:	16415

The decrease in runtime overhead is certainly impressive, especially
considering that the analysis is not (yet) all that precise at procedure-level
granularity.  I suspect that, as with trail usage optimization, the results
above are the cumulative effect of removing lots of little bits of
distributed fat, rather than identifying whole procedures as not calling
minimal model tabled procedures.

A futher thought is that most of the 16415 remaining calls to pneg context
wrappers occur in parts of the compiler that aren't exercised during the
speedtest test, e.g. in the MLDS backend for example.
--------------------------------------------------------------------------
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