






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
These are the Lecture Slides of Program Optimization for Multi Core Architectures which includes Triangular Lower Limits, Multiple Loop Limits, Dependence System Solvers, Single Equation, Simple Test, Extreme Value Test etc.Key important points are: Data Dependence Analysis, Interprocedural Dataflow Analysis, Alias Computation, Data Flow Analysis, Presence of Procedure Calls, Data Dependence, Data Dependence Graph
Typology: Slides
1 / 10
This page cannot be seen from the preview
Don't miss anything!
We can relate in, out and transfer as follows
Consider following control flow graph
Suppose a is an array, c is and integer, and p and q are pointer. Initially
Out
In
out
In
out
in
in
out ={(P,a),(q,a),(q,c) in
out
Change[p ] set of global variables and formal parameters of p that might be changed during an execution of p. Def[p ] set of formal parameters and global variables having explicit definition within p. A: { a | a is a global variable or formal of p, such that for some procedure q and integer i, p calls q with a as the ith actual parameter and ith formal of q is in change[q] } G: { g | g is a global in change[q] and p calls q }
Used for instruction scheduling Used for data cache optimization Determines ordering relationship; a dependence between two statements constraints their execution order Control dependence: arises from control flow
S1: a = b+c S2: if a > 10 goto L S3: d = b*e S4: e = d+ S5: L1: d = e/
Arises from flow of data between two statements Compiler must analyze programs to find constraints preventing the reordering of operations.
Consider: A = 0 B = A C = A + D D = 2
Moving (2) above (1):: Value of A in (2) changes Moving (4) above (3):: results in wrong value of D in (3)
Three types of constraints:
Flow or True Dependence: When a variable is assigned or defined in one statement and used in subsequent statement Anti Dependence: When a variable is used in one statement and reassigned in subsequently executed statement Output Dependence: When a variable is assigned in one statement and reassigned in subsequent statement
Anti dependence and Output dependence arise from reuse of variable and are also called False dependence.
Flow dependence is inherent in computation and cannot be eliminated by renaming. Therefore it is also called True dependence.
Data structure used to depict dependency between statements.
Each statement represents a node in the graph Nodes are connected by directed edges
Latency: delay required between initiation times of I 1 and I 2 minus execution time required for I (^1) before another instruction can start. For example, if two cycles must elapse between I 1 and I 2 then latency is 1. r2 ← r1 r3 ← r1+4 r4 ← r2 + r r5 ← r2 - 1
assume load has latency of 1; requires 2 cycles to finish.
Each statement executed many times Dependence can flow from one statement to any other Dependence can flow to the same statement
for i = 2, 9 do x(i) = y(i) + z(i) S (^1) a(i) = x(i-1) + 1 S (^2) endfor S 1 → S (^2)
do i = 1, N a(i) = b(i) c(i) = a(i) + b(i) e(i) = c(i+1) enddo
do I = 1, N A = B(I) C(I) = A + B(I) E(I) = C(I+1) enddo
file:///D|/...ry,%20Dr.%20Sanjeev%20K%20Aggrwal%20&%20Dr.%20Rajat%20Moona/Multi-core_Architecture/lecture%2031/31_10.htm[6/14/2012 12:10:50 PM]
do I = 1, 100 X( 2I+1 ) = .... ...... = X( 2I+4 ) enddo
Is there a dependence from S 1 to S 2? Coarse grain analysis: S 1 writes into X and S 2 reads from X. Therefore, S 1 → S 2 or S 1 S (^2) Fine grain analysis: Eqn: 2i 1 + 1 = 2i^2 + 4 has no integer solution Therefore, no dependence from S 1 to S (^2)
Fine grain analysis: Eqn. i 1 = i 2 + 50 has integer solution. However, no integer solution in the range 1 = i 1 = i 2 = 50 therefore, no dependence from S 1 to S (^2) If are general functions, then the problem is intractable. If are linear functions of loop index, then to test dependence we need to find values of two integers such that
which can be rewritten as
These are called Linear Diophantine Equations.