Compaq KAP C/OpenMP
for Tru64 UNIX
User Guide


Previous Contents Index

A.6 Loop-Carried Dependence

A dependence is said to be carried by a loop if the corresponding direction vector element for that loop has a directional component (<, <, /, or *). Loop-carried dependence is an important concept for discovering when the iterations of the loop can be executed concurrently. If there are no loop-carried dependences, all iterations of that loop can be executed in parallel without synchronization.

A.7 Data-Dependence Example


  for (i=1; i<=n; i++)  { 
      a[i] = b[i] + 2; 
      c[i] = a[i+1] + d[i]; 
   } 

This loop cannot be vectorized or concurrentized directly. An antidependence on a exists from the second assignment statement to the first. If this loop were directly concurrentized, some executions of the first statement could precede those of the second, and the antidependence would be violated. The values a[2] through a[n] would be incorrect.

If the two statements were interchanged, the loop could be vectorized directly, or distributed with each new loop concurrentized.


Index Contents