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] Improve prefetch heuristics


Hi,

> > The reason is that there are too many prefetches. Here is an example:
> > Ahead 5, unroll factor 1, trip count 216, insn count 49, mem ref count 15, prefetch count 15
> >
> > Here we inserted one prefetch for each memory reference. I just feel uncomfortable that
> > we inserted so many prefetches in this loop. I think prefetches will compete with loads/stores
> > for memory ports and bandwidth, and thus cause performance degradation in this case.
> 
> >SIMULTANEOUS_PREFETCHES parameter is used to avoid that.  Perhaps it is set too high for your
> >architecture?
> 
>  SIMULTANEOUS_PREFETCHES does not consider the existing memory references in the loop. If we
> consider prefetch as a memory reference, then we have 30 memory reference in this loop. It is too many
> for a loop with instruction count of 49.
> 
> I am thinking whether we can account prefetch instruction in the prefetch-min-insns-to-mem ratio heuristic.
> The idea is:
>   max_num_prefetches = ninsns - mem_ref_count *  prefetch-min-insns-to-mem ratio;
> 
> Then in schedule_prefetches, we can schedule at most  "max_num_prefetches" prefetches.
> 
> What do you think?

I don't quite understand why this would be useful.  After all, the prefetches do not affect
the number or amount of memory accesses, so they will not "compete with loads/stores
for memory ports and bandwidth",

Zdenek


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