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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

what is structural hazard ?

A
  1. resource conflict arises due to a hardware resource being required by more than one instruction in a single cycle̥
  2. when a pipelined machine has a shared single-memory for data and instructions.(IF = MEM)
  3. when a machine has only one register file write port(Skip MEM stage for add/sub..)
  4. when a machine has overlapping of read and write(Overlap ID & WB)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

ID VS WB

A

Partitioning/Overlapping
1st half of the cycle Reg Write
2nd half of the same cycle Reg Read

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are the types of data dependencies?

A
  1. ̥RAW: Read after Write or Flow dependency (True Dependency)
    ~~~
    add r1,r2,r3
    sub r4,r1,r3
    ~~~
  2. WAR: Write after Read or anti-dependency (Anti Dependency)
    ~~~
    sub r4,r1,r3
    add** r1**,r2,r3
    mul r6,r1,r7
    ~~~
    sol : rename register
  3. WAW: Write after Write (Output Dependency)
    ~~~
    sub** r1,r4,r3
    add
    r1**,r2,r3
    mul r6,r1,r7
    ~~~
    sol: rename register
    .
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How to solve RAW ?

A
  1. ̥S/W - reorder instr
  2. s/w- insert independent instr or no-ops
  3. h/w- insert bubbles
  4. h/w- data forwarding
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Explain Data forwarding

A

incomplete

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly