Loop Independence

Loop independence is important since loops that are independent can be parallelized. Independent loops can be parallelized in a number of ways, from the course-grained parallelism of OpenMP*, to fine-grained Instruction Level Parallelism (ILP) of vectorization and software pipelining.

Loops are considered independent when the computation of iteration Y of a loop can be done independently of the computation of iteration X. In other words, if iteration 1 of a loop can be computed and iteration 2 simultaneously could be computed without using any result from iteration 1, then the loops are independent.

Occasionally, you can determine if a loop is independent by comparing results from the output of the loop with results from the same loop written with a decrementing index counter.

The Intel® compiler can successfully vectorize or SWP most loops containing reductions on simple math operators like multiplication (*), addition (+), subtraction (-), and division (/).

The compiler might occasionally misidentify a reduction and report flow, anti, output dependencies or sometimes loop-carried memory-dependency-edges and will not vectorize or SWP the loop.