1 / 36

Principles of Pipeline

Principles of Pipeline. Outline. General Principles of Pipelining Goal Difficulties Suggested Reading 4.4. Problem of SEQ. Too slow Too many tasks needed to finish in one clock cycle Signals need long time to propagate through all of the stages The clock must run slowly enough

ronat
Download Presentation

Principles of Pipeline

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Principles of Pipeline

  2. Outline • General Principles of Pipelining • Goal • Difficulties • Suggested Reading 4.4

  3. Problem of SEQ • Too slow • Too many tasks needed to finish in one clock cycle • Signals need long time to propagate through all of the stages • The clock must run slowly enough • Does not make good use of hardware units • Every unit is active for part of the total clock cycle

  4. Idea Divide process into independent stages Move objects through stages in sequence At any given times, multiple objects being processed Parallel Sequential Pipelined Real-World Pipelines: Car Washes

  5. 300 ps 20 ps Combinational logic R e g Delay = 320 ps Throughput = 3.12 GOPS Clock Computational Example • System • Computation requires total of 300 picoseconds • Additional 20 picoseconds to save result in register • Can must have clock cycle of at least 320 ps

  6. 100 ps 20 ps 100 ps 20 ps 100 ps 20 ps Comb. logic A R e g Comb. logic B R e g Comb. logic C R e g Delay = 360 ps Throughput = 8.33 GOPS Clock 3-Way Pipelined Version • System • Divide combinational logic into 3 blocks of 100 ps each • Can begin new operation as soon as previous one passes through stage A. • Begin new operation every 120 ps • Overall latency increases • 360 ps from start to finish

  7. OP1 A A A B B B C C C OP2 OP3 OP1 Time OP2 Time OP3 Pipeline Diagrams • Unpipelined • Cannot start new operation until previous one completes • 3-Way Pipelined • Up to 3 operations in process simultaneously

  8. 50 ps 20 ps 150 ps 20 ps 100 ps 20 ps Comb. logic A R e g Comb. logic B R e g Comb. logic C R e g Delay = 510 ps Throughput = 5.88 GOPS Clock OP1 A A A B B B C C C OP2 OP3 Time Limitations: Nonuniform Delays

  9. Limitations: Nonuniform Delays • Throughput limited by slowest stage • Other stages sit idle for much of the time • Challenging to partition system into balanced stages

  10. Delay = 420 ps, Throughput = 14.29 GOPS 50 ps 20 ps 50 ps 20 ps 50 ps 20 ps 50 ps 20 ps 50 ps 20 ps 50 ps 20 ps Comb. logic R e g Comb. logic R e g Comb. logic R e g Comb. logic R e g Comb. logic R e g Comb. logic R e g Clock Limitations: Register Overhead

  11. Limitations: Register Overhead • As try to deepen pipeline, overhead of loading registers becomes more significant • Percentage of clock cycle spent loading register: • 1-stage pipeline: 6.25% • 3-stage pipeline: 16.67% • 6-stage pipeline: 28.57% • High speeds of modern processor designs obtained through very deep pipelining

  12. R e g Combinational logic Clock OP1 OP2 OP3 Time Data Dependencies • System • Each operation depends on result from preceding one

  13. A A A A B B B B C C C C Comb. logic A R e g Comb. logic B R e g Comb. logic C R e g OP1 OP2 OP3 OP4 Time Clock Data Hazards

  14. 1 irmovl $50, %eax 2 addl %eax , %ebx 3 mrmovl 100(%ebx),%edx Data Hazards • Result does not feed back around in time for next operation • Pipelining has changed behavior of system

  15. SEQ+ CPU Implementation

  16. Outline • SEQ+ Implementations • Suggested Reading 4.5.1

  17. SEQ Hardware vs. SEQ+ Hardware • SEQ Hardware • Stages occur in sequence • One operation in process at a time • SEQ+ Hardware • Still sequential implementation • Reorder PC stage to put at beginning

  18. SEQ+ Hardware • PC Stage • Task is to select PC for current instruction • Based on results computed by previous instruction • Processor State • PC is no longer stored in register • But, can determine PC based on other stored information

  19. PC Computation int pc= [ picode == ICALL : pValC; picode == IJXX && pBch : pValC; Picode == IRET : pValM; 1 : pValP; ];

  20. Naïve Pipelined Implementation

  21. Outline • Naïve PIPE Implementation • Pipeline Hazards • Suggested Reading 4.5.2 ~ 4.5.5

  22. Pipeline Stages • Fetch • Select current PC • Read instruction • Compute incremented PC • Decode • Read program registers • Execute • Operate ALU • Memory • Read or write data memory • Write Back • Update register file

  23. PIPE- Hardware • Pipeline registers hold intermediate values from instruction execution • Forward (Upward) Paths • Values passed from one stage to next • Cannot jump past stages • e.g., valC passes through decode

  24. Feedback Paths • Predicted PC • Guess value of next PC • Branch information • Jump taken/not-taken • Fall-through or target address • Return point • Read from memory • Register updates • To register file write ports

  25. Predicting the PC • Start fetch of new instruction after current one has completed fetch stage • Not enough time to reliably determine next instruction • Guess which instruction will follow • Recover if prediction was incorrect

  26. Predicting the PC M_valP

  27. Our Prediction Strategy • Instructions that Don’t Transfer Control • Predict next PC to be valP • Always reliable • Call and Unconditional Jumps • Predict next PC to be valC (destination) • Always reliable

  28. Our Prediction Strategy • Conditional Jumps • Predict next PC to be valC (destination) • Only correct if branch is taken • Typically right 60% of time • Recovery: M_Cnd and M_valA (valP: next PC) • Return Instruction • Don’t try to predict

  29. Select PC Int F_predPC = [ f_icode in {IJXX, ICALL} : f_valC; 1: f_valP; ];

  30. Recovering from PC Misprediction • Mispredicted Jump • Will see branch flag once instruction reaches Memory stage • Can get fall-through PC from valA (valP) • Return Instruction • Will get return PC when ret reaches write-back stage

  31. Select PC int f_PC = [ #mispredicted branch. Fetch at incremented PC M_icode == IJXX && !M_Cnd : M_valA; #completion of RET instruciton W_icode == IRET : W_valM; #default: Use predicted value of PC 1: F_predPC ];

  32. F D E M W I1 I4 I3 I2 I5 F D E M W F D E M W F D E M W Pipeline Demonstration 1 2 3 4 5 6 7 8 9 irmovl $1,%eax #I1 irmovl $2,%ecx #I2 irmovl $3,%edx #I3 irmovl $4,%ebx #I4 halt #I5 F D E M W F D E M W Cycle 5

More Related