





















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Notes; Professor: Lee; Class: Adv Computer Architecure; Subject: Electrical & Computer Engr; University: Georgia Institute of Technology-Main Campus; Term: Fall 2000;
Typology: Study notes
1 / 29
This page cannot be seen from the preview
Don't miss anything!






















Reading for this Module
Predictors
3
Control Dependencies
Structural
Dependencies
Data (^) Name Control
Anti Output
I-Fetch ExecutionCore Retire
Core
Predict What?
7
Branch Misprediction
PC Next PC Fetch DriveAlloc Rename Queue Schedule Dispatch Reg File ExecFlags Br Resolve
Single Issue
Mispredict
Branch Misprediction
PC Next PC Fetch DriveAlloc Rename Queue Schedule Dispatch Reg File ExecFlags Br Resolve
Single Issue (flush entailed instructions and refetch)
Mispredict
9
Branch Misprediction
PC Next PC Fetch DriveAlloc Rename Queue Schedule Dispatch Reg File ExecFlags Br Resolve
Single Issue
Fetch the correct path
Branch Misprediction
PC Next PC Fetch DriveAlloc Rename Queue Schedule Dispatch Reg File ExecFlags Br Resolve
Single Issue
Mispredict 8-issue Superscalar Processor (Worst case)
13
Static prediction
scheduling strategies
•individual branches tend to be strongly bimodal (set a bit in the opcode)
programmers to provide hints
Profile Guided Static Prediction
Bubble Bubble Bubble
beq $1,$2,L1 Branch bit in the encoded instruction is set to 1
Target address is known here
15
Profile Guided Static Prediction
Bubble
Encoded prediction is incorrect
Branch condition is known here
Dynamic Branch Prediction Strategies
one another and their history
…
n-1 0
prediction
Last branch behavior, i.e., taken or not taken
From Ref: “Modern Processor Design: Fundamentals of Superscalar Processors, J. Shen and M. Lipasti
Shift register
How do we capture this history?
How do we predict?
19
Simplest Dynamic Branch Predictor
T
NT
T
T
NT
NT
. . .
addi r10, r0, 100 addi r1, r1, r L1: add r21, r20, r lw r2, (r21) beq r2, r0, L … … j L L2: … … … L3: addi r1, r1, 1 bne r1, r10, L
0x 0x
0x 0x4001010c 0x
0x
0x40010B0c 0x40010B
for (i=0; i<100; i++) { if (a[i] == 0) { … } … }
NT
T
1-bit Branch History Table
FSM of the Simplest Predictor
If branch not taken
If branch taken
Predict not taken
Predict taken
21
Example using 1-bit branch history table
for (i=0; i< 44 ; i++) { …. }
addi r10, r0, 4 addi r1, r1, r L1: … … addi r1, r1, 1 bne r1, r10, L
60% accuracy
2-bit Saturating Up/Down Counter Predictor
Not Taken
Taken
Predict Not taken
Predict taken
25
Capturing Global Behavior
local path through the
program
predictor is maintained
behavior history of each
local path
determines program region
size
B
B2 (^) B
B4 B
B6 B
T F
B
Branch Correlation
if (aa==2) // b aa = 0; if (bb==2) // b bb = 0; if (aa!=bb) { // b ……. }
b
b2 b
b3 b3 b
b
Path: A:1-1 B:1-0 C:0-1 D:0- aa= bb=
aa= bb≠ 2
aa≠ 2 bb=
aa≠ 2 bb≠ 2
Code Snippet
27
Correlated Branch Predictor [PanSoRahmeh’92]
hash. . . .
2-bit counter
. . . . 2-bit counter
. . . .
2-bit counter
. . . . 2-bit counter
. . . .
Subsequent branch direction
2 w
Two-Level Branch Predictor [YehPatt91,92,93]
Pattern History Table (PHT)
Prediction
Rc-k Rc-
FSM Update Logic
(Shift left when update)
PHT update Current State
31
Key Idea
sub-histories
predictor
Global History Schemes
Global BHR
Global PHT
Global BHR
..
PHTs (SPHTs)
Global BHR
..
PHTs (PPHTs)
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Set can be determined by branch opcode, compiler classification, or branch PC address.
33
GAs Two-Level Branch Prediction
(^01100110)
.
.
.
Predictor Update (Actually, Not Taken)
(^01100110)
.
.
.
(^11001100)
37
Per-Set History Schemes
Global PHT
PHTs (SPHTs)
PHTs (PPHTs)
.
.
.
Per-set BHT (SBHT)
.
.
.
Per-set BHT (SBHT)
.
.
.
Per-set BHT (SBHT)
..
.
.
.
.
.
.
.
.
.
.
.
.
..
.
.
.
.
.
.
.
.
.
PHT Indexing
39