Data Dependences and Hazards
An instructin j is data dependent on instruction i if either of the following holds: - Instruction i produces a result that may be used by instruction j. - Instruction j is data dependent on instructin k, and instruction k is data dependent on instruction i. (A chain of dependence)
Name Dependences
A name dependence occurs when two instructions use the same register or memory location, called a name. However, there is no flow of data between the instructions associated with that name.
There are two kinds of name dependences: 1. Antidependence: instruction j write a register or memory location that instruction i read. 2. Output dependence: instruction i and instruction j write the same register or memory location.
Data Hazards
- RAW: j tries to read a source before i write it, so j incorrectly gets the old value.
- WAW: \(j\) tries to write an operand before it is written by \(i\).
- WAW: \(j\) tries to write a destination before t is read by \(i\), i incorrectly gets the new value.
Control Dependences
What You Should Do Once You Detect Dependence in Hardware ?
Obviously, you have at least two choices: 1. Stall the dependent instruction right away. 2. Stall the dependent instruction only when necessary, i.e, data forwarding/bypassing.
Give an problem: A consumer(dependent) instruction has to wait in decode stage until the producer instruction writes its value in the register file.
Our goal: add additional