SlideShare a Scribd company logo
Pipelining
www.sarithdivakar.info
Objectives
• Basics of pipelining and how it can lead to improved performance.
• Hazards that cause performance degradation and techniques to
alleviate their effect on performance
• Role of optimizing compilers, which rearrange the sequence of
instructions to maximize the benefits of pipelined execution
• Replicating hardware units in a superscalar processor so that multiple
pipelines can operate concurrently.
Basic Concepts
• Pipelining overlaps the execution of successive instructions to achieve
high performance
• The speed of execution of programs is improved by
• using faster circuit technology
• arranging the hardware so that more than one operation can be performed at
the same time
• The number of operations performed per second is increased, even
though the time needed to perform any one operation is not changed
• Pipelining is a particularly effective way of organizing concurrent
activity in a computer system.
Pipelined Execution
Pipeline Organization
Pipelining Issues
• Any condition that causes the pipeline to stall is called a hazard
• Data hazard: Value of a source operand of an instruction is not
available when needed
• Other hazards arise from memory delays, branch instructions, and
resource limitations
Writing to Register file
Operation using the old
value of the register
Data Dependencies
• Add R2, R3, #100
• Subtract R9, R2, #30
• The Subtract instruction is stalled for three cycles to delay reading
register R2 until cycle 6 when the new value becomes available.
Operand Forwarding
• Pipeline stalls due to data dependencies can be alleviated through the
use of operand forwarding
Handling Data Dependencies in Software
Add R2, R3, #100
NOP
NOP
NOP
Subtract R9, R2, #30
• Code size increases
• Execution time not reduced
The compiler can attempt to optimize the code to improve performance and reduce the code size by
reordering instructions to move useful instructions into the NOP slots
Memory Delays
• Load instruction may require more than one clock cycle to obtain its
operand from memory.
• Load R2, (R3)
• Subtract R9, R2, #30
Operand forwarding
• Operand forwarding cannot be done because the data read from
memory (the cache, in this case) are not available until they are
loaded into register RY at the beginning of cycle 5
The memory operand, which is now in register RY, can be forwarded to the ALU input in cycle 5.
Branch Delays
• Branch instructions can alter the sequence of execution, but they
must first be executed to determine whether and where to branch.
• Branch instructions occur frequently. In fact, they represent about 20
percent of the dynamic instruction count of most programs.
• Reducing the branch penalty requires the branch target address to be
computed earlier in the pipeline
With a two-cycle branch penalty, the relatively high frequency of branch instructions could
increase the execution time for a program by as much as 40 percent.
Unconditional Branches
• Reducing the branch penalty requires the branch target address to be
computed earlier in the pipeline
Target address is determined in the Decode
stage of the pipeline.
Conditional Branches
• For pipelining, the branch condition must be tested as early as
possible to limit the branch penalty
The Branch Delay Slot
• The location that follows a branch instruction is called the branch
delay slot.
• Rather than conditionally discard the instruction in the delay slot, we
can arrange to have the pipeline always execute this instruction,
whether or not the branch is taken
Branch Prediction
• To reduce the branch penalty further, the processor needs to
anticipate that an instruction being fetched is a branch instruction
• Predict its outcome to determine which instruction should be fetched
• Static Branch Prediction
• Dynamic Branch Prediction
Static Branch Prediction
• The simplest form of branch prediction is to assume that the branch
will not be taken and to fetch the next instruction in sequential
address order
• If the prediction is correct, the fetched instruction is allowed to
complete and there is no penalty
• Misprediction incurs the full branch penalty
Dynamic Branch Prediction
• The processor hardware assesses the likelihood of a given branch
being taken by keeping track of branch decisions every time that a
branch instruction is executed.
• dynamic prediction algorithm can use the result of the most recent
execution of a branch instruction
• The processor assumes that the next time the instruction is executed,
the branch decision is likely to be the same as the last time.
A 2-state algorithm
• When the branch instruction is executed and the branch is taken, the
machine moves to state LT. Otherwise, it remains in state LNT.
• The next time the same instruction is encountered, the branch is
predicted as taken if the state machine is in state LT. Otherwise it is
predicted as not taken.
LT - Branch is likely to be taken
LNT - Branch is likely not to be taken
A 4-state algorithm
ST - Strongly likely to be taken
LT - Likely to be taken
LNT - Likely not to be taken
SNT - Strongly likely not to be taken
• After the branch instruction is executed,
and if the branch is actually taken, the
state is changed to ST; otherwise, it is
changed to SNT.
• The branch is predicted as taken if the
state is either ST or LT. Otherwise, the
branch is predicted as not taken.
Performance Evaluation
• Basic performance equation
• For a non-pipelined processor, the execution time, T, of a program
that has a dynamic instruction count of N is given by
• S is the average number of clock cycles it takes to fetch and execute
one instruction
• R is the clock rate in cycles per second
• Instruction throughput
• Number of instructions executed per second. For non-pipelined
execution, the throughput, Pnp, is given by
• The processor with five cycles to execute all instructions.
• If there are no cache misses, S is equal to 5.
• For the five-stage pipeline each instruction is executed in five cycles,
but a new instruction can ideally enter the pipeline every cycle.
• Thus, in the absence of stalls, S is equal to 1, and the ideal throughput
with pipelining is
• A five-stage pipeline can potentially increase the throughput by a
factor of five
n-stage pipeline has the potential to increase throughput n times
Assignment
Date of Submission: 27-Jun-2016
• How much of this potential increase in instruction
throughput can actually be realizedin practice?
• What is a good value for n?
Superscalar Operation
• Add R2, R3, #100
• Load R5, 16(R6)
• Subtract R7, R8, R9
• Store R10, 24(R11)
References
• "Computer Organization", Carl Hamacher Safwat Zaky Zvonko
Vranesic, McGraw-Hill, 2002

More Related Content

What's hot

Branch prediction
Branch predictionBranch prediction
Branch prediction
Aneesh Raveendran
 
Pipelining & All Hazards Solution
Pipelining  & All Hazards SolutionPipelining  & All Hazards Solution
Pipelining & All Hazards Solution
.AIR UNIVERSITY ISLAMABAD
 
Timing and control
Timing and controlTiming and control
Timing and control
chauhankapil
 
instruction cycle ppt
instruction cycle pptinstruction cycle ppt
instruction cycle ppt
sheetal singh
 
Computer architecture instruction formats
Computer architecture instruction formatsComputer architecture instruction formats
Computer architecture instruction formats
Mazin Alwaaly
 
Instruction set and instruction execution cycle
Instruction set and instruction execution cycleInstruction set and instruction execution cycle
Instruction set and instruction execution cycle
Mkaur01
 
INSTRUCTION LEVEL PARALLALISM
INSTRUCTION LEVEL PARALLALISMINSTRUCTION LEVEL PARALLALISM
INSTRUCTION LEVEL PARALLALISM
Kamran Ashraf
 
RISC - Reduced Instruction Set Computing
RISC - Reduced Instruction Set ComputingRISC - Reduced Instruction Set Computing
RISC - Reduced Instruction Set Computing
Tushar Swami
 
Instruction pipeline: Computer Architecture
Instruction pipeline: Computer ArchitectureInstruction pipeline: Computer Architecture
Instruction pipeline: Computer Architecture
InteX Research Lab
 
Control Unit Design
Control Unit DesignControl Unit Design
Control Unit Design
Vinit Raut
 
Memory Addressing
Memory AddressingMemory Addressing
Memory Addressing
chauhankapil
 
Design of Accumulator Unit
Design of Accumulator UnitDesign of Accumulator Unit
Design of Accumulator Unit
Harshad Koshti
 
Instruction Execution Cycle
Instruction Execution CycleInstruction Execution Cycle
Instruction Execution Cycle
utsav_shah
 
Superscalar & superpipeline processor
Superscalar & superpipeline processorSuperscalar & superpipeline processor
Superscalar & superpipeline processor
Muhammad Ishaq
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
Anuj Modi
 
Stack organization
Stack organizationStack organization
Stack organization
chauhankapil
 
Paging and segmentation
Paging and segmentationPaging and segmentation
Paging and segmentation
Piyush Rochwani
 
Memory management
Memory managementMemory management
Memory management
cpjcollege
 
Computer organization and architecture
Computer organization and architectureComputer organization and architecture
Computer organization and architecture
Subesh Kumar Yadav
 
Registers and-common-bus
Registers and-common-busRegisters and-common-bus
Registers and-common-bus
Anuj Modi
 

What's hot (20)

Branch prediction
Branch predictionBranch prediction
Branch prediction
 
Pipelining & All Hazards Solution
Pipelining  & All Hazards SolutionPipelining  & All Hazards Solution
Pipelining & All Hazards Solution
 
Timing and control
Timing and controlTiming and control
Timing and control
 
instruction cycle ppt
instruction cycle pptinstruction cycle ppt
instruction cycle ppt
 
Computer architecture instruction formats
Computer architecture instruction formatsComputer architecture instruction formats
Computer architecture instruction formats
 
Instruction set and instruction execution cycle
Instruction set and instruction execution cycleInstruction set and instruction execution cycle
Instruction set and instruction execution cycle
 
INSTRUCTION LEVEL PARALLALISM
INSTRUCTION LEVEL PARALLALISMINSTRUCTION LEVEL PARALLALISM
INSTRUCTION LEVEL PARALLALISM
 
RISC - Reduced Instruction Set Computing
RISC - Reduced Instruction Set ComputingRISC - Reduced Instruction Set Computing
RISC - Reduced Instruction Set Computing
 
Instruction pipeline: Computer Architecture
Instruction pipeline: Computer ArchitectureInstruction pipeline: Computer Architecture
Instruction pipeline: Computer Architecture
 
Control Unit Design
Control Unit DesignControl Unit Design
Control Unit Design
 
Memory Addressing
Memory AddressingMemory Addressing
Memory Addressing
 
Design of Accumulator Unit
Design of Accumulator UnitDesign of Accumulator Unit
Design of Accumulator Unit
 
Instruction Execution Cycle
Instruction Execution CycleInstruction Execution Cycle
Instruction Execution Cycle
 
Superscalar & superpipeline processor
Superscalar & superpipeline processorSuperscalar & superpipeline processor
Superscalar & superpipeline processor
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
 
Stack organization
Stack organizationStack organization
Stack organization
 
Paging and segmentation
Paging and segmentationPaging and segmentation
Paging and segmentation
 
Memory management
Memory managementMemory management
Memory management
 
Computer organization and architecture
Computer organization and architectureComputer organization and architecture
Computer organization and architecture
 
Registers and-common-bus
Registers and-common-busRegisters and-common-bus
Registers and-common-bus
 

Viewers also liked

Instruction Level Parallelism (ILP) Limitations
Instruction Level Parallelism (ILP) LimitationsInstruction Level Parallelism (ILP) Limitations
Instruction Level Parallelism (ILP) Limitations
Jose Pinilla
 
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
 
Concept of Pipelining
Concept of PipeliningConcept of Pipelining
Concept of Pipelining
SHAKOOR AB
 
Instruction level parallelism
Instruction level parallelismInstruction level parallelism
Instruction level parallelism
deviyasharwin
 
Instruction pipelining
Instruction pipeliningInstruction pipelining
Instruction pipelining
Tech_MX
 
Pipelining and vector processing
Pipelining and vector processingPipelining and vector processing
Pipelining and vector processing
Kamal Acharya
 
Pertemuan 9 pipelining
Pertemuan 9 pipeliningPertemuan 9 pipelining
Pertemuan 9 pipelining
jumiathyasiz
 
Instruction Level Parallelism Compiler optimization Techniques Anna Universit...
Instruction Level Parallelism Compiler optimization Techniques Anna Universit...Instruction Level Parallelism Compiler optimization Techniques Anna Universit...
Instruction Level Parallelism Compiler optimization Techniques Anna Universit...
Dr.K. Thirunadana Sikamani
 
Chapter6 pipelining
Chapter6  pipeliningChapter6  pipelining
Chapter6 pipelining
Gurpreet Singh
 
A Look Back | A Look Ahead Seattle Foundation Services
A Look Back | A Look Ahead Seattle Foundation ServicesA Look Back | A Look Ahead Seattle Foundation Services
A Look Back | A Look Ahead Seattle Foundation Services
Seattle Foundation
 
Computer architecture kai hwang
Computer architecture   kai hwangComputer architecture   kai hwang
Computer architecture kai hwang
Sumedha
 
Advanced computer architecture
Advanced computer architectureAdvanced computer architecture
Advanced computer architecture
Md. Mahedi Mahfuj
 
The Future of Data Science
The Future of Data ScienceThe Future of Data Science
The Future of Data Science
sarith divakar
 
Evolution of Computer
Evolution of ComputerEvolution of Computer
Ceg4131 models
Ceg4131 modelsCeg4131 models
Ceg4131 models
anandme07
 
Lec3 final
Lec3 finalLec3 final
Lec3 final
Gichelle Amon
 
Pipelining
PipeliningPipelining
Pipelining
AJAL A J
 
pipelining
pipeliningpipelining
pipelining
sudhir saurav
 
Big data processing with apache spark
Big data processing with apache sparkBig data processing with apache spark
Big data processing with apache spark
sarith divakar
 

Viewers also liked (20)

Instruction Level Parallelism (ILP) Limitations
Instruction Level Parallelism (ILP) LimitationsInstruction Level Parallelism (ILP) Limitations
Instruction Level Parallelism (ILP) Limitations
 
Pipelining and ILP (Instruction Level Parallelism)
Pipelining and ILP (Instruction Level Parallelism) Pipelining and ILP (Instruction Level Parallelism)
Pipelining and ILP (Instruction Level Parallelism)
 
Concept of Pipelining
Concept of PipeliningConcept of Pipelining
Concept of Pipelining
 
Instruction level parallelism
Instruction level parallelismInstruction level parallelism
Instruction level parallelism
 
Instruction pipelining
Instruction pipeliningInstruction pipelining
Instruction pipelining
 
Pipelining and vector processing
Pipelining and vector processingPipelining and vector processing
Pipelining and vector processing
 
Pertemuan 9 pipelining
Pertemuan 9 pipeliningPertemuan 9 pipelining
Pertemuan 9 pipelining
 
Instruction Level Parallelism Compiler optimization Techniques Anna Universit...
Instruction Level Parallelism Compiler optimization Techniques Anna Universit...Instruction Level Parallelism Compiler optimization Techniques Anna Universit...
Instruction Level Parallelism Compiler optimization Techniques Anna Universit...
 
Chapter6 pipelining
Chapter6  pipeliningChapter6  pipelining
Chapter6 pipelining
 
A Look Back | A Look Ahead Seattle Foundation Services
A Look Back | A Look Ahead Seattle Foundation ServicesA Look Back | A Look Ahead Seattle Foundation Services
A Look Back | A Look Ahead Seattle Foundation Services
 
Computer architecture kai hwang
Computer architecture   kai hwangComputer architecture   kai hwang
Computer architecture kai hwang
 
Advanced computer architecture
Advanced computer architectureAdvanced computer architecture
Advanced computer architecture
 
The Future of Data Science
The Future of Data ScienceThe Future of Data Science
The Future of Data Science
 
Evolution of Computer
Evolution of ComputerEvolution of Computer
Evolution of Computer
 
Pert.11 pipelining
Pert.11 pipeliningPert.11 pipelining
Pert.11 pipelining
 
Ceg4131 models
Ceg4131 modelsCeg4131 models
Ceg4131 models
 
Lec3 final
Lec3 finalLec3 final
Lec3 final
 
Pipelining
PipeliningPipelining
Pipelining
 
pipelining
pipeliningpipelining
pipelining
 
Big data processing with apache spark
Big data processing with apache sparkBig data processing with apache spark
Big data processing with apache spark
 

Similar to Pipelining

Computer SAarchitecture Lecture 6_Pip.pdf
Computer SAarchitecture Lecture 6_Pip.pdfComputer SAarchitecture Lecture 6_Pip.pdf
Computer SAarchitecture Lecture 6_Pip.pdf
kimhyunwoo24
 
Conditional branches
Conditional branchesConditional branches
Conditional branches
Dilip Mathuria
 
Round Robin Algorithm.pptx
Round Robin Algorithm.pptxRound Robin Algorithm.pptx
Round Robin Algorithm.pptx
Sanad Bhowmik
 
12 processor structure and function
12 processor structure and function12 processor structure and function
12 processor structure and function
Sher Shah Merkhel
 
notes_Lecture-8 (Computer Architecture) 3rd Semester 2k11 (1).pdf
notes_Lecture-8 (Computer Architecture) 3rd Semester 2k11 (1).pdfnotes_Lecture-8 (Computer Architecture) 3rd Semester 2k11 (1).pdf
notes_Lecture-8 (Computer Architecture) 3rd Semester 2k11 (1).pdf
SatyamMishra828076
 
Process scheduling algorithms
Process scheduling algorithmsProcess scheduling algorithms
Process scheduling algorithms
Shubham Sharma
 
Topic2a ss pipelines
Topic2a ss pipelinesTopic2a ss pipelines
Topic2a ss pipelines
turki_09
 
Performance Enhancement with Pipelining
Performance Enhancement with PipeliningPerformance Enhancement with Pipelining
Performance Enhancement with Pipelining
Aneesh Raveendran
 
IT209 Cpu Structure Report
IT209 Cpu Structure ReportIT209 Cpu Structure Report
IT209 Cpu Structure Report
Bis Aquino
 
Chap2 slides
Chap2 slidesChap2 slides
Chap2 slides
BaliThorat1
 
12 processor structure and function
12 processor structure and function12 processor structure and function
12 processor structure and function
dilip kumar
 
CPU Scheduling Part-III.pdf
CPU Scheduling Part-III.pdfCPU Scheduling Part-III.pdf
CPU Scheduling Part-III.pdf
Harika Pudugosula
 
14 superscalar
14 superscalar14 superscalar
14 superscalar
Anwal Mirza
 
ch2.pptx
ch2.pptxch2.pptx
ch2.pptx
Halogens
 
Computer organisation and architecture .
Computer organisation and architecture .Computer organisation and architecture .
Computer organisation and architecture .
MalligaarjunanN
 
Fault Tolerance in Distributed Environment
Fault Tolerance in Distributed EnvironmentFault Tolerance in Distributed Environment
Fault Tolerance in Distributed Environment
Orkhan Gasimov
 
Operating system 30 preemptive scheduling
Operating system 30 preemptive schedulingOperating system 30 preemptive scheduling
Operating system 30 preemptive scheduling
Vaibhav Khanna
 
pipelining-190913185902.pptx
pipelining-190913185902.pptxpipelining-190913185902.pptx
pipelining-190913185902.pptx
AshokRachapalli1
 
12 processor structure and function
12 processor structure and function12 processor structure and function
12 processor structure and function
Anwal Mirza
 
14 superscalar
14 superscalar14 superscalar
14 superscalar
dilip kumar
 

Similar to Pipelining (20)

Computer SAarchitecture Lecture 6_Pip.pdf
Computer SAarchitecture Lecture 6_Pip.pdfComputer SAarchitecture Lecture 6_Pip.pdf
Computer SAarchitecture Lecture 6_Pip.pdf
 
Conditional branches
Conditional branchesConditional branches
Conditional branches
 
Round Robin Algorithm.pptx
Round Robin Algorithm.pptxRound Robin Algorithm.pptx
Round Robin Algorithm.pptx
 
12 processor structure and function
12 processor structure and function12 processor structure and function
12 processor structure and function
 
notes_Lecture-8 (Computer Architecture) 3rd Semester 2k11 (1).pdf
notes_Lecture-8 (Computer Architecture) 3rd Semester 2k11 (1).pdfnotes_Lecture-8 (Computer Architecture) 3rd Semester 2k11 (1).pdf
notes_Lecture-8 (Computer Architecture) 3rd Semester 2k11 (1).pdf
 
Process scheduling algorithms
Process scheduling algorithmsProcess scheduling algorithms
Process scheduling algorithms
 
Topic2a ss pipelines
Topic2a ss pipelinesTopic2a ss pipelines
Topic2a ss pipelines
 
Performance Enhancement with Pipelining
Performance Enhancement with PipeliningPerformance Enhancement with Pipelining
Performance Enhancement with Pipelining
 
IT209 Cpu Structure Report
IT209 Cpu Structure ReportIT209 Cpu Structure Report
IT209 Cpu Structure Report
 
Chap2 slides
Chap2 slidesChap2 slides
Chap2 slides
 
12 processor structure and function
12 processor structure and function12 processor structure and function
12 processor structure and function
 
CPU Scheduling Part-III.pdf
CPU Scheduling Part-III.pdfCPU Scheduling Part-III.pdf
CPU Scheduling Part-III.pdf
 
14 superscalar
14 superscalar14 superscalar
14 superscalar
 
ch2.pptx
ch2.pptxch2.pptx
ch2.pptx
 
Computer organisation and architecture .
Computer organisation and architecture .Computer organisation and architecture .
Computer organisation and architecture .
 
Fault Tolerance in Distributed Environment
Fault Tolerance in Distributed EnvironmentFault Tolerance in Distributed Environment
Fault Tolerance in Distributed Environment
 
Operating system 30 preemptive scheduling
Operating system 30 preemptive schedulingOperating system 30 preemptive scheduling
Operating system 30 preemptive scheduling
 
pipelining-190913185902.pptx
pipelining-190913185902.pptxpipelining-190913185902.pptx
pipelining-190913185902.pptx
 
12 processor structure and function
12 processor structure and function12 processor structure and function
12 processor structure and function
 
14 superscalar
14 superscalar14 superscalar
14 superscalar
 

Recently uploaded

South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
David Douglas School District
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
Celine George
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
TechSoup
 
Smart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICTSmart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICT
simonomuemu
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
Dr. Shivangi Singh Parihar
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
ak6969907
 
Community pharmacy- Social and preventive pharmacy UNIT 5
Community pharmacy- Social and preventive pharmacy UNIT 5Community pharmacy- Social and preventive pharmacy UNIT 5
Community pharmacy- Social and preventive pharmacy UNIT 5
sayalidalavi006
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
Celine George
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
taiba qazi
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
amberjdewit93
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
Celine George
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 

Recently uploaded (20)

South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
 
Smart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICTSmart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICT
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
 
Community pharmacy- Social and preventive pharmacy UNIT 5
Community pharmacy- Social and preventive pharmacy UNIT 5Community pharmacy- Social and preventive pharmacy UNIT 5
Community pharmacy- Social and preventive pharmacy UNIT 5
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 

Pipelining

  • 2. Objectives • Basics of pipelining and how it can lead to improved performance. • Hazards that cause performance degradation and techniques to alleviate their effect on performance • Role of optimizing compilers, which rearrange the sequence of instructions to maximize the benefits of pipelined execution • Replicating hardware units in a superscalar processor so that multiple pipelines can operate concurrently.
  • 3. Basic Concepts • Pipelining overlaps the execution of successive instructions to achieve high performance • The speed of execution of programs is improved by • using faster circuit technology • arranging the hardware so that more than one operation can be performed at the same time • The number of operations performed per second is increased, even though the time needed to perform any one operation is not changed • Pipelining is a particularly effective way of organizing concurrent activity in a computer system.
  • 6.
  • 7. Pipelining Issues • Any condition that causes the pipeline to stall is called a hazard • Data hazard: Value of a source operand of an instruction is not available when needed • Other hazards arise from memory delays, branch instructions, and resource limitations Writing to Register file Operation using the old value of the register
  • 8. Data Dependencies • Add R2, R3, #100 • Subtract R9, R2, #30 • The Subtract instruction is stalled for three cycles to delay reading register R2 until cycle 6 when the new value becomes available.
  • 9. Operand Forwarding • Pipeline stalls due to data dependencies can be alleviated through the use of operand forwarding
  • 10.
  • 11. Handling Data Dependencies in Software Add R2, R3, #100 NOP NOP NOP Subtract R9, R2, #30 • Code size increases • Execution time not reduced The compiler can attempt to optimize the code to improve performance and reduce the code size by reordering instructions to move useful instructions into the NOP slots
  • 12. Memory Delays • Load instruction may require more than one clock cycle to obtain its operand from memory. • Load R2, (R3) • Subtract R9, R2, #30
  • 13. Operand forwarding • Operand forwarding cannot be done because the data read from memory (the cache, in this case) are not available until they are loaded into register RY at the beginning of cycle 5 The memory operand, which is now in register RY, can be forwarded to the ALU input in cycle 5.
  • 14. Branch Delays • Branch instructions can alter the sequence of execution, but they must first be executed to determine whether and where to branch. • Branch instructions occur frequently. In fact, they represent about 20 percent of the dynamic instruction count of most programs. • Reducing the branch penalty requires the branch target address to be computed earlier in the pipeline With a two-cycle branch penalty, the relatively high frequency of branch instructions could increase the execution time for a program by as much as 40 percent.
  • 15. Unconditional Branches • Reducing the branch penalty requires the branch target address to be computed earlier in the pipeline
  • 16. Target address is determined in the Decode stage of the pipeline.
  • 17. Conditional Branches • For pipelining, the branch condition must be tested as early as possible to limit the branch penalty
  • 18. The Branch Delay Slot • The location that follows a branch instruction is called the branch delay slot. • Rather than conditionally discard the instruction in the delay slot, we can arrange to have the pipeline always execute this instruction, whether or not the branch is taken
  • 19.
  • 20. Branch Prediction • To reduce the branch penalty further, the processor needs to anticipate that an instruction being fetched is a branch instruction • Predict its outcome to determine which instruction should be fetched • Static Branch Prediction • Dynamic Branch Prediction
  • 21. Static Branch Prediction • The simplest form of branch prediction is to assume that the branch will not be taken and to fetch the next instruction in sequential address order • If the prediction is correct, the fetched instruction is allowed to complete and there is no penalty • Misprediction incurs the full branch penalty
  • 22. Dynamic Branch Prediction • The processor hardware assesses the likelihood of a given branch being taken by keeping track of branch decisions every time that a branch instruction is executed. • dynamic prediction algorithm can use the result of the most recent execution of a branch instruction • The processor assumes that the next time the instruction is executed, the branch decision is likely to be the same as the last time.
  • 23. A 2-state algorithm • When the branch instruction is executed and the branch is taken, the machine moves to state LT. Otherwise, it remains in state LNT. • The next time the same instruction is encountered, the branch is predicted as taken if the state machine is in state LT. Otherwise it is predicted as not taken. LT - Branch is likely to be taken LNT - Branch is likely not to be taken
  • 24. A 4-state algorithm ST - Strongly likely to be taken LT - Likely to be taken LNT - Likely not to be taken SNT - Strongly likely not to be taken • After the branch instruction is executed, and if the branch is actually taken, the state is changed to ST; otherwise, it is changed to SNT. • The branch is predicted as taken if the state is either ST or LT. Otherwise, the branch is predicted as not taken.
  • 25. Performance Evaluation • Basic performance equation • For a non-pipelined processor, the execution time, T, of a program that has a dynamic instruction count of N is given by • S is the average number of clock cycles it takes to fetch and execute one instruction • R is the clock rate in cycles per second
  • 26. • Instruction throughput • Number of instructions executed per second. For non-pipelined execution, the throughput, Pnp, is given by • The processor with five cycles to execute all instructions. • If there are no cache misses, S is equal to 5.
  • 27. • For the five-stage pipeline each instruction is executed in five cycles, but a new instruction can ideally enter the pipeline every cycle. • Thus, in the absence of stalls, S is equal to 1, and the ideal throughput with pipelining is • A five-stage pipeline can potentially increase the throughput by a factor of five n-stage pipeline has the potential to increase throughput n times
  • 28. Assignment Date of Submission: 27-Jun-2016 • How much of this potential increase in instruction throughput can actually be realizedin practice? • What is a good value for n?
  • 30. • Add R2, R3, #100 • Load R5, 16(R6) • Subtract R7, R8, R9 • Store R10, 24(R11)
  • 31. References • "Computer Organization", Carl Hamacher Safwat Zaky Zvonko Vranesic, McGraw-Hill, 2002