Hazards Flashcards
1
Q
Types of hazards
A
- Structural
1. ̥Due to structture of pipeline
2. h/w can’t support combo of instr in pipeline needing same resources - Data
1. ̥due to data dependencies b/w instr
2. instr depends on the result of prior instr still in pipeline - Control
1. ̥due to control instr
2. pipelining of brances & other instr taht change the PC
2
Q
What are stalls ?
A
- inserting one or more “bubbles” in the pipeline until the hazard is resolved
- To do this, hardware or software must detect that a hazard has occurred
- Disadv
1. ̥is a waste cycle
2. adds to pipeline delay and increases CPI
3. affetcs performance of pipeline architecture
3
Q
what is structural hazard ?
A
- resource conflict arises due to a hardware resource being required by more than one instruction in a single cycle̥
- when a pipelined machine has a shared single-memory for data and instructions.(IF = MEM)
- when a machine has only one register file write port(Skip MEM stage for add/sub..)
- when a machine has overlapping of read and write(Overlap ID & WB)
4
Q
IF = MEM = Unified Mem operation
A
sol 1 : stall
Sol 2 :Replication of resources
–Split Memory (Instruction Memory & Data Memory)
–Harvard Memory Architecture
5
Q
WB Vs WB:
AND instr has no mem
so WB -WB conflict
A
Sol 1 : stall
Sol 2 : °Let all the instruction follow all stages, AND may take longer than usual
6
Q
ID VS WB
A
Partitioning/Overlapping
1st half of the cycle Reg Write
2nd half of the same cycle Reg Read
7
Q
What are the types of data dependencies?
A
- ̥RAW: Read after Write or Flow dependency (True Dependency)
~~~
add r1,r2,r3
sub r4,r1,r3
~~~ - WAR: Write after Read or anti-dependency (Anti Dependency)
~~~
sub r4,r1,r3
add** r1**,r2,r3
mul r6,r1,r7
~~~
sol : rename register - WAW: Write after Write (Output Dependency)
~~~
sub** r1,r4,r3
add r1**,r2,r3
mul r6,r1,r7
~~~
sol: rename register
.
7
Q
How to solve RAW ?
A
- ̥S/W - reorder instr
- s/w- insert independent instr or no-ops
- h/w- insert bubbles
- h/w- data forwarding
8
Q
Explain Data forwarding
A
incomplete
9
Q
Problems with 1-bit predictor
A
- Aliasing Problem
branches with same lower order bits will reference the same entry,causing mutual prediction - Shortcomings with loops
Always mispredict twice for every loop
Mispredict upon exiting a loop, since this is a surprise
If we repeat the loop, we’ll miss again since we’ll predict, branch not taken