[m-rev.] for review: tupling transformation (part 3)

Julien Fischer juliensf at cs.mu.OZ.AU
Fri Mar 4 00:51:35 AEDT 2005


On Thu, 3 Mar 2005, Peter Wang wrote:

> Julien Fischer wrote:
>
> >On Wed, 2 Mar 2005, Julien Fischer wrote:
> >
> >>+		% XXX: There is a problem somewhere causing CALL and EXIT
> >>+		% events not to show up for some procedures in trace count
> >>+		% files.  The weighting of the procedure's costs is disabled.
> >>+		% However, if working, it still wouldn't be ideal as we don't
> >>+		% know how many of the calls to the procedure came from within
> >>+		% or without the SCC.
> >>
> >>
> >Wasn't this occuring because the procedures had been inlined?
> >
> >
>
> It happens with -O-1, so I doubt it.
>
Which procedures weren't showing up in the trace counts file?

> >>+fix_calls_in_proc(TransformMap, proc(PredId, ProcId), !ModuleInfo) :-
> >>+	some [!ProcInfo] (
> >>+		module_info_pred_proc_info(!.ModuleInfo, PredId, ProcId,
> >>+			PredInfo, !:ProcInfo),
> >>+		% XXX: Don't modify predicates that were created by type
> >>+		% specialisation.  This is a last-minute workaround for some
> >>+		% linking problems that occurred when such predicates in the
> >>+		% library were made to call tupled procedures.
> >>
> >>
> >Do you have a test case for this problem?
> >
> >
>
> Not at the moment, but I'll see.
>

> >The changes to the other modules look fine, although I would like the
> >interval module to include a description of what an interval is at the
> >head of the module - it's the obvious place to look for it.
> >
> >
>
> I'll just quote from the stack opt paper.
>
That should be sufficient.


>  :- module backend_libs__interval.
> diff -u compiler/options.m compiler/options.m
> --- compiler/options.m    2 Mar 2005 00:15:45 -0000
> +++ compiler/options.m    3 Mar 2005 12:22:19 -0000
> @@ -1734,6 +1734,8 @@
>  long_option("osv-full-path",        optimize_saved_vars_cell_full_path).
>  long_option("osv-on-stack",        optimize_saved_vars_cell_on_stack).
>  long_option("osv-cand-head",
> optimize_saved_vars_cell_candidate_headvars).
> +    % The next four options are used by tupling.m as well; changes to
> +    % them may require changes there as well.
>  long_option("osv-cvstore-cost",
> optimize_saved_vars_cell_cv_store_cost).
>  long_option("osv-cvload-cost",
> optimize_saved_vars_cell_cv_load_cost).
>  long_option("osv-fvstore-cost",
> optimize_saved_vars_cell_fv_store_cost).
> +        unexpected(this_file,
> +            "count_load_stores_in_goal: complicated_unify")
>      ).
>
These options need to be included in mmc --help (down the bottom
of options.m), just put them in and leave them commented out for now
as with the user guide.

>
> only in patch2:
> unchanged:
> --- doc/user_guide.texi    24 Feb 2005 06:07:11 -0000    1.423
> +++ doc/user_guide.texi    3 Mar 2005 12:22:36 -0000
> @@ -6926,6 +6926,41 @@
>  @c is a tuple or a type with exactly one functor.
>  @c Note: this is almost always a pessimization.
>
> + at c @sp 1
> + at c @item --tuple
> + at c @findex --tuple
> + at c Try to find opportunities for procedures to pass some
> + at c arguments to each other as a tuple rather than as
> + at c individual arguments.  It requires the option
> + at c @samp{--tuple-trace-counts-file}, and can be tuned with
> + at c the options @samp{--osv-cvload-cost}, @samp{--osv-cvstore-cost},
> + at c @samp{--osv-fvload-cost}, @samp{--osv-fvstore-cost},
> + at c @samp{--tuple-costs-ratio} and @samp{--tuple-min-args}.
> + at c Note: so far this has mostly a detrimental effect.
> +
> + at c @sp 1
> + at c @item --tuple-trace-counts-file
> + at c @findex --tuple-trace-counts-file
> + at c Supply a trace counts summary file for the tupling transformation.
> + at c The summary should be made from a sample run of the program you are
> + at c compiling, compiled without optimizations.
> +
...

> +++ library/list.m    3 Mar 2005 12:22:36 -0000
> @@ -314,6 +314,11 @@
>      %
>  :- pred list__nth_member_search(list(T)::in, T::in, int::out) is semidet.
>
> +    % A deterministic version of list__nth_member_search, which aborts
> +    % instead of failing if the element is not found in the list.
> +    %
> +:- pred list__nth_member_lookup(list(T)::in, T::in, int::out) is det.
> +
>      % list__index*(List, Position, Elem):
>      %    These predicates select an element in a list from it's
>      %    position.  The `index0' preds consider the first element
> @@ -1025,6 +1030,13 @@
>          N = P
>      ;
>          list__nth_member_search_2(Xs, Y, P + 1, N)
> +    ).
> +
> +nth_member_lookup(List, Elem, Position) :-
> +    ( list__nth_member_search(List, Elem, PositionPrime) ->
> +        Position = PositionPrime
> +    ;
> +        error("list__nth_member_lookup/3: element not found in list")
>      ).
>
Don't forget to include this change in the log message.

Cheers,
Julien.
--------------------------------------------------------------------------
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