Title: Team 8 Data Dependence Analysis
1Team 8Data Dependence Analysis
- Shrinand Vyas
- Srikanth Mandava
- Sumana Ponnoju
- Tushar Pradhan
- Udit Patidar (L)
2Flow of the Presentation
- Need for Data Dependence
- What is Data Dependence and its types
- Methods for Data Dependence Testing
- Theoretical Background of Tests
- Limitations of Data Dependence Testing
- Examples
- Work Done
- (?) Questions and Answers
3Questions to answer
- Study dependence testing for arrays. What are the
corresponding tests for scalars? - Investigate the dependence tests inside the
Open64 compiler, how and where they are performed
and how array/scalar dependences are stored. - Determine how the distance and direction vectors
are computed and stored - Briefly identify the parts of the compiler use
the dependence testing. - Identify loops that have no dependences with
distances greater than one. - Export the required information and create an
interface in the Dragon tool to display it. - Test your work with different applications
4Importance Need ofData Dependence Analysis
- Instruction Scheduling
- Loop Nest Optimisation (LNO) (Team1)
- Loop Transformations (Team1)
- Parallelisation (Team3)
- Data Cache Optimisation
5Instruction Scheduling Example
1 r2 ? r1 (4) 2 r3 ? r14 (4) 3 r4 ? r2
r3 4 r5 ? r2 - 1 5 goto L1 6 nop
1 r2 ? r1 (4) 2 r3 ? r14 (4) 3 r5 ? r2 -
1 4 goto L1 5 r4 ? r2 r3
6Data Cache Optimization Example
- / Array is Accessed Here.. /
- ...
-
-
- for (i0ilt100i)
-
- / Array is Accessed Here.. /
-
-
-
- / Array is Accessed Here.. /
7What is Data Dependence Analysis?
- Data dependence analysis determines when two
different expressions in program will refer to
the same data element - S1 a ? b c
- S2 if (a gt 10) goto L1
- S3 d ? b e
- S4 e ? d 1
- S5 L1 d ? e / 2
Remember? Slides from 29 March.
8Types of Data Dependence
- True Dependence (t)
- Anti Dependence (a)
- Input Dependence (i)
- Output Dependence (o)
9Types of Data Dependence
- S1 a ? b c
- S2 if (a gt 10) goto L1
- S3 d ? b e
- S4 e ? d 1
- S5 L1 d ? e / 2
10Loop Based Dependencies
- Distance Vector
- Direction Vector
- eg a(i,j)
- a(i2,j-1)
- Distance Vector ? (2,-1)
- Direction Vector ? (gt,lt)
Q) Determine how the distance and direction
vector are computed and stored
11Dependence Tests
- SCALARS
- DEF-USE chains
- Data-flow analysis
- ARRAYS
- Lamports Test
- GCD Test
- Banerjees Inequalities
- Extended GCD Test
- Power Test
- I-Test
- Omega Test
- Range Test
- Delta Test
- etc
Q) Study dependence testing for arrays. What are
the corresponding tests for scalars?
12The GCD test
- Easiest test used to determine the dependence
- Given the following equation ais and c are
integers - does gcd(a1,a2,,an) divide c
- If YES an integer solution exists and we have
dependence - else we do not have dependence
13GCD Test Example
- DO i 1,10
- a(2i) b(i) c(i)
- d(i) a(2i-1)
- END DO
- We need to look at the following
- Does GCD(2,2) divide -1?
- NO ? we do not have dependence!!
14Dependence Tests
- Lamports Test
- GCD Test
- Banerjees Inequalities
- Extended GCD Test
- Power Test
- I-Test
- Omega Test
- Range Test
- Delta Test
- etc
Q) Investigate the dependence tests inside the
Open64 compiler,
15Banerjees Extended GCD Test
- GCD test extended to multi-dimensional arrays
- Reduce the dimensionality of the original GCD
test - Reduces complexity
- Still an inexact test
Maydan, Hennessy, Lam, Efficient and Exact Data
Dependence Analysis (1991)
16Extended GCD Test Example
- DO i 1,10
- a(i) b(i) c(i)
- d(i) a(i-1)
- END DO
- Consider loop bounds as well.
- Look at the following
- i1i2-1, 1 i1, i2 10
- Transform, (i1,i2)(t1,t11)
- So, we reduce to 1 t1 10
- 1 t110 10
17Dependence Tests
- Lamports Test
- GCD Test
- Banerjees Inequalities
- Extended GCD Test
- Power Test
- I-Test
- Omega Test
- Range Test
- Delta Test
- etc
18Omega Test
- Used to determine dependencies in a system of
equations - Basic idea
- Pre-process
- Pick one variable and eliminate it
- Continue until all variables but one are
eliminated
Pugh, The Omega Test a fast and practical
integer programming algorithm for dependence
analysis (1993)
19Omega Test Main Idea
20Omega Test Real Shadow
?
CheckREAL shadow
- Project the original problem onto a lower
dimension (cast its shadow) - All points inside the shadow ? Real Shadow
- No integer solution ? Original Problem has no
solution
21Omega Test Dark Shadow
?
No integersolution?
CheckREAL shadow
UNSAT
Integer solution
?
CheckDARK shadow
- An integer solution for the REAL shadowdoes not
guarantee that there is an integer solution for
the original problem - What is the dark shadow?
22Omega Test Grey Shadow
?
No integersolution?
CheckREAL shadow
UNSAT
Integer solution
?
Integersolution?
CheckDARK shadow
SAT
No Integer solution
?
CheckGREY shadow
- If the real shadow R has integer solutions,but
the dark shadow D does not, search R-D
23Example of Omega Test
- DO i1,6
- a(i1)
- a(7i-6)
- END DO
- With GCD test, we will get i17i-6
- GCD(1,-7)1, which divides -7
- Omega test is able to disprove the dependence in
this case
Psarris, Kyriakopoulos, Measuring the Accuracy
and Efficiency of Data Dependence Tests (2001)
24Limitations of Dependence Testing
- No inter-loop dependence testing yet
- Can not handle procedure calls
- Expression must be linear
- aixiajxj works
- aij doesnt work
- Non-linear algorithms exist
William Blume, Rudolf Eigenmann Non-Linear and
Symbolic Data Dependence Testing (1998)
25Inside our OpenUH compiler
- Trivial cases
- Symbolic terms
- Non-equal constants ? independent
- Else ? continue testing
- Base test
- GCD test
- Omega test for solving systems of equations
UH?CS Department?HPC Tools Group, Overview of
the Open64 Compiler Infrastructure
26(No Transcript)
27Inside our OpenUH compiler
Q) Briefly identify the parts of the compiler
used during dependence testing.
28Dragon Analysis Tool
- Displays data dependence information
- Commands required
- uhcc O2 ipa dragon for generating .d
- uhcc O3 dragon for generating .dep
29Dragon Analysis Tool Output
30Project phase
- Q) Identify loops that have no dependences
- with distances greater than one
- Loop Carried Dependencies
- function Loop_Carrying_Dependence()
- If distance gt 1 then dependence is across
iterations - Q) Export the required information and
- create an interface in the Dragon tool
- to display it
- We were able to dump the info onto the console
31Dragon Analysis Tool Output
32Concluding work
- Capture output from console into dep_graph.cxx
- Edit outfile.write directive to release/withhold
required information - Write report!!
33References
- UH CS Department UPC Tools Group, Overview of the
Open64 Compiler Infrastructure - William Blume, Rudolf Eigenmann Non-Linear and
Symbolic Data Dependence Testing (1998) - Maydan, Hennessy, Lam, Efficient and Exact Data
Dependence Analysis (1991) - Psarris, Kyriakopoulos, Measuring the Accuracy
and Efficiency of Data Dependence Tests (2001) - Pugh, The Omega Test a fast and practical
integer programming algorithm for dependence
analysis (1993)
34Acknowledgments
- Thanks to
- Oscar Hernandez
-
- Dr Chapman
- QA