Beruflich Dokumente
Kultur Dokumente
• Heuring, Chapter 5
Pipelining – 5.1 – 5.3
30 40 20 30 40 20 30 40 20 30 40 20 30 40 40 40 40 20
T T
a A a A
s s
k k
B B
O O
r r
d C d C
e e
r r
D D
• Sequential laundry takes 6 hours for 4 loads • Pipelined laundry takes 3.5 hours for 4 loads
1
Pipelining Pipelining [contd…]
• Latency vs. Throughput • Question
• Question
– What is the fastest operation in the example ?
– What is the latency in both cases ?
– What is the slowest operation in the example
– What is the throughput in both cases ?
30 40 40 40 40 20 30 40 40 40 40 20
A A
B B
C C
D D
Pipelining doesn’t help latency of single task, it helps
throughput of entire workload Pipeline rate limited by slowest pipeline stage
B B
C C
D D
Multiple tasks operating simultaneously using different resources Potential Speedup = Number of pipe stages
D
• Question
– What affect is there if folding also took 40
minutes? Time to “fill” pipeline and time to “drain” it reduces speedup
Unbalanced lengths of pipe stages reduces speedup
2
Conventional Pipelined Execution Representation
Five Stages of an Instruction
Time
Cycle 1 Cycle 2 Cycle 3 Cycle 4 Cycle 5
IF ID EXE MEM WB
Load Ifetch Reg/Dec Exec Mem Wr IF ID EXE MEM WB
IF ID EXE MEM WB
IFetch: 200 ps
Definitions
• Performance is in units of things per sec Example [contd…]
– bigger is better
• If we are primarily concerned with response time • Speedup in this case = 24/14 = 1.7
– performance(x) = 1 • Lets add 1000 more instructions
execution_time(x)
– Time (non-pipelined) = 1000 x 8 + 24 ns = 8024 ns
" X is n times faster than Y" means – Time (pipelined) = 1000 x 2 + 14 ns = 2014 ns
– Speedup = 8024 / 2014 = 3.98 = 4 (approx) = 8/2
Performance(X) Execution_time(Y)
n = =
Performance(Y) Execution_time(X)
Instruction throughput is important metric (as opposed to individual instruction)
as real programs execute billions of instructions in practical case !!!
cpsc614
Lec 1.17
3
Pipeline Hazards Pipeline Hazard [contd…]
• Structural Hazard • Control Hazard
IFetch Dcd Exec Mem WB
• Control Hazard
– Decision based on results
• Data Hazard
– Data Dependency