Previous: Part Two: Variation on Home: Contents Next: Loop Level parallelism

Clean Up Crew

Just two nagging questions remain:

How many times do we unroll a loop?

Good question. As many as we want. :-) However, if we just unroll without rescheduling, in some cases this may result in a much lower CPI - especially when there are multiple instructions performed per loop.

Why not just unroll absolutely everything?

Another good question. This actually depends on if we know the number of iterations ahead of time. If we don't, we have a big problem. So the answer is we should unroll as much as we can only if the number of iterations is static. This requires several things: a smart enough compiler, and a good mix of instructions to execute. But this creates a problem: the number of instructions increases dramatically. A potentially bigger liability occurs in the cache structure: a long unrolled loop will create more cache misses since new instructions need to be fetched constantly. We can always score instruction and data hits, since the data will almost always reside in the cache if the loop is small enough.



previous home next Previous: Part Two: Variation on Home: Contents Next: Loop Level parallelism