SlideShare a Scribd company logo
1 of 31
Download to read offline
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

Addressing mode Computer Architecture
Addressing mode  Computer ArchitectureAddressing mode  Computer Architecture
Addressing mode Computer ArchitectureHaris456
 
Unit 5 I/O organization
Unit 5   I/O organizationUnit 5   I/O organization
Unit 5 I/O organizationchidabdu
 
Arithmatic pipline
Arithmatic piplineArithmatic pipline
Arithmatic piplineA. Shamel
 
8259 Operating Modes.pptx
8259 Operating Modes.pptx8259 Operating Modes.pptx
8259 Operating Modes.pptxMeenaAnusha1
 
Unit 3 basic processing unit
Unit 3   basic processing unitUnit 3   basic processing unit
Unit 3 basic processing unitchidabdu
 
Instruction pipelining
Instruction pipeliningInstruction pipelining
Instruction pipeliningTech_MX
 
8237 dma controller
8237 dma controller8237 dma controller
8237 dma controllerTech_MX
 
Superscalar processor
Superscalar processorSuperscalar processor
Superscalar processornoor ul ain
 
Pipeline processing - Computer Architecture
Pipeline processing - Computer Architecture Pipeline processing - Computer Architecture
Pipeline processing - Computer Architecture S. Hasnain Raza
 
Pipelining
PipeliningPipelining
PipeliningAmin Omi
 
Superscalar Architecture_AIUB
Superscalar Architecture_AIUBSuperscalar Architecture_AIUB
Superscalar Architecture_AIUBNusrat Mary
 
Pipelining and vector processing
Pipelining and vector processingPipelining and vector processing
Pipelining and vector processingKamal Acharya
 
Control Unit Design
Control Unit DesignControl Unit Design
Control Unit DesignVinit Raut
 
Unit 3-pipelining & vector processing
Unit 3-pipelining & vector processingUnit 3-pipelining & vector processing
Unit 3-pipelining & vector processingvishal choudhary
 
Operating system services 9
Operating system services 9Operating system services 9
Operating system services 9myrajendra
 
Topic : X.25, Frame relay and ATM
Topic :  X.25, Frame relay and ATMTopic :  X.25, Frame relay and ATM
Topic : X.25, Frame relay and ATMDr Rajiv Srivastava
 
Computer architecture pipelining
Computer architecture pipeliningComputer architecture pipelining
Computer architecture pipeliningMazin Alwaaly
 

What's hot (20)

Addressing mode Computer Architecture
Addressing mode  Computer ArchitectureAddressing mode  Computer Architecture
Addressing mode Computer Architecture
 
pipelining
pipeliningpipelining
pipelining
 
Unit 5 I/O organization
Unit 5   I/O organizationUnit 5   I/O organization
Unit 5 I/O organization
 
Arithmatic pipline
Arithmatic piplineArithmatic pipline
Arithmatic pipline
 
8259 Operating Modes.pptx
8259 Operating Modes.pptx8259 Operating Modes.pptx
8259 Operating Modes.pptx
 
Unit 3 basic processing unit
Unit 3   basic processing unitUnit 3   basic processing unit
Unit 3 basic processing unit
 
Instruction pipelining
Instruction pipeliningInstruction pipelining
Instruction pipelining
 
Addressing sequencing
Addressing sequencingAddressing sequencing
Addressing sequencing
 
8237 dma controller
8237 dma controller8237 dma controller
8237 dma controller
 
Piplining
PipliningPiplining
Piplining
 
Superscalar processor
Superscalar processorSuperscalar processor
Superscalar processor
 
Pipeline processing - Computer Architecture
Pipeline processing - Computer Architecture Pipeline processing - Computer Architecture
Pipeline processing - Computer Architecture
 
Pipelining
PipeliningPipelining
Pipelining
 
Superscalar Architecture_AIUB
Superscalar Architecture_AIUBSuperscalar Architecture_AIUB
Superscalar Architecture_AIUB
 
Pipelining and vector processing
Pipelining and vector processingPipelining and vector processing
Pipelining and vector processing
 
Control Unit Design
Control Unit DesignControl Unit Design
Control Unit Design
 
Unit 3-pipelining & vector processing
Unit 3-pipelining & vector processingUnit 3-pipelining & vector processing
Unit 3-pipelining & vector processing
 
Operating system services 9
Operating system services 9Operating system services 9
Operating system services 9
 
Topic : X.25, Frame relay and ATM
Topic :  X.25, Frame relay and ATMTopic :  X.25, Frame relay and ATM
Topic : X.25, Frame relay and ATM
 
Computer architecture pipelining
Computer architecture pipeliningComputer architecture pipelining
Computer architecture pipelining
 

Viewers also liked

INSTRUCTION LEVEL PARALLALISM
INSTRUCTION LEVEL PARALLALISMINSTRUCTION LEVEL PARALLALISM
INSTRUCTION LEVEL PARALLALISMKamran Ashraf
 
Instruction Level Parallelism (ILP) Limitations
Instruction Level Parallelism (ILP) LimitationsInstruction Level Parallelism (ILP) Limitations
Instruction Level Parallelism (ILP) LimitationsJose Pinilla
 
Concept of Pipelining
Concept of PipeliningConcept of Pipelining
Concept of PipeliningSHAKOOR AB
 
Instruction level parallelism
Instruction level parallelismInstruction level parallelism
Instruction level parallelismdeviyasharwin
 
Pertemuan 9 pipelining
Pertemuan 9 pipeliningPertemuan 9 pipelining
Pertemuan 9 pipeliningjumiathyasiz
 
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
 
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 ServicesSeattle Foundation
 
Computer architecture kai hwang
Computer architecture   kai hwangComputer architecture   kai hwang
Computer architecture kai hwangSumedha
 
Advanced computer architecture
Advanced computer architectureAdvanced computer architecture
Advanced computer architectureMd. Mahedi Mahfuj
 
The Future of Data Science
The Future of Data ScienceThe Future of Data Science
The Future of Data Sciencesarith divakar
 
Ceg4131 models
Ceg4131 modelsCeg4131 models
Ceg4131 modelsanandme07
 
Pipelining
PipeliningPipelining
PipeliningAJAL A J
 
Big data processing with apache spark
Big data processing with apache sparkBig data processing with apache spark
Big data processing with apache sparksarith divakar
 
Collision prevention on computer architecture
Collision prevention on computer architectureCollision prevention on computer architecture
Collision prevention on computer architectureSarvesh Verma
 
Instruction pipeline: Computer Architecture
Instruction pipeline: Computer ArchitectureInstruction pipeline: Computer Architecture
Instruction pipeline: Computer ArchitectureInteX Research Lab
 

Viewers also liked (20)

INSTRUCTION LEVEL PARALLALISM
INSTRUCTION LEVEL PARALLALISMINSTRUCTION LEVEL PARALLALISM
INSTRUCTION LEVEL PARALLALISM
 
Instruction Level Parallelism (ILP) Limitations
Instruction Level Parallelism (ILP) LimitationsInstruction Level Parallelism (ILP) Limitations
Instruction Level Parallelism (ILP) Limitations
 
Concept of Pipelining
Concept of PipeliningConcept of Pipelining
Concept of Pipelining
 
Instruction level parallelism
Instruction level parallelismInstruction level parallelism
Instruction level parallelism
 
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
 
Collision prevention on computer architecture
Collision prevention on computer architectureCollision prevention on computer architecture
Collision prevention on computer architecture
 
Instruction pipeline: Computer Architecture
Instruction pipeline: Computer ArchitectureInstruction pipeline: Computer Architecture
Instruction pipeline: Computer Architecture
 

Similar to Pipelining

Round Robin Algorithm.pptx
Round Robin Algorithm.pptxRound Robin Algorithm.pptx
Round Robin Algorithm.pptxSanad Bhowmik
 
12 processor structure and function
12 processor structure and function12 processor structure and function
12 processor structure and functionSher Shah Merkhel
 
Process scheduling algorithms
Process scheduling algorithmsProcess scheduling algorithms
Process scheduling algorithmsShubham Sharma
 
Topic2a ss pipelines
Topic2a ss pipelinesTopic2a ss pipelines
Topic2a ss pipelinesturki_09
 
Performance Enhancement with Pipelining
Performance Enhancement with PipeliningPerformance Enhancement with Pipelining
Performance Enhancement with PipeliningAneesh Raveendran
 
IT209 Cpu Structure Report
IT209 Cpu Structure ReportIT209 Cpu Structure Report
IT209 Cpu Structure ReportBis Aquino
 
12 processor structure and function
12 processor structure and function12 processor structure and function
12 processor structure and functiondilip kumar
 
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 EnvironmentOrkhan Gasimov
 
Operating system 30 preemptive scheduling
Operating system 30 preemptive schedulingOperating system 30 preemptive scheduling
Operating system 30 preemptive schedulingVaibhav Khanna
 
pipelining-190913185902.pptx
pipelining-190913185902.pptxpipelining-190913185902.pptx
pipelining-190913185902.pptxAshokRachapalli1
 
12 processor structure and function
12 processor structure and function12 processor structure and function
12 processor structure and functionAnwal Mirza
 

Similar to Pipelining (20)

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
 
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 & All Hazards Solution
Pipelining  & All Hazards SolutionPipelining  & All Hazards Solution
Pipelining & All Hazards Solution
 
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
 
Unit - 5 Pipelining.pptx
Unit - 5 Pipelining.pptxUnit - 5 Pipelining.pptx
Unit - 5 Pipelining.pptx
 

Recently uploaded

Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1GloryAnnCastre1
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operationalssuser3e220a
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...Nguyen Thanh Tu Collection
 
How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17Celine George
 
4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptxmary850239
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmStan Meyer
 
Narcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfNarcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfPrerana Jadhav
 
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQ-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQuiz Club NITW
 
4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptx4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptxmary850239
 
ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6Vanessa Camilleri
 
Sulphonamides, mechanisms and their uses
Sulphonamides, mechanisms and their usesSulphonamides, mechanisms and their uses
Sulphonamides, mechanisms and their usesVijayaLaxmi84
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQuiz Club NITW
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4JOYLYNSAMANIEGO
 
Using Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea DevelopmentUsing Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea Developmentchesterberbo7
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationdeepaannamalai16
 

Recently uploaded (20)

Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operational
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
 
How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17
 
4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and Film
 
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptxINCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
 
Narcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfNarcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdf
 
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQ-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
 
4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptx4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptx
 
ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6
 
Sulphonamides, mechanisms and their uses
Sulphonamides, mechanisms and their usesSulphonamides, mechanisms and their uses
Sulphonamides, mechanisms and their uses
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
Mattingly "AI & Prompt Design: Large Language Models"
Mattingly "AI & Prompt Design: Large Language Models"Mattingly "AI & Prompt Design: Large Language Models"
Mattingly "AI & Prompt Design: Large Language Models"
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
 
Using Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea DevelopmentUsing Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea Development
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentation
 

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