Related articles |
---|
Does Loop Fission Work in Single Cores? kunjaan@gmail.com (kunjaan) (2009-05-06) |
Re: Does Loop Fission Work in Single Cores? gneuner2@comcast.net (George Neuner) (2009-05-06) |
Re: Does Loop Fission Work in Single Cores? harold.aptroot@gmail.com (Harold Aptroot) (2009-05-07) |
Re: Does Loop Fission Work in Single Cores? stock@esa.informatik.tu-darmstadt.de (Florian Stock) (2009-05-07) |
From: | "Harold Aptroot" <harold.aptroot@gmail.com> |
Newsgroups: | comp.compilers |
Date: | Thu, 7 May 2009 10:23:52 +0200 |
Organization: | A noiseless patient Spider |
References: | 09-05-037 |
Keywords: | optimize |
Posted-Date: | 07 May 2009 07:34:45 EDT |
"kunjaan" <kunjaan@gmail.com> wrote in message
> When does it make sense to use Loop fission/distribution if I am
> compiling for a single core processor?
It's hard to answer questions like this.
I could tell you that it makes sense whenever it speeds up execution, but
such an answer is completely useless.
It can speed up execution though, such as when 2 big arrays are accessed in
the loop body but the work performed on them is not interdependant and the
arrays are so big that they do not fit in the cache. If that's the case,
then you're probably memory IO bound, since the CPU might not understand
your memory access pattern, usually they only known about forward linear
strided access and you'd be quickly switching back and forth between two
unrelated places. Confusing the CPU is almost never a good thing. Using
prefetch hints would also help, but the best prefetch offset (and the size
of the prefetched block) depend on the CPU model/brand. Splitting the loops
also works, as does interleaving the arrays (but it's often hard to prove
that it's possible to interleave them without breaking something).
Distributing the loop in 2 or more threads helps if for example you have
slow IO in the loop body, or when the CPU has HyperThreading.
Note that these were all examples, there will be more cases in which it will
improve performance.
Return to the
comp.compilers page.
Search the
comp.compilers archives again.