Pipelining (Keng Teng Lao)

Download Report

Transcript Pipelining (Keng Teng Lao)

Pipelining
Author: Keng Teng Lao
CS 147
Section 2
Lao
1
Overview
•
•
•
•
•
Concept of Pipelining
Understanding of Pipelining
Software Pipelining
Hardware Pipelining
How pipelining increase
performances
• Pipelining Architecture
Lao
2
Concept of Pipelining
• Pipelining refers to any
architecture in which digital
information flows through a
series of stations that each
inspect, interpret, or modify the
information.
Lao
3
Concept of Pipelining
• The pipeline designer's goal is
to balance the length of each
pipeline stage .
• If the stages are perfectly
balanced, then the time per
instruction on the pipelined
machine is equal to:
• Time per instruction on nonpipelined machine
Number of pipe stages
Lao
4
Illustration
• Pipeline is divided in stages.
• Each stage completes a part of an
instruction in parallel.
• Instruction enter at one end, and exit at
the other end.
Lao
5
Illustration
• We can think of
pipelining as
car assembly
line
• Many people
working at the
same time, but
not all working
on the same
car.
Lao
6
Illustration
• One person working, two cars
Lao
7
Illustration
• Four person working, but on different
station
Lao
8
Principle of Pipelining
• Improves throughput but not
latency
• Throughput – rate of instruction
going through.
• Latency – the amount of time it
takes a packet of data to move
across a network connection.
• All instructions go through the
same sequence of operations
Lao
9
Understanding of
Pipelining
• Pipelining does not decrease
the time for individual
instruction execution.
• It increases instruction
throughput.
Lao
10
Application of pipelining
•
•
•
•
•
•
•
•
Hardware or software implementation
Large or small scale
Synchronous or asynchronous flow
Buffered or unbuffered flow
Finite chunks or continuous bit streams
Automatic data feed or manual data feed
Serial or parallel path
Homogeneous or heterogeneous stages
Lao
11
Software Pipelining
• Provides a way to handle
complexity.
• Allows programs to be reused.
• Both goals are achieved
because a software pipeline
allows a programmer to divide a
complex to more generic
pieces!!!!!!
Lao
12
Software Pipelining
• In the example of Unix
• cat x | more
• The output of the x (a textfile)
becomes the input of more
command which display a large
file by pressing ‘enter’.
Lao
13
Hardware Pipelining
• Pipelining can help a designer
manage complexity.
• Possible to reuse pieces in
other hardware designs.
• Offers higher performance.
Lao
14
Hardware Pipelining
• Instruction pipelining
• Data pipelining
Lao
15
Instruction Pipelining
• Describe a pipeline in which the
information consists of machine
instructions and the stages of
the pipeline execute the
instructions.
Lao
16
Instruction Pipelining
• Divide the task into steps that may be performed with
independent hardware.
•
•
• The most obvious division is between the FETCH cycle (fetch
and interpret instructions) and the EXECUTE cycle (access
operands and perform operation).
It is possible to further divide FETCH into fetching and
interpreting, but since interpreting is very fast this is not
generally done. To gain the benefits of pipelining it is
desirable that each stage take a comparable amount of
time.
A more practical division would split the EXECUTE cycle
into three parts: Fetch operands, perform operation, and
store results. A typical pipeline might then have four
stages through which instructions pass, and each stage
could be processing a different instruction at the same
time. The result of each stage is passed on to the next
stage.
Lao
17
Instruction Pipelining
• Separate into 4 stages
•
•
•
•
Fetch
Decode
Execute
Save
Lao
18
Data Pipeline
• Designed to pass data from stage to
stage.
• Ex: if a data pipeline is used to handle
packets that arrive from a computer
network, each packet passes
sequentially through the stages of the
pipeline.
• Provides some of the most unusual
and most interesting uses of
pipelining
Lao
19
How Hardware Pipelining
Increases Performance
•
Two optimizations
•
6 Basics Steps
•
Smart I/O devices and Parallelism.
•
•
•
•
•
•
Wait to receive packet
Verify integrity
Check for loops
Route packet
Prepare for transmission
Enqueue packet for output
Lao
20
Pipelining Architecture
• Forms the central paradigm
around which the entire system
is designed
• Dedicated to special-purpose
functions.
• Ex. Improve performance of a
packet processing system.
Lao
21