[m-dev.] optimizing matrix/vector expressions
Simon Taylor
stayl at cs.mu.OZ.AU
Sat Aug 16 00:31:53 AEST 2003
On 15-Aug-2003, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> The module included below demonstrates a flaw in the way that the
> compiler's deforestation/partial deduction optimizations works which
> causes the compiler to miss an important optimization opportunity.
The deforestation pass was designed to perform deforestation.
Any partial deduction it performs happens for free as part
of that process.
> We successfully partially evaluate the call to bounds/1, but
> the compiler's partial deduction thinks that there is no useful
> information available for specializing the call to fill_in_array/4
> from benchmark/2, and so it is not able to specialize the call to
> eval_elem from fill_in_array/4.
>
> Any suggestions for how we might be able to get the compiler to
> successfully optimize this?
It might be worth adding a more aggressive constant propagation/
partial evaluation pass which doesn't concentrate on pairing up
calls for deforestation. The mechanism for deciding when to
specialise would be quite different to that used for deforestation.
In cases like this where the constant has to be propagated through
several layers of calls it could become quite difficult to determine
whether the specialisation is a win.
Simon.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list