120 likes | 199 Views
Nonlinear and Symbolic Data Dependence Testing. William Blume, Rudolf Eigenmann. Presented by Chen-Yong Cher http://min.ecn.purdue.edu/~chenyong/rangetest.ppt. Background. 80s-90s Benerjee, Omega Can’t handle symbolic and non-linear expr Example:
E N D
Nonlinear and Symbolic Data Dependence Testing William Blume, Rudolf Eigenmann Presented by Chen-Yong Cher http://min.ecn.purdue.edu/~chenyong/rangetest.ppt
Background • 80s-90s Benerjee, Omega • Can’t handle symbolic and non-linear expr • Example: • i3, i2, c*i where c not a known constant • Often arise after compiler transformations • Range Test (1998) • Check if certain symbolic inequalities hold
Range Test – high level view • Disproves Dependences • No dependence if from iteration i to i+1 • Range (i) not overlap Range(i+1) • No overlap if • max(range(i)) < min(range(i+1)) • Key: able to evaluate inqualities symbolically
for i for j A[f(i,j)] = … = A[g(i,j)] Examples Case 1 : Disprove independence by Theorem 1 g(*,*) f(*,*) n 2n 0 Array subscript Case 2 : Disprove by Theorem 2 or Theorem 3 f(0,*) g(0,*) f(1,*) g(1,*) f(2,*) g(2,*) 2n 3n 4n 5n 6n 0 n Case 3 : Reduced to case 1 or 2 through permutation f(0,1) g(0,1) f(1,1) g(1,1) 2n 4n 0
Theorem 1 If fjmax (i1, … ij) < gjmin (i1,…,ij) for all (i1,…,ij) € Rj, then there’s no dependence min max g(i1,…,ij) f(i1,…,ij) 0
Theorem 2 If gjmin (i1,…,ij) is monotonically non-decreasing for ij and If fjmax (i1, … ij) < gjmin (i1,…,ij+stridej) for all (i1,…,ij) € Rj, and lowerj <= ij <= upperj – stridej then there’s no dependence Note: Need to apply for f->g and g->f
Theorem 3 If gjmin (i1,…,ij) is monotonically non-increasing for ij and If fjmax (i1, … ij) < gjmin (i1,…,ij-stridej) for all (i1,…,ij) € Rj, and Lowerj + stridej <= ij <= upperj then there’s no dependence Note: Need to apply for f->g and g->f
Permuting Loops for Testing • For Case 3, all 3 theorems fail • Permute loops to reduce to case 1 or 2 • Does not try all possible permutations • Tries to move loop inwards • Make range continuous
Algorithm • Refer to paper
Generalizing the Range Test • Multidimentional arrays • Negetive strides • Loop-variant variables • Not perfectly nested loops
Symbolic Range Propagation • Collect and propagate symbolic ranges • 2 parts • Range propagation algorithm • Symbolic expression comparison facility • Example code segment If (a<100) THEN {BODY (know a < 100)} Else if (a < 200) THEN { know a < 200) } {merge point, know a < 100}
Conclusions • Identify parallel loops effectively • Handle non-linear, symbolic expressions • The only dependence test in Polaris • Parallelize Perfect as well as hand-written • Acceptable execution time w/ memoization