23 - Dependence Analysis Dependence Examples Last Time:...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Dependence Analysis Last Time: Brief introduction to interprocedural analysis Today: Optimization for parallel machines and memory hierarchies Dependence analysis Loop transformations an example - McKinley, Carr, Tseng loop transformations to improve cache performance After that: TRIPS Architecture and Compiler (scheduling) CS 380C Lecture 23 1 Dependence Analysis Dependence Examples do I = 2, 100 A(I) = A(I-1) + 1 enddo do I = 1, 100 A(I) = A(I) + 1 enddo ... ... 5 123 4 5 4 I I Can either of these loops be performed in parallel? A loop-independent dependence exists regardless of the loop structure. They do not inhibit parallelization, but they do aFect statement ordewhichr with a loop. A loop-carried dependence is induced by the iterations of a loop and prevents safe loop parallelization. CS 380C Lecture 23 2 Dependence Analysis
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Dependence Classifcation S 1 δ S 2 True (Fow) dependence occurs when S 1 writes a memory location that S 2 later reads. Anti dependence occurs when S 1 reads a memory location that S 2 later writes. Output dependence occurs when S 1 writes a memory location that S 2 later writes. Input dependence occurs when S 1 reads a memory location that S 2 later reads. (Input dependences do not restrict statement order.) CS 380C Lecture 23 3 Dependence Analysis Dependence Analysis Question Given DO i 1 = L 1 , U 1 ... DO i n = L n , U n S 1 A( f 1 ( i 1 ,..., i n ) f m ( i 1 i n ) )= S 2 =A ( g 1 ( i 1 i n ) g m ( i 1 i n ) ) A dependence between statement S 1 and S 2 ,denoted S 1 δ S 2 ,ind icatesthat S 1 ,the source , must be executed before S 2 sink on some iteration of the nest. Let α & β be a vector of n integers within the ranges of the lower and upper bounds of the n loops. Does α β , s.t. f k ( α g k ( β ) k , 1 k m ? CS 380C Lecture 23 4 Dependence Analysis
Background image of page 2
Iteration Space do I = 1, 5 do J = I, 6 ... enddo enddo 1 I 5 I J 6 J I Lexicographical (sequential) order (1,1), (1,2), ,(1 ,6) (2,1), (2,2), (2,6) (5,1), (5,2), (5,6) Given I =( i 1 ,... i n ) and I ± i ± 1 ,..., i ± n ) , I < I ± if ( i 1 , i 2 i k )=( i ± 1 , i ± 2 i ± k ) & i k + 1 < i ± k + 1 CS 380C Lecture 23 5 Dependence Analysis Distance & Direction Vectors do I = 1, N do J = 1, N S 1 A(I,J) = A(I,J-1) + 1 enddo enddo do I = 1, N do J = 1, N S 2 A(I,J) = A(I-1,J-1) + 1 S 3 B(I,J) = B(I-1,J+1) + 1 enddo enddo I J I J Distance Vector:
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 10

23 - Dependence Analysis Dependence Examples Last Time:...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online