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

Register transfer language
Register transfer languageRegister transfer language
Register transfer languageSanjeev Patel
 
Pipeline hazard
Pipeline hazardPipeline hazard
Pipeline hazardAJAL A J
 
Concept of Pipelining
Concept of PipeliningConcept of Pipelining
Concept of PipeliningSHAKOOR AB
 
Coa module2
Coa module2Coa module2
Coa module2cs19club
 
instruction cycle ppt
instruction cycle pptinstruction cycle ppt
instruction cycle pptsheetal singh
 
Direct memory access (dma)
Direct memory access (dma)Direct memory access (dma)
Direct memory access (dma)Zubair Khalid
 
Pipelining powerpoint presentation
Pipelining powerpoint presentationPipelining powerpoint presentation
Pipelining powerpoint presentationbhavanadonthi
 
Multi core-architecture
Multi core-architectureMulti core-architecture
Multi core-architecturePiyush Mittal
 
Pipelining and vector processing
Pipelining and vector processingPipelining and vector processing
Pipelining and vector processingKamal Acharya
 
Superscalar & superpipeline processor
Superscalar & superpipeline processorSuperscalar & superpipeline processor
Superscalar & superpipeline processorMuhammad Ishaq
 
Interconnection Network
Interconnection NetworkInterconnection Network
Interconnection NetworkHeman Pathak
 
Risc cisc Difference
Risc cisc DifferenceRisc cisc Difference
Risc cisc DifferenceSehrish Asif
 
Unit 3 basic processing unit
Unit 3   basic processing unitUnit 3   basic processing unit
Unit 3 basic processing unitchidabdu
 
Pipeline processing and space time diagram
Pipeline processing and space time diagramPipeline processing and space time diagram
Pipeline processing and space time diagramRahul Sharma
 

What's hot (20)

Pipelining slides
Pipelining slides Pipelining slides
Pipelining slides
 
Register transfer language
Register transfer languageRegister transfer language
Register transfer language
 
Pipeline hazard
Pipeline hazardPipeline hazard
Pipeline hazard
 
Concept of Pipelining
Concept of PipeliningConcept of Pipelining
Concept of Pipelining
 
Coa module2
Coa module2Coa module2
Coa module2
 
instruction cycle ppt
instruction cycle pptinstruction cycle ppt
instruction cycle ppt
 
Direct memory access (dma)
Direct memory access (dma)Direct memory access (dma)
Direct memory access (dma)
 
Interrupts
InterruptsInterrupts
Interrupts
 
Pipelining powerpoint presentation
Pipelining powerpoint presentationPipelining powerpoint presentation
Pipelining powerpoint presentation
 
Multi core-architecture
Multi core-architectureMulti core-architecture
Multi core-architecture
 
Pipelining and vector processing
Pipelining and vector processingPipelining and vector processing
Pipelining and vector processing
 
Superscalar & superpipeline processor
Superscalar & superpipeline processorSuperscalar & superpipeline processor
Superscalar & superpipeline processor
 
design of accumlator
design of accumlatordesign of accumlator
design of accumlator
 
Interconnection Network
Interconnection NetworkInterconnection Network
Interconnection Network
 
Risc cisc Difference
Risc cisc DifferenceRisc cisc Difference
Risc cisc Difference
 
Scheduling algorithms
Scheduling algorithmsScheduling algorithms
Scheduling algorithms
 
Interrupt
InterruptInterrupt
Interrupt
 
Computer arithmetic
Computer arithmeticComputer arithmetic
Computer arithmetic
 
Unit 3 basic processing unit
Unit 3   basic processing unitUnit 3   basic processing unit
Unit 3 basic processing unit
 
Pipeline processing and space time diagram
Pipeline processing and space time diagramPipeline processing and space time diagram
Pipeline processing and space time diagram
 

Viewers also liked

Instruction Level Parallelism (ILP) Limitations
Instruction Level Parallelism (ILP) LimitationsInstruction Level Parallelism (ILP) Limitations
Instruction Level Parallelism (ILP) LimitationsJose 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
 
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
 
Pipelining_Computer Organization_TU(BIM)
Pipelining_Computer Organization_TU(BIM)Pipelining_Computer Organization_TU(BIM)
Pipelining_Computer Organization_TU(BIM)Kapil Khatiwada
 
Lec2 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- ILP
Lec2 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- ILPLec2 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- ILP
Lec2 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- ILPHsien-Hsin Sean Lee, Ph.D.
 

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)
 
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
 
Pipelining_Computer Organization_TU(BIM)
Pipelining_Computer Organization_TU(BIM)Pipelining_Computer Organization_TU(BIM)
Pipelining_Computer Organization_TU(BIM)
 
Lec2 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- ILP
Lec2 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- ILPLec2 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- ILP
Lec2 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- ILP
 

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
 
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).pdfSatyamMishra828076
 
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
 
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 & 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
 

Recently uploaded

Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseAnaAcapella
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Association for Project Management
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxcallscotland1987
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdfssuserdda66b
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 

Recently uploaded (20)

Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 

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