Docsity

Pipelining: Understanding the Concept, Advantages, and Challenges, Study notes of Computer Architecture and Organization

Toggle sidebar
bg1
1
Pipelining
Notes based on Patterson & Hennessey
Chapter 6
Adapted from the lecture notes of Dr. John Kubiatowicz (UC Berkeley)
Reading Assignment
• Heuring, Chapter 5
– 5.1 – 5.3
Topics
• Pipelining
– Advantages
– Terminology
•stages
• pipeline hazards
– structural
– data
– control
– Performance comparison to non-pipelined
Pipelining Analogy
• Laundry
• Ann, Brian, Cathy, Dave
each have one load of clothes
to wash, dry, and fold
• Washer takes 30 minutes
• Dryer takes 40 minutes
• Folding takes 20 minutes
A B C D
Sequential Laundry
• Sequential laundry takes 6 hours for 4 loads
A
B
C
D
30 40 20 30 40 20 30 40 20 30 40 20
6 PM 789
10 11 Midnight
T
a
s
k
O
r
d
e
r
Time
Pipelined Laundry: Start work ASAP
• Pipelined laundry takes 3.5 hours for 4 loads
A
B
C
D
6 PM 789
10 11 Midnight
T
a
s
k
O
r
d
e
r
Time
30 40 40 40 40 20
pf3
pf4

Partial preview of the text

Download Pipelining: Understanding the Concept, Advantages, and Challenges and more Study notes Computer Architecture and Organization in PDF only on Docsity!

Pipelining

Notes based on Patterson & Hennessey

Chapter 6

Adapted from the lecture notes of Dr. John Kubiatowicz (UC Berkeley)

Reading Assignment

• Heuring, Chapter 5

Topics

• Pipelining

– Advantages

– Terminology

  • stages
  • pipeline hazards
    • structural
    • data
    • control

– Performance comparison to non-pipelined

Pipelining Analogy

• Laundry

• Ann, Brian, Cathy, Dave

each have one load of clothes

to wash, dry, and fold

• Washer takes 30 minutes

• Dryer takes 40 minutes

• Folding takes 20 minutes

A B C D

Sequential Laundry

• Sequential laundry takes 6 hours for 4 loads

A

B

C

D

6 PM 7 8 9 10 11 Midnight

T a s k O r d e r

Time

Pipelined Laundry: Start work ASAP

• Pipelined laundry takes 3.5 hours for 4 loads

A

B

C

D

6 PM 7 8 9 10 11 Midnight

T a s k O r d e r

Time

Pipelining

• Latency vs. Throughput

  • Question
    • What is the latency in both cases?
    • What is the throughput in both cases?

Pipelining doesn’t help latency of single task, it helps

throughput of entire workload

A

B

C

D

Pipelining [contd…]

• Question

– What is the fastest operation in the example?

– What is the slowest operation in the example

Pipeline rate limited by slowest pipeline stage

A

B

C

D

Pipelining [contd…]

A

B

C

D

Multiple tasks operating simultaneously using different resources

Pipelining Lessons [contd…]

  • Question
    • Would the speedup increase if we had more steps?

A

B

C

D

Potential Speedup = Number of pipe stages

Pipelining [contd…]

• Washer takes 30 minutes

• Dryer takes 40 minutes

• Folding takes 20 minutes

• Question

  • What affect is there if folding also took 40 minutes?

Unbalanced lengths of pipe stages reduces speedup

Pipelining [contd…]

A

B

C

D

Time to “fill” pipeline and time to “drain” it reduces speedup

Pipeline Hazards

• Structural Hazard

IFetch Dcd Exec Mem WB

IFetch Dcd Exec Mem WB

IFetch Dcd Exec Mem WB

IFetch Dcd Exec Mem WB

IFetch Dcd Exec Mem WB Program Flow IFetch Dcd Exec Mem WB

Pipeline Hazard [contd…]

• Control Hazard

• Example

– add $4, $5, $

– beq $1, $2, 40

– lw $3, 300($0)

Pipeline Hazards [contd…]

• Data Hazards

• Example

– add $s0, $t0, $t

– sub $t2, $s0, $t

Summary Pipelining Lessons

  • Pipelining doesn’t help latency of single task, it helps throughput of entire workload
  • Pipeline rate limited by slowest pipeline stage
  • Multiple tasks operating simultaneously using different resources
  • Potential speedup = Number pipe stages
  • Unbalanced lengths of pipe stages reduces speedup
  • Time to “fill” pipeline and time to “drain” it reduces speedup
  • Stall for Dependences

A

B

C

D

6 PM 7 8

T a s k O r d e r

Time

Summary of Pipeline Hazards

• Structural Hazards

– Hardware design

• Control Hazard

– Decision based on results

• Data Hazard

– Data Dependency