This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch, PR44297] prefetch improvements to fix 465.tonto from non-constant step prefetching
- From: Zdenek Dvorak <rakdver at kam dot mff dot cuni dot cz>
- To: "Fang, Changpeng" <Changpeng dot Fang at amd dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, "sebpop at gmail dot com" <sebpop at gmail dot com>
- Date: Wed, 9 Jun 2010 09:23:19 +0200
- Subject: Re: [patch, PR44297] prefetch improvements to fix 465.tonto from non-constant step prefetching
- References: <20100607231237.GL19235@codesourcery.com> <D4C76825A6780047854A11E93CDE84D02F7725@SAUSEXMBP01.amd.com>
Hi,
> /* Prefetching improves performance by overlapping cache missing
> @@ -1709,7 +1715,7 @@ loop_prefetch_arrays (struct loop *loop)
> /* Step 2: estimate the reuse effects. */
> prune_by_reuse (refs);
>
> - prefetch_count = estimate_prefetch_count (refs);
> + prefetch_count = estimate_prefetch_count (refs, 1);
> if (prefetch_count == 0)
> goto fail;
>
> @@ -1733,6 +1739,8 @@ loop_prefetch_arrays (struct loop *loop)
> ahead, unroll_factor, est_niter,
> ninsns, mem_ref_count, prefetch_count);
>
> + /* Re-estimate the prefetch count based upon loop unrolling. */
> + prefetch_count = estimate_prefetch_count (refs, unroll_factor);
> if (!is_loop_prefetching_profitable (ahead, est_niter, ninsns, prefetch_count,
> mem_ref_count, unroll_factor))
> goto fail;
this construction is a bit confusing. It would be better to replace
prefetch_count = estimate_prefetch_count (refs, 1);
if (prefetch_count == 0)
goto fail;
with
if (nothing_to_prefetch_p (refs))
goto fail;
where nothing_to_prefetch_p would just test whether there is any reference with
should_issue_prefetch_p. Also, the prefetch_count = estimate_prefetch_count (refs, unroll_factor);
line should be placed before the preceding statement (that dumps the value of prefetch_count),
Zdenek