Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Data Dependence in Parallel Loops: Forall, Dopar, and Dosingle Loops, Slides of Computer Science

Data dependence in parallel loops, focusing on forall, dopar, and dosingle loops. It explains how data access conflicts are resolved, the semantics of each loop type, and the concept of a program dependence graph (pdg). The document also covers data dependence analysis for arrays and building dependence systems.

Typology: Slides

2012/2013

Uploaded on 03/28/2013

ekanath
ekanath 🇮🇳

3.8

(4)

80 documents

1 / 7

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Objectives_template
file:///D|/...ary,%20Dr.%20Sanjeev%20K%20Aggrwal%20&%20Dr.%20Rajat%20Moona/Multi-core_Architecture/lecture%2033/33_1.htm[6/14/2012 12:11:50 PM]
Module 17: Loops
Lecture 33: Data Dependence in Parallel Loops
The Lecture Contains:
Data Dependence in Parallel Loops
Forall Loop
Dopar Loop
Dosingle Loop
Program Dependence Graph (PDG)
Data Dependence Analysis For Arrays
Building Dependence Systems
Loop Limit Constraints
Example:
pf3
pf4
pf5

Partial preview of the text

Download Data Dependence in Parallel Loops: Forall, Dopar, and Dosingle Loops and more Slides Computer Science in PDF only on Docsity!

Module 17: Loops

Lecture 33: Data Dependence in Parallel Loops

The Lecture Contains:

Data Dependence in Parallel Loops

Forall Loop

Dopar Loop

Dosingle Loop

Program Dependence Graph (PDG)

Data Dependence Analysis For Arrays

Building Dependence Systems

Loop Limit Constraints

Example:

Module 17: Loops

Lecture 33: Data Dependence in Parallel Loops

Data Dependence in Parallel Loops

Two statements or loops have data access conflict when they refer to the same location It is resolved by completing the first access before initiating the second one

Forall Loop

Each statement computes rhs for all index values before store forall i = 2 to 10 do x[i] = x[i-1] + x[i+1] endall If it were a sequential loop flow dependence from x[i] to x[i-1] anti dependence from x[i+1] to x[i] Semantics of forall loop Fetch all old values before writing therefore, no flow dependence Two anti dependence from S to S with distances (-1, 1)

Dopar Loop

Each iteration starts with copies of variables with the values available before the loop Value computed in one iteration can not be fetched in another iteration If there is conflict between two stores, language model does not resolve. It is likely to be a programmer error

Module 17: Loops

Lecture 33: Data Dependence in Parallel Loops

Program Dependence Graph (PDG)

Control dependence edges in data dependence graph.

S (^1) S (^2) S (^3) S (^4) S (^5) S (^6) S (^7) S (^8)

X = 1

Y = 2

if Y < T then X = 2 else Y = X endif Z = X + Y

Module 17: Loops

Lecture 33: Data Dependence in Parallel Loops

Data Dependence Analysis For Arrays

Concentrate on linear subscripts:

Linear Non-Linear

Linear & Non-Linear

[I], [I + J - 1], [10 * I - 1, J * 2]

[I * J], [I/J], [mod(I, 2) + 1] [IP[I] + 1] [2 * I - 1, I * J]

In case of non-linear subscripts Ignore the subscript Use special solvers(very little work available)

Building Dependence Systems

Form dependence equations Unknowns are loop induction variables Coefficients are compile time constants One coefficient for each loop induction variable plus a constant coefficient Generally use induction variable corresponding to normalized or semi normalized loops. indicates a definition indicates a use Express dependence equation as a matrix notation AI = C where A: Coefficient matrix; I: Vector of unknowns C: Constant vector

If there is no solution, there can be no dependence.

Module 17: Loops

Lecture 33: Data Dependence in Parallel Loops

Loop Limit Constraints

Loop limits add constraints Lower limit is zero for normalized loop Constraints are realities Dependence system can be expressed in matrix notation.

A i = C B i = b

Linear equalities Linear inequalities (+)ve coefficient for unknown (-)ve coefficient for unknown

Upper limit Lower limit

Example:

for I = 2, 100 for J = 1, I- B[I, J] = B[J, I] endfor endfor

The 2 eqns. for equality are: