This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch, PR44297] prefetch improvements to fix 465.tonto from non-constant step prefetching


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]