You are on page 1of 2

Three major dependence types: – Data (True) dependence: RAW – Name dependence: WAR,

WAW – Control dependence: branch, jump, etc. • A dependency (or dependence) is a particular
instance of one instruction depending on another. – The instructions can’t be effectively (as
opposed to just syntactically) fully parallelized, or reordered.

Background image of page 6

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

View Full Document Right Arrow Icon

7 Data Dependence • Recursive definition: – Instruction B is data dependent on instruction A iff:


• B uses a data result produced by instruction A , or • There is another instruction C such that B
is data dependent on C , and C is data dependent on A . • Potential for a RAW hazard • Loop: LD
F0,0(R1) ADDD F4,F0,F2 SD 0(R1),F4 SUBI R1,R1,#8 BNEZ R1,Loop B A B A C Data dependencies
in loop example

Background image of page 7

8 Name Dependence • Occurs when two instructions both access the same data storage location
due to reuse the storage (Also called storage dependence, at least one of the accesses must be a
write.) • Two sub-types (for inst. B after inst. A): – Antidependence: A reads, then B writes. •
Potential for a WAR hazard. – Output dependence: A writes, then B writes. • Potential for a
WAW hazard. • Note: Name dependencies can be avoided by changing instructions to use
different locations (rather than reusing a location), called renaming

Background image of page 8

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

View Full Document Right Arrow Icon

9 WAR, WAW Examples • WAR Hazard: Instr J writes operand before Instr I reads it • WAW
Hazard: Instr J writes operand before Instr I writes it. I: sub r4, r1 ,r3 J: add r1 ,r2,r3 K: mul
r6,r1,r7 I: sub r1 ,r4,r3 J: add r1 ,r2,r3 K: mul r6,r1,r7

Background image of page 9

10 Control Dependence • Occurs when the execution of an instruction depends on a conditional


branch instruction. • Program control flow must follow for correct executions. • However, only
two things must really be preserved: – Data flow (how a given result is produced) – Exception
behavior (must handle in order) • Example: (for Exception Behavior ) DADDU R2, R3, R4 BEQZ R2,
L1 LW R1, 0(R2) ; may not before BEQZ L1: ; ; use of R1 (delay branch?)

Background image of page 10

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document Right Arrow Icon

11 Control Dependence – Another Example • Example: (for data flow ) DADDU R2, R3, R4 BEQZ
R5, L1 DSUBU R2, R6, R7 L1: OR R8, R2, R9 • OR depends DADDU and DSUBU. Maintaining data
dependences is not enough • Control flow decides where the correct R2 comes from (DADDU or
DSUBU)

You might also like