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 to Avoid Bad Prefetching


Hi,

could you please test the patch on the stream benchmark?  It exhibits
several opportunities for prefetching/movnt instructions that we would
not like to miss, and I somewhat suspect that the first heuristic could
cause us to.  The patch is OK assuming the results are fine.  It would
be nice to improve the heuristics later, especially the first one looks
a bit too imprecise to me.

> +      if(insn_to_prefetch_ratio < MIN_INSN_TO_PREFETCH_RATIO)
> +	return false;
> +      return true;

space after if; or better, return insn_to_prefetch_ratio >= MIN_INSN_TO_PREFETCH_RATIO;

> Index: params.def
> ===================================================================
> --- params.def	(revision 145634)
> +++ params.def	(working copy)
> @@ -761,6 +761,17 @@ DEFPARAM (PARAM_LOOP_INVARIANT_MAX_BBS_I
>  	  "max basic blocks number in loop for loop invariant motion",
>  	  10000, 0, 0)
>  
> +DEFPARAM (PARAM_MIN_INSN_TO_PREFETCH_RATIO,
> +	  "min-insn-to-prefetch-ratio",
> +	  "min. ratio of insns to prefetches to enable prefetching for "
> +          "a loop with an unknown trip count",
> +	  10, 0, 0)
> +
> +DEFPARAM (PARAM_PREFETCH_MIN_INSN_TO_MEM_RATIO,
> +	  "prefetch-min-insn-to-mem-ratio",
> +	  "min. ratio of insns to mem ops to enable prefetching in a loop",
> +	  4, 0, 0)
> +

You also need to document the params in doc/invoke.texi.

Zdenek


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