Presentation is loading. Please wait.

Presentation is loading. Please wait.

Automatic Array Privatization Presented by: Karl Cheng Peng Tu and David Padua In Proceedings of the 6th Annual Workshop on Languages and Compilers for.

Similar presentations


Presentation on theme: "Automatic Array Privatization Presented by: Karl Cheng Peng Tu and David Padua In Proceedings of the 6th Annual Workshop on Languages and Compilers for."— Presentation transcript:

1 Automatic Array Privatization Presented by: Karl Cheng Peng Tu and David Padua In Proceedings of the 6th Annual Workshop on Languages and Compilers for Parallel Computing, August 1993.

2 Contribution data flow-based vs. dependence analysis Extensible for interprocedural analysis Distinguish static and dynamic last value assignment

3 Data Flow Framework For the loop below: 1. X(1:N) = 0 2. DO I = 1,N 3. A(1) = X(I) 4. DO J=2,N 5. Y(J) = J 6. A(J) = A(J-1)+Y(J) 7. ENDDO 8. ENDDO The flow graph looks like: J X(I) A(1)Y(J) A(J)

4 Data Flow framework For basic block S and the set of variables VAR in the program, we define: DEF(S) = {v in VAR: v has outward exposed definition in S} USE(S) = {v in VAR: v has outward exposed use in S} KILL(S) = {v in VAR: v has a definition in S}

5 Data Flow framework For the basic block in the inner loop of the previous program: 5. Y(J) = J 6. A(J) = A(J-1)+Y(J) We define: DEF(S) = {A(J), Y(J)} USE(S) = {A(J-1),J} KILL(S) = {A(J),Y(J)} A(J) Y(J) J A(J-1)

6 MRD MRD in (S): set of variables always defined upon entering S MRD in (S) = ∩t in pred(S) MRDout(t) MRD out (S): set of variables always defined upon exiting S MRD out (S) = (MRD in (S) – KILL(S)) U DEF(S)

7 MRD 1. X(1:N) = 0 2. DO I = 1,N 3. A(1) = X(I) 4. DO J=2,N 5. Y(J) = J 6. A(J) = A(J-1)+Y(J) 7. ENDDO 8. ENDDO Remember: DEF(S) = {A(J), Y(J)} USE(S) = {A(J-1),J} KILL(S) = {A(J),Y(J)} Now: MRD in (S) = ∩ t in pred(S) MRDout(t) = {J} MRD out (S) = (MRD in (S) – KILL(S)) U DEF(S) = {A(J), Y(J), J} Back edges are removed J X(I) A(J-1) Y(J) A(J) S

8 Abstraction of inner loops Extends definition for basic block to 1iteration of loop body 1. DEF b (L) = must defined variables for 1 iteration of Loop L DEF b (L) = ∩ (MRDout(t) : t in exits (L) 2. USE b (L) = possibly outward exposed variables USE b (L) = U (USE(t) – MRD in (t)) : t in body (L) 3. KILL b (L) = DEF b (L) 4. PRI b (L) = privatizable variables: used but not exposed to definition outside of iteration PRI b (L) = U { USE(t) : t in body(L)} - USE b (L)

9 Abstraction of inner loops 1. X(1:N) = 0 2. DO I = 1,N 3. A(1) = X(I) 4. DO J=2,N 5. Y(J) = J 6. A(J) = A(J-1)+Y(J) 7. ENDDO 8. ENDDO Remember: MRD in (S) = ∩ t in pred(S) MRDout(t) = {J} MRD out (S) = (MRD in (S) – KILL(S)) U DEF(S) = {A(J), Y(J), J} Now: DEF b (L) = ∩ (MRDout(t) : t in exits (L) = {A(J), Y(J), J} USE b (L) = U (USE(t) – MRD in (t)) : t in body (L) = {A(J-1)} PRI b (L) = U { USE(t) : t in body(L)} - USE b (L) = {J, Y(J)} J X(I) A(J-1) Y(J) A(J) S

10 Abstraction of inner loops For analysis of outer loops, we need the total effects of inner loops 1. List summary sets for each iteration 2. Use aggregated set (approximation) If index I = [1:N], aggregate(A(I,J)) = A(1:N,J) After this, we can treat inner loop as single node in the flow graph

11 Privatization Algorithm 1. For each statement t in body (L), if t is a nested loop, recurse to get [DEF(t),USE(t)]. Otherwise compute local DEF(t), USE(t) 2. Scan the loop again, contruct MRD in and MRD out 3. Compute Summary set for loop body 4. Aggregate to get the privatizable set of the entire loop 5. Return [DEF, USE]

12 Privatization Algorithm 1. X(1:N) = 0 2. DO I = 1,N 3. A(1) = X(I) 4. DO J=2,N 5. Y(J) = J 6. A(J) = A(J-1)+Y(J) 7. ENDDO 8. ENDDO DEF b (L) = ∩ (MRDout(t) : t in exits (L) = {A(1:N), Y(2:N),J,I} USE b (L) = U (USE(t) – MRD in (t)) : t in body (L) = {X(I)} PRI b (L) = U { USE(t) : t in body(L)} - USE b (L) = {J, I, A(1:N), Y(2:N)} X(I) A(1) DEF = {A(2:N), Y(2:N)} USE = {A(1)}

13 Profitability Test Consider this loop: 1. DO I = 1,N 2. A(I) = … 3. … = A (I) Profitability Test: If different iterations access different A(i)  not profitable 

14 Last Value Assignment Live Analysis LVBOT(S) = U t in succ(S) LVTOP(t) LVTOP(S) = (LVBOT(S) – KILL(S)) U USE(S) Static vs Dynamic PRI b st = PRI b ∩DEF b (DEF b (L) = must defined variables for 1 iteration of Loop L)

15 Automatic vs Manual Array Privatization ProgramAutomatic and ManualManual OnlyAutomatic Only ADM2230 ARC2D020 BNDA1234 DYFESM0111 FLO52004 MDG1711 MG3D140 OCEAN430 QCD2270 SPEC7725140 TRACK2020 TRFD400

16 Thank You Questions?


Download ppt "Automatic Array Privatization Presented by: Karl Cheng Peng Tu and David Padua In Proceedings of the 6th Annual Workshop on Languages and Compilers for."

Similar presentations


Ads by Google