Module 18: Loop Optimizations
  Lecture 35: Amdahl’s Law
 


Node Splitting

  • Loop parallelization is impossible when the statements are involved in a dependence cycle
  • Sometimes dependence cycles can be broken resulting in total/partial parallelization of loop
  • Flow dependence cycles are very hard to break
  • Anti-and output-dependence cycles can be broken by renaming variables
  • Following loop can not be parallelized
for I = 1,n
A[i] = B[i] + C[i]
D[i] = A[i-1] + A[i+1]
endfor

Node Splitting …

for I = 1,n
A[i] = B[i] + C[i]
temp[i] = A[i+1]
D[i] = A[i-1] + temp[i]
endfor
for I = 1,n
temp[i] = A[i+1]
A[i] = B[i] + C[i]
D[i] = A[i-1] + temp[i]
endfor
temp[1..n] = A[2..n+1]
A[1..n] = B[1..n] + C[1..n]
D[1..n] = A[0..n-1] + temp[1..n]

Cycle Shrinking

  • In many loops dependence cycles are impossible to break
  • Such dependence cycles usually involve only few dependences
  • Cycle shrinking is used to extract any parallelism that may be present in the loop