Patch to Avoid Bad Prefetching

Richard Guenther richard.guenther@gmail.com
Thu Apr 16 08:28:00 GMT 2009


On Thu, Apr 16, 2009 at 3:02 AM, Zdenek Dvorak <rakdver@kam.mff.cuni.cz> wrote:
> Hi,
>
>> An estimate of 10 iterations can lead to a serious degradation in
>> performance if the actual trip count turns out to be less than 10 and
>> less than the ahead distance.
>
> so just require that the number of iterations is at least 3*ahead (I
> think prefetching would not be useful for such loops with just a few
> iterations, anyway), or possibly disable the prefetching completely if
> we do not have a reasonable estimate (i.e., if
> estimate_number_of_iterations fails).

Yes, this is what I suggested.  Punt if estimate_number_of_iterations
fails (without yet another aritificial parameter).

>> However, the user can always override that conservative estimate by
>> setting the prefetch-unknown-trip-count parameter that I am proposing.
>> It seems to me that setting this parameter provides the programmer with
>> an easy way to give a hint about the trip count if he wants.
>
> I think programmers are even less likely to play with the hundreds
> of options gcc provides than to use profile feedback,

Correct.  And compilation-unit wide params are not really useful
for tuning optimizations on specific loops.

Richard.



More information about the Gcc-patches mailing list