in CO and Architecture retagged by
968 views
7 votes
7 votes

Consider the following code fragment:

Identify all data dependencies (potential data hazards) in the given code snippet within one loop iteration. Let the number of true data dependencies be $\mathrm{X}$, the number of anti-dependencies be $\mathrm{Y}, \&$ the number of output dependencies be $\text{Z}$.

What is $\mathrm{X}+2 \mathrm{Y}+3 \mathrm{Z}?$

in CO and Architecture retagged by
968 views

4 Comments

@Deepak Poonia Sir, In Question within brackets it is written potential data hazards, but only RAW dependencies cause hazards. Why we are counting all dependencies?

0
0

@Deepak Poonia Sir , @GO Classes sir , @GO Classes Support Sir please answer above question . I am also having same doubt.

0
0

@Archie19, @Shivani Shukla

The pipeline details are not given. Also, data dependencies depend only on the given program, not on the machine Or pipeline. Data dependencies are all potential data hazards, whether they actually cause hazard or not on a particular pipeline. WAW & WAR dependencies can cause hazards in out-of-order pipelines. 

2
2

1 Answer

2 votes
2 votes

Finding ALL Data Dependencies in the Program: Finding RAW, WAW, WAR Dependencies

Pipeline Complete Playlist: GO Classes Pipeline Complete Course

$$
\mathrm{X}=3 ; \mathrm{Y}=2 ; \mathrm{Z}=1 \text {. }
$$
True Data Dependencies (within one loop iteration):

  • $\textsf{Register R1: I1 (LD) I2 (DADDI)}$
  • $\textsf{Register R1: I2 (DADDI) I3 (SD)}$
  • $\textsf{Register R4: I5 (DADDI) I6 (BNE)}$
edited by
Answer: