SlideShare une entreprise Scribd logo
1  sur  17
Lecture 9: Branch Prediction
Basic idea, saturating counter, BHT,
BTB, return address prediction,
correlating prediction

1
Reducing Branch Penalty
Branch penalty in dynamically scheduled processors:
wasted cycles due to pipeline flushing on mispredicted branches
Reduce branch penalty:

1. Predict branch/jump instructions AND branch
direction (taken or not taken)

2. Predict branch/jump target address (for taken
branches)

3. Speculatively execute instructions along the
predicted path

2
What to Use and What to Predict
Available info:



Current predicted PC
Past branch history
(direction and target)

pred_PC

PC

What to predict:






Conditional branch inst:
branch direction and
target address
Jump inst: target
address
Procedure call/return:
target address

May need instruction predecoded

Predictors

IM

PC & Inst

pred info feedback P

C

3
Mis-prediction Detections and Feedbacks
Detections:
At the end of decoding




Target address known at
decoding, and not match
Flush fetch stage

At commit (most cases)




Wrong branch direction or
target address not match
Flush the whole pipeline

(at EXE: MIPS R10000)

Feedbacks:
Any time a mis-prediction is
detected
At a branch’s commit
(at EXE: called speculative update)

FETCH

predictors

RENAME
REB/ROB
SCHD
EXE
WB
COMMIT
4
Branch Direction Prediction
Predict branch direction: taken or not taken
(T/NT)
taken
Not taken

BNE R1, R2, L1
…
L1: …

Static prediction: compilers decide the direction
Dynamic prediction: hardware decides the
direction using dynamic information
1.
2.
3.
4.
5.

1-bit Branch-Prediction Buffer
2-bit Branch-Prediction Buffer
Correlating Branch Prediction Buffer
Tournament Branch Predictor
and more …

5
Predictor for a Single Branch
General Form
1. Access

2. Predict
Output T/NT

state

PC

3. Feedback T/NT

1-bit prediction

Feedback

T
Predict Taken

NT

1

NT
T

0

Predict Taken

6
Branch History Table of 1-bit Predictor
BHT also Called Branch
Prediction Buffer in
textbook
Can use only one 1-bit
predictor, but accuracy is
low
BHT: use a table of simple
predictors, indexed by bits
from PC
Similar to direct mapped
cache
More entries, more cost,
but less conflicts, higher
accuracy
BHT can contain complex
predictors

K-bit

Branch
address

2k
Prediction
Prediction

7
1-bit BHT Weakness
Example: in a loop, 1-bit BHT will cause
2 mispredictions
Consider a loop of 9 iterations before exit:
for (…){
for (i=0; i<9; i++)
a[i] = a[i] * 2.0;
}
 End of loop case, when it exits instead of looping
as before
 First time through loop on next time through
code, when it predicts exit instead of looping
 Only 80% accuracy even if loop 90% of the time

8
2-bit Saturating Counter
Solution: 2-bit scheme where change prediction only if
get misprediction twice: (Figure 3.7, p. 249)
T
Predict Taken

11

NT
T
T

Predict Not
Taken

01

10

Predict Taken

NT
NT
T

00

Predict Not
Taken

NT

Blue: stop, not taken
Gray: go, taken
Adds hysteresis to decision making process
9
Branch Target Buffer
Branch Target Buffer (BTB): Address of branch index to
get prediction AND branch address (if taken)


Note: must check for branch match now, since can’t use wrong
branch address

Example: BTB combined with BHT
Branch PC

Predicted PC

PC of instruction
FETCH
=?
No: branch not
predicted, proceed normally
(Next PC = PC+4)

Extra
Yes: instruction is prediction state
branch and use
bits
predicted PC as
next PC
10
Return Addresses Prediction
Register indirect branch hard to predict
address



Many callers, one callee
Jump to multiple return addresses from a single
address (no PC-target correlation)

SPEC89 85% such branches for procedure
return
Since stack discipline for procedures, save
return address in small buffer that acts like
a stack: 8 to 16 entries has small miss rate
11
Correlating Branches
Code example showing
the potential

Assemble code

If (d==0)
d=1;
If (d==1)
…

BNEZ R1, L1
DADDIU R1,R0,#1
L1: DADDIU R3,R1,#-1
BNEZ R3, L2
L2:
…

Observation: if BNEZ1 is not taken, then BNEZ2
is taken
12
Correlating Branch Predictor
Idea: taken/not taken of
recently executed
branches is related to
behavior of next branch
(as well as the history of
that branch behavior)
 Then behavior of
recent branches
selects between, say, 2
predictions of next
branch, updating just
that prediction
 (1,1) predictor: 1-bit
global, 1-bit local

Branch address (4 bits)
1-bits per branch
local predictors

Prediction
Prediction

1-bit global
branch history
(0 = not taken)
13
Correlating Branch Predictor
General form: (m, n)
predictor
 m bits for global
history, n bits for local
history
 Records correlation
between m+1 branches
 Simple implementation:
global history can be
store in a shift
register
 Example: (2,2)
predictor, 2-bit global,
2-bit local

Branch address (4 bits)
2-bits per branch
local predictors

Prediction
Prediction

2-bit global
branch history
(01 = not taken then taken)
14
Accuracy of Different Schemes
(Figure 3.15, p. 206)
Frequencyofof Mispredictions
Frequency
Mispredictions

20%

4096 Entries 2-bit BHT
Unlimited Entries 2-bit BHT
1024 Entries (2,2) BHT

18%
16%
14%
12%

11%

10%
8%
6%

6%

6%

6%

5%

5%
4%

4%
2%

1%

1%
0%

0%
nasa7

matrix300

tomcatv

doducd

4,096 entries: 2-bits per entry

spice

fpppp

gcc

Unlimited entries: 2-bits/entry

espresso

eqntott

1,024 entries (2,2)

15

li
Estimate Branch Penalty
EX: BHT correct rate
is 95%, BTB hit rate
is 95%
Average miss penalty
is 15 cycles
How much is the
branch penalty?
16
Accuracy of Return Address Predictor

17

Contenu connexe

Tendances

Microcontroladores: introducción a la programación en lenguaje ensamblador AVR
Microcontroladores: introducción a la programación en lenguaje ensamblador AVRMicrocontroladores: introducción a la programación en lenguaje ensamblador AVR
Microcontroladores: introducción a la programación en lenguaje ensamblador AVRSANTIAGO PABLO ALBERTO
 
VTU 4TH SEM CSE MICROPROCESSORS SOLVED PAPERS OF JUNE-2014 & JUNE-2015
VTU 4TH SEM CSE MICROPROCESSORS SOLVED PAPERS OF JUNE-2014 & JUNE-2015VTU 4TH SEM CSE MICROPROCESSORS SOLVED PAPERS OF JUNE-2014 & JUNE-2015
VTU 4TH SEM CSE MICROPROCESSORS SOLVED PAPERS OF JUNE-2014 & JUNE-2015vtunotesbysree
 
Data flow architecture
Data flow architectureData flow architecture
Data flow architectureSourav Routh
 
Flag registers, addressing modes, instruction set
Flag registers, addressing modes, instruction setFlag registers, addressing modes, instruction set
Flag registers, addressing modes, instruction setaviban
 
Data link control & protocol concepts
Data link control & protocol conceptsData link control & protocol concepts
Data link control & protocol conceptsRaji Lakshmi
 
Data Link Control Protocols
Data Link Control ProtocolsData Link Control Protocols
Data Link Control ProtocolsTechiNerd
 
Microprocessorandmicroconrollermcq3 121116120640-phpapp02
Microprocessorandmicroconrollermcq3 121116120640-phpapp02Microprocessorandmicroconrollermcq3 121116120640-phpapp02
Microprocessorandmicroconrollermcq3 121116120640-phpapp02Yazeed Khalid
 
Microcontroller 8051 1
Microcontroller 8051  1Microcontroller 8051  1
Microcontroller 8051 1khan yaseen
 
PAI Unit 3 Multitasking in 80386
PAI Unit 3 Multitasking in 80386PAI Unit 3 Multitasking in 80386
PAI Unit 3 Multitasking in 80386KanchanPatil34
 
Flag registers (assembly language) with types and examples
Flag registers (assembly language) with types and examplesFlag registers (assembly language) with types and examples
Flag registers (assembly language) with types and examplesComputer_ at_home
 
Computer arithmetic in computer architecture
Computer arithmetic in computer architectureComputer arithmetic in computer architecture
Computer arithmetic in computer architectureishapadhy
 

Tendances (20)

Microcontroladores: introducción a la programación en lenguaje ensamblador AVR
Microcontroladores: introducción a la programación en lenguaje ensamblador AVRMicrocontroladores: introducción a la programación en lenguaje ensamblador AVR
Microcontroladores: introducción a la programación en lenguaje ensamblador AVR
 
VTU 4TH SEM CSE MICROPROCESSORS SOLVED PAPERS OF JUNE-2014 & JUNE-2015
VTU 4TH SEM CSE MICROPROCESSORS SOLVED PAPERS OF JUNE-2014 & JUNE-2015VTU 4TH SEM CSE MICROPROCESSORS SOLVED PAPERS OF JUNE-2014 & JUNE-2015
VTU 4TH SEM CSE MICROPROCESSORS SOLVED PAPERS OF JUNE-2014 & JUNE-2015
 
Arm11
Arm11Arm11
Arm11
 
Data flow architecture
Data flow architectureData flow architecture
Data flow architecture
 
Intel Hex Format
Intel Hex FormatIntel Hex Format
Intel Hex Format
 
Intel IA 64
Intel IA 64Intel IA 64
Intel IA 64
 
Flag registers, addressing modes, instruction set
Flag registers, addressing modes, instruction setFlag registers, addressing modes, instruction set
Flag registers, addressing modes, instruction set
 
Computer System Architecture
Computer System ArchitectureComputer System Architecture
Computer System Architecture
 
Data link control & protocol concepts
Data link control & protocol conceptsData link control & protocol concepts
Data link control & protocol concepts
 
viva q&a for mp lab
viva q&a for mp labviva q&a for mp lab
viva q&a for mp lab
 
Sayeh extension(v23)
Sayeh extension(v23)Sayeh extension(v23)
Sayeh extension(v23)
 
Unit 5
Unit 5Unit 5
Unit 5
 
Data Link Control Protocols
Data Link Control ProtocolsData Link Control Protocols
Data Link Control Protocols
 
Microprocessorandmicroconrollermcq3 121116120640-phpapp02
Microprocessorandmicroconrollermcq3 121116120640-phpapp02Microprocessorandmicroconrollermcq3 121116120640-phpapp02
Microprocessorandmicroconrollermcq3 121116120640-phpapp02
 
Microcontroller 8051 1
Microcontroller 8051  1Microcontroller 8051  1
Microcontroller 8051 1
 
PAI Unit 3 Multitasking in 80386
PAI Unit 3 Multitasking in 80386PAI Unit 3 Multitasking in 80386
PAI Unit 3 Multitasking in 80386
 
register
registerregister
register
 
Delay routine
Delay routineDelay routine
Delay routine
 
Flag registers (assembly language) with types and examples
Flag registers (assembly language) with types and examplesFlag registers (assembly language) with types and examples
Flag registers (assembly language) with types and examples
 
Computer arithmetic in computer architecture
Computer arithmetic in computer architectureComputer arithmetic in computer architecture
Computer arithmetic in computer architecture
 

En vedette

Comp architecture : branch prediction
Comp architecture : branch predictionComp architecture : branch prediction
Comp architecture : branch predictionrinnocente
 
Instruction Level Parallelism (ILP) Limitations
Instruction Level Parallelism (ILP) LimitationsInstruction Level Parallelism (ILP) Limitations
Instruction Level Parallelism (ILP) LimitationsJose Pinilla
 
Intel CPU Manufacturing Process
Intel CPU Manufacturing ProcessIntel CPU Manufacturing Process
Intel CPU Manufacturing ProcessA B Shinde
 
Pipelining and ILP (Instruction Level Parallelism)
Pipelining and ILP (Instruction Level Parallelism) Pipelining and ILP (Instruction Level Parallelism)
Pipelining and ILP (Instruction Level Parallelism) A B Shinde
 
Lec12 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- P6, Netbur...
Lec12 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- P6, Netbur...Lec12 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- P6, Netbur...
Lec12 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- P6, Netbur...Hsien-Hsin Sean Lee, Ph.D.
 
Study: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving CarsStudy: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving CarsLinkedIn
 
Hype vs. Reality: The AI Explainer
Hype vs. Reality: The AI ExplainerHype vs. Reality: The AI Explainer
Hype vs. Reality: The AI ExplainerLuminary Labs
 

En vedette (7)

Comp architecture : branch prediction
Comp architecture : branch predictionComp architecture : branch prediction
Comp architecture : branch prediction
 
Instruction Level Parallelism (ILP) Limitations
Instruction Level Parallelism (ILP) LimitationsInstruction Level Parallelism (ILP) Limitations
Instruction Level Parallelism (ILP) Limitations
 
Intel CPU Manufacturing Process
Intel CPU Manufacturing ProcessIntel CPU Manufacturing Process
Intel CPU Manufacturing Process
 
Pipelining and ILP (Instruction Level Parallelism)
Pipelining and ILP (Instruction Level Parallelism) Pipelining and ILP (Instruction Level Parallelism)
Pipelining and ILP (Instruction Level Parallelism)
 
Lec12 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- P6, Netbur...
Lec12 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- P6, Netbur...Lec12 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- P6, Netbur...
Lec12 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- P6, Netbur...
 
Study: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving CarsStudy: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving Cars
 
Hype vs. Reality: The AI Explainer
Hype vs. Reality: The AI ExplainerHype vs. Reality: The AI Explainer
Hype vs. Reality: The AI Explainer
 

Similaire à Like 2014214

Lec5 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Branch Pred...
Lec5 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Branch Pred...Lec5 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Branch Pred...
Lec5 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Branch Pred...Hsien-Hsin Sean Lee, Ph.D.
 
Computer network (16)
Computer network (16)Computer network (16)
Computer network (16)NYversity
 
24 15055 current steering ijeecs 1570310518(edit)
24 15055 current steering ijeecs  1570310518(edit)24 15055 current steering ijeecs  1570310518(edit)
24 15055 current steering ijeecs 1570310518(edit)nooriasukmaningtyas
 
FPGA configuration of an alloyed correlated branch predictor used with RISC p...
FPGA configuration of an alloyed correlated branch predictor used with RISC p...FPGA configuration of an alloyed correlated branch predictor used with RISC p...
FPGA configuration of an alloyed correlated branch predictor used with RISC p...IJECEIAES
 
Chapter 1 Digital Systems and Binary Numbers.ppt
Chapter 1 Digital Systems and Binary Numbers.pptChapter 1 Digital Systems and Binary Numbers.ppt
Chapter 1 Digital Systems and Binary Numbers.pptAparnaDas827261
 
Control hazards MIPS pipeline.pptx
Control hazards MIPS pipeline.pptxControl hazards MIPS pipeline.pptx
Control hazards MIPS pipeline.pptxIrfan Anjum
 
SOC-CH3.pptSOC ProcessorsSOC Processors Used in SOC Used in SOC
SOC-CH3.pptSOC ProcessorsSOC Processors Used in SOC Used in SOCSOC-CH3.pptSOC ProcessorsSOC Processors Used in SOC Used in SOC
SOC-CH3.pptSOC ProcessorsSOC Processors Used in SOC Used in SOCSnehaLatha68
 
Subroutine in 8051 microcontroller
Subroutine in 8051 microcontrollerSubroutine in 8051 microcontroller
Subroutine in 8051 microcontrollerbhadresh savani
 
16-bit microprocessors
16-bit microprocessors16-bit microprocessors
16-bit microprocessorsZahra Sadeghi
 
Software-defined IoT: 6TiSCH Centralized Scheduling and Multipath Construction
Software-defined IoT: 6TiSCH Centralized Scheduling and Multipath ConstructionSoftware-defined IoT: 6TiSCH Centralized Scheduling and Multipath Construction
Software-defined IoT: 6TiSCH Centralized Scheduling and Multipath ConstructionHao Jiang
 
Ars msr 1-intradomain
Ars msr 1-intradomainArs msr 1-intradomain
Ars msr 1-intradomainNarcisIlie1
 
2007 Tidc India Profiling
2007 Tidc India Profiling2007 Tidc India Profiling
2007 Tidc India Profilingdanrinkes
 
Image Representation & Descriptors
Image Representation & DescriptorsImage Representation & Descriptors
Image Representation & DescriptorsPundrikPatel
 
Leopard: Lightweight Partitioning and Replication for Dynamic Graphs
Leopard: Lightweight Partitioning and Replication  for Dynamic Graphs Leopard: Lightweight Partitioning and Replication  for Dynamic Graphs
Leopard: Lightweight Partitioning and Replication for Dynamic Graphs Daniel Abadi
 
Mcs 012 computer organisation and assemly language programming- ignou assignm...
Mcs 012 computer organisation and assemly language programming- ignou assignm...Mcs 012 computer organisation and assemly language programming- ignou assignm...
Mcs 012 computer organisation and assemly language programming- ignou assignm...Dr. Loganathan R
 

Similaire à Like 2014214 (20)

Lec5 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Branch Pred...
Lec5 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Branch Pred...Lec5 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Branch Pred...
Lec5 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Branch Pred...
 
Computer network (16)
Computer network (16)Computer network (16)
Computer network (16)
 
24 15055 current steering ijeecs 1570310518(edit)
24 15055 current steering ijeecs  1570310518(edit)24 15055 current steering ijeecs  1570310518(edit)
24 15055 current steering ijeecs 1570310518(edit)
 
FPGA configuration of an alloyed correlated branch predictor used with RISC p...
FPGA configuration of an alloyed correlated branch predictor used with RISC p...FPGA configuration of an alloyed correlated branch predictor used with RISC p...
FPGA configuration of an alloyed correlated branch predictor used with RISC p...
 
Chapter 1 Digital Systems and Binary Numbers.ppt
Chapter 1 Digital Systems and Binary Numbers.pptChapter 1 Digital Systems and Binary Numbers.ppt
Chapter 1 Digital Systems and Binary Numbers.ppt
 
Mini Project- Dual Processor Computation
Mini Project- Dual Processor ComputationMini Project- Dual Processor Computation
Mini Project- Dual Processor Computation
 
Switch Control and Time Delay - Keypad
Switch Control and Time Delay - KeypadSwitch Control and Time Delay - Keypad
Switch Control and Time Delay - Keypad
 
Control hazards MIPS pipeline.pptx
Control hazards MIPS pipeline.pptxControl hazards MIPS pipeline.pptx
Control hazards MIPS pipeline.pptx
 
SOC-CH3.pptSOC ProcessorsSOC Processors Used in SOC Used in SOC
SOC-CH3.pptSOC ProcessorsSOC Processors Used in SOC Used in SOCSOC-CH3.pptSOC ProcessorsSOC Processors Used in SOC Used in SOC
SOC-CH3.pptSOC ProcessorsSOC Processors Used in SOC Used in SOC
 
Subroutine in 8051 microcontroller
Subroutine in 8051 microcontrollerSubroutine in 8051 microcontroller
Subroutine in 8051 microcontroller
 
Cs8591 Computer Networks
Cs8591 Computer NetworksCs8591 Computer Networks
Cs8591 Computer Networks
 
Final report
Final reportFinal report
Final report
 
16-bit microprocessors
16-bit microprocessors16-bit microprocessors
16-bit microprocessors
 
Software-defined IoT: 6TiSCH Centralized Scheduling and Multipath Construction
Software-defined IoT: 6TiSCH Centralized Scheduling and Multipath ConstructionSoftware-defined IoT: 6TiSCH Centralized Scheduling and Multipath Construction
Software-defined IoT: 6TiSCH Centralized Scheduling and Multipath Construction
 
Ars msr 1-intradomain
Ars msr 1-intradomainArs msr 1-intradomain
Ars msr 1-intradomain
 
7 eti pres
7 eti pres7 eti pres
7 eti pres
 
2007 Tidc India Profiling
2007 Tidc India Profiling2007 Tidc India Profiling
2007 Tidc India Profiling
 
Image Representation & Descriptors
Image Representation & DescriptorsImage Representation & Descriptors
Image Representation & Descriptors
 
Leopard: Lightweight Partitioning and Replication for Dynamic Graphs
Leopard: Lightweight Partitioning and Replication  for Dynamic Graphs Leopard: Lightweight Partitioning and Replication  for Dynamic Graphs
Leopard: Lightweight Partitioning and Replication for Dynamic Graphs
 
Mcs 012 computer organisation and assemly language programming- ignou assignm...
Mcs 012 computer organisation and assemly language programming- ignou assignm...Mcs 012 computer organisation and assemly language programming- ignou assignm...
Mcs 012 computer organisation and assemly language programming- ignou assignm...
 

Dernier

No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in KarachiNo.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in KarachiAmil Baba Mangal Maseeh
 
Culture Clash_Bioethical Concerns_Slideshare Version.pptx
Culture Clash_Bioethical Concerns_Slideshare Version.pptxCulture Clash_Bioethical Concerns_Slideshare Version.pptx
Culture Clash_Bioethical Concerns_Slideshare Version.pptxStephen Palm
 
Unity is Strength 2024 Peace Haggadah + Song List.pdf
Unity is Strength 2024 Peace Haggadah + Song List.pdfUnity is Strength 2024 Peace Haggadah + Song List.pdf
Unity is Strength 2024 Peace Haggadah + Song List.pdfRebeccaSealfon
 
A Costly Interruption: The Sermon On the Mount, pt. 2 - Blessed
A Costly Interruption: The Sermon On the Mount, pt. 2 - BlessedA Costly Interruption: The Sermon On the Mount, pt. 2 - Blessed
A Costly Interruption: The Sermon On the Mount, pt. 2 - BlessedVintage Church
 
Topmost Black magic specialist in Saudi Arabia Or Bangali Amil baba in UK Or...
Topmost Black magic specialist in Saudi Arabia  Or Bangali Amil baba in UK Or...Topmost Black magic specialist in Saudi Arabia  Or Bangali Amil baba in UK Or...
Topmost Black magic specialist in Saudi Arabia Or Bangali Amil baba in UK Or...baharayali
 
Topmost Kala ilam expert in UK Or Black magic specialist in UK Or Black magic...
Topmost Kala ilam expert in UK Or Black magic specialist in UK Or Black magic...Topmost Kala ilam expert in UK Or Black magic specialist in UK Or Black magic...
Topmost Kala ilam expert in UK Or Black magic specialist in UK Or Black magic...baharayali
 
Asli amil baba in Karachi Pakistan and best astrologer Black magic specialist
Asli amil baba in Karachi Pakistan and best astrologer Black magic specialistAsli amil baba in Karachi Pakistan and best astrologer Black magic specialist
Asli amil baba in Karachi Pakistan and best astrologer Black magic specialistAmil Baba Mangal Maseeh
 
The Chronological Life of Christ part 097 (Reality Check Luke 13 1-9).pptx
The Chronological Life of Christ part 097 (Reality Check Luke 13 1-9).pptxThe Chronological Life of Christ part 097 (Reality Check Luke 13 1-9).pptx
The Chronological Life of Christ part 097 (Reality Check Luke 13 1-9).pptxNetwork Bible Fellowship
 
Asli amil baba in Karachi asli amil baba in Lahore
Asli amil baba in Karachi asli amil baba in LahoreAsli amil baba in Karachi asli amil baba in Lahore
Asli amil baba in Karachi asli amil baba in Lahoreamil baba kala jadu
 
Do You Think it is a Small Matter- David’s Men.pptx
Do You Think it is a Small Matter- David’s Men.pptxDo You Think it is a Small Matter- David’s Men.pptx
Do You Think it is a Small Matter- David’s Men.pptxRick Peterson
 
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in KarachiNo.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in KarachiAmil Baba Mangal Maseeh
 
No 1 astrologer amil baba in Canada Usa astrologer in Canada
No 1 astrologer amil baba in Canada Usa astrologer in CanadaNo 1 astrologer amil baba in Canada Usa astrologer in Canada
No 1 astrologer amil baba in Canada Usa astrologer in CanadaAmil Baba Mangal Maseeh
 
Dubai Call Girls Skinny Mandy O525547819 Call Girls Dubai
Dubai Call Girls Skinny Mandy O525547819 Call Girls DubaiDubai Call Girls Skinny Mandy O525547819 Call Girls Dubai
Dubai Call Girls Skinny Mandy O525547819 Call Girls Dubaikojalkojal131
 
Seerah un nabi Muhammad Quiz Part-1.pdf
Seerah un nabi  Muhammad Quiz Part-1.pdfSeerah un nabi  Muhammad Quiz Part-1.pdf
Seerah un nabi Muhammad Quiz Part-1.pdfAnsariB1
 
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in KarachiNo.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in KarachiAmil Baba Mangal Maseeh
 
Study of the Psalms Chapter 1 verse 1 by wanderean
Study of the Psalms Chapter 1 verse 1 by wandereanStudy of the Psalms Chapter 1 verse 1 by wanderean
Study of the Psalms Chapter 1 verse 1 by wandereanmaricelcanoynuay
 

Dernier (20)

No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in KarachiNo.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
 
Culture Clash_Bioethical Concerns_Slideshare Version.pptx
Culture Clash_Bioethical Concerns_Slideshare Version.pptxCulture Clash_Bioethical Concerns_Slideshare Version.pptx
Culture Clash_Bioethical Concerns_Slideshare Version.pptx
 
Top 8 Krishna Bhajan Lyrics in English.pdf
Top 8 Krishna Bhajan Lyrics in English.pdfTop 8 Krishna Bhajan Lyrics in English.pdf
Top 8 Krishna Bhajan Lyrics in English.pdf
 
Unity is Strength 2024 Peace Haggadah + Song List.pdf
Unity is Strength 2024 Peace Haggadah + Song List.pdfUnity is Strength 2024 Peace Haggadah + Song List.pdf
Unity is Strength 2024 Peace Haggadah + Song List.pdf
 
A Costly Interruption: The Sermon On the Mount, pt. 2 - Blessed
A Costly Interruption: The Sermon On the Mount, pt. 2 - BlessedA Costly Interruption: The Sermon On the Mount, pt. 2 - Blessed
A Costly Interruption: The Sermon On the Mount, pt. 2 - Blessed
 
🔝9953056974 🔝young Delhi Escort service Vinay Nagar
🔝9953056974 🔝young Delhi Escort service Vinay Nagar🔝9953056974 🔝young Delhi Escort service Vinay Nagar
🔝9953056974 🔝young Delhi Escort service Vinay Nagar
 
Topmost Black magic specialist in Saudi Arabia Or Bangali Amil baba in UK Or...
Topmost Black magic specialist in Saudi Arabia  Or Bangali Amil baba in UK Or...Topmost Black magic specialist in Saudi Arabia  Or Bangali Amil baba in UK Or...
Topmost Black magic specialist in Saudi Arabia Or Bangali Amil baba in UK Or...
 
Topmost Kala ilam expert in UK Or Black magic specialist in UK Or Black magic...
Topmost Kala ilam expert in UK Or Black magic specialist in UK Or Black magic...Topmost Kala ilam expert in UK Or Black magic specialist in UK Or Black magic...
Topmost Kala ilam expert in UK Or Black magic specialist in UK Or Black magic...
 
Asli amil baba in Karachi Pakistan and best astrologer Black magic specialist
Asli amil baba in Karachi Pakistan and best astrologer Black magic specialistAsli amil baba in Karachi Pakistan and best astrologer Black magic specialist
Asli amil baba in Karachi Pakistan and best astrologer Black magic specialist
 
The Chronological Life of Christ part 097 (Reality Check Luke 13 1-9).pptx
The Chronological Life of Christ part 097 (Reality Check Luke 13 1-9).pptxThe Chronological Life of Christ part 097 (Reality Check Luke 13 1-9).pptx
The Chronological Life of Christ part 097 (Reality Check Luke 13 1-9).pptx
 
Asli amil baba in Karachi asli amil baba in Lahore
Asli amil baba in Karachi asli amil baba in LahoreAsli amil baba in Karachi asli amil baba in Lahore
Asli amil baba in Karachi asli amil baba in Lahore
 
Do You Think it is a Small Matter- David’s Men.pptx
Do You Think it is a Small Matter- David’s Men.pptxDo You Think it is a Small Matter- David’s Men.pptx
Do You Think it is a Small Matter- David’s Men.pptx
 
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in KarachiNo.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
 
St. Louise de Marillac: Animator of the Confraternities of Charity
St. Louise de Marillac: Animator of the Confraternities of CharitySt. Louise de Marillac: Animator of the Confraternities of Charity
St. Louise de Marillac: Animator of the Confraternities of Charity
 
No 1 astrologer amil baba in Canada Usa astrologer in Canada
No 1 astrologer amil baba in Canada Usa astrologer in CanadaNo 1 astrologer amil baba in Canada Usa astrologer in Canada
No 1 astrologer amil baba in Canada Usa astrologer in Canada
 
Dubai Call Girls Skinny Mandy O525547819 Call Girls Dubai
Dubai Call Girls Skinny Mandy O525547819 Call Girls DubaiDubai Call Girls Skinny Mandy O525547819 Call Girls Dubai
Dubai Call Girls Skinny Mandy O525547819 Call Girls Dubai
 
Seerah un nabi Muhammad Quiz Part-1.pdf
Seerah un nabi  Muhammad Quiz Part-1.pdfSeerah un nabi  Muhammad Quiz Part-1.pdf
Seerah un nabi Muhammad Quiz Part-1.pdf
 
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in KarachiNo.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
 
young Whatsapp Call Girls in Adarsh Nagar🔝 9953056974 🔝 escort service
young Whatsapp Call Girls in Adarsh Nagar🔝 9953056974 🔝 escort serviceyoung Whatsapp Call Girls in Adarsh Nagar🔝 9953056974 🔝 escort service
young Whatsapp Call Girls in Adarsh Nagar🔝 9953056974 🔝 escort service
 
Study of the Psalms Chapter 1 verse 1 by wanderean
Study of the Psalms Chapter 1 verse 1 by wandereanStudy of the Psalms Chapter 1 verse 1 by wanderean
Study of the Psalms Chapter 1 verse 1 by wanderean
 

Like 2014214

  • 1. Lecture 9: Branch Prediction Basic idea, saturating counter, BHT, BTB, return address prediction, correlating prediction 1
  • 2. Reducing Branch Penalty Branch penalty in dynamically scheduled processors: wasted cycles due to pipeline flushing on mispredicted branches Reduce branch penalty: 1. Predict branch/jump instructions AND branch direction (taken or not taken) 2. Predict branch/jump target address (for taken branches) 3. Speculatively execute instructions along the predicted path 2
  • 3. What to Use and What to Predict Available info:   Current predicted PC Past branch history (direction and target) pred_PC PC What to predict:    Conditional branch inst: branch direction and target address Jump inst: target address Procedure call/return: target address May need instruction predecoded Predictors IM PC & Inst pred info feedback P C 3
  • 4. Mis-prediction Detections and Feedbacks Detections: At the end of decoding   Target address known at decoding, and not match Flush fetch stage At commit (most cases)   Wrong branch direction or target address not match Flush the whole pipeline (at EXE: MIPS R10000) Feedbacks: Any time a mis-prediction is detected At a branch’s commit (at EXE: called speculative update) FETCH predictors RENAME REB/ROB SCHD EXE WB COMMIT 4
  • 5. Branch Direction Prediction Predict branch direction: taken or not taken (T/NT) taken Not taken BNE R1, R2, L1 … L1: … Static prediction: compilers decide the direction Dynamic prediction: hardware decides the direction using dynamic information 1. 2. 3. 4. 5. 1-bit Branch-Prediction Buffer 2-bit Branch-Prediction Buffer Correlating Branch Prediction Buffer Tournament Branch Predictor and more … 5
  • 6. Predictor for a Single Branch General Form 1. Access 2. Predict Output T/NT state PC 3. Feedback T/NT 1-bit prediction Feedback T Predict Taken NT 1 NT T 0 Predict Taken 6
  • 7. Branch History Table of 1-bit Predictor BHT also Called Branch Prediction Buffer in textbook Can use only one 1-bit predictor, but accuracy is low BHT: use a table of simple predictors, indexed by bits from PC Similar to direct mapped cache More entries, more cost, but less conflicts, higher accuracy BHT can contain complex predictors K-bit Branch address 2k Prediction Prediction 7
  • 8. 1-bit BHT Weakness Example: in a loop, 1-bit BHT will cause 2 mispredictions Consider a loop of 9 iterations before exit: for (…){ for (i=0; i<9; i++) a[i] = a[i] * 2.0; }  End of loop case, when it exits instead of looping as before  First time through loop on next time through code, when it predicts exit instead of looping  Only 80% accuracy even if loop 90% of the time 8
  • 9. 2-bit Saturating Counter Solution: 2-bit scheme where change prediction only if get misprediction twice: (Figure 3.7, p. 249) T Predict Taken 11 NT T T Predict Not Taken 01 10 Predict Taken NT NT T 00 Predict Not Taken NT Blue: stop, not taken Gray: go, taken Adds hysteresis to decision making process 9
  • 10. Branch Target Buffer Branch Target Buffer (BTB): Address of branch index to get prediction AND branch address (if taken)  Note: must check for branch match now, since can’t use wrong branch address Example: BTB combined with BHT Branch PC Predicted PC PC of instruction FETCH =? No: branch not predicted, proceed normally (Next PC = PC+4) Extra Yes: instruction is prediction state branch and use bits predicted PC as next PC 10
  • 11. Return Addresses Prediction Register indirect branch hard to predict address   Many callers, one callee Jump to multiple return addresses from a single address (no PC-target correlation) SPEC89 85% such branches for procedure return Since stack discipline for procedures, save return address in small buffer that acts like a stack: 8 to 16 entries has small miss rate 11
  • 12. Correlating Branches Code example showing the potential Assemble code If (d==0) d=1; If (d==1) … BNEZ R1, L1 DADDIU R1,R0,#1 L1: DADDIU R3,R1,#-1 BNEZ R3, L2 L2: … Observation: if BNEZ1 is not taken, then BNEZ2 is taken 12
  • 13. Correlating Branch Predictor Idea: taken/not taken of recently executed branches is related to behavior of next branch (as well as the history of that branch behavior)  Then behavior of recent branches selects between, say, 2 predictions of next branch, updating just that prediction  (1,1) predictor: 1-bit global, 1-bit local Branch address (4 bits) 1-bits per branch local predictors Prediction Prediction 1-bit global branch history (0 = not taken) 13
  • 14. Correlating Branch Predictor General form: (m, n) predictor  m bits for global history, n bits for local history  Records correlation between m+1 branches  Simple implementation: global history can be store in a shift register  Example: (2,2) predictor, 2-bit global, 2-bit local Branch address (4 bits) 2-bits per branch local predictors Prediction Prediction 2-bit global branch history (01 = not taken then taken) 14
  • 15. Accuracy of Different Schemes (Figure 3.15, p. 206) Frequencyofof Mispredictions Frequency Mispredictions 20% 4096 Entries 2-bit BHT Unlimited Entries 2-bit BHT 1024 Entries (2,2) BHT 18% 16% 14% 12% 11% 10% 8% 6% 6% 6% 6% 5% 5% 4% 4% 2% 1% 1% 0% 0% nasa7 matrix300 tomcatv doducd 4,096 entries: 2-bits per entry spice fpppp gcc Unlimited entries: 2-bits/entry espresso eqntott 1,024 entries (2,2) 15 li
  • 16. Estimate Branch Penalty EX: BHT correct rate is 95%, BTB hit rate is 95% Average miss penalty is 15 cycles How much is the branch penalty? 16
  • 17. Accuracy of Return Address Predictor 17

Notes de l'éditeur

  1. This lecture will cover sections 1.1-1.4: introduction, application, technology trends, cost and price.
  2. &lt;number&gt;