Pipeline Performance CPI of a Pipeline Processor Nsegment

  • Slides: 6
Download presentation
Pipeline Performance

Pipeline Performance

CPI of a Pipeline Processor • N-segment pipeline processes M instructions without stalls or

CPI of a Pipeline Processor • N-segment pipeline processes M instructions without stalls or penalties. • It takes N-1 cycles to load (setup) the pipeline • M cycles to complete the instructions. • Thus, the number of cycles is given by: • Ncyc = N + M - 1. • The cycles per instruction are easily computed: • CPI = Ncyc/M = 1 + (N - 1)/M

Effect of Stalls • Suppose that we have a N-segment pipeline processing M instructions,

Effect of Stalls • Suppose that we have a N-segment pipeline processing M instructions, and we must insert K stalls to resolve data dependencies. • This means that the pipeline now has a setup penalty of N-1 cycles, as before, a stall penalty of K cycles, and a processing cost (as before) of M cycles to process the M instructions. Thus, our governing equations become: • Ncyc = N + M + K - 1. • CPI = Ncyc/M = 1 + (N + K - 1)/M.

Effect of Stalls • Suppose that an N-segment pipeline executes M instructions, and that

Effect of Stalls • Suppose that an N-segment pipeline executes M instructions, and that a fraction fstall of the instructions require the insertion of K stalls per instruction to resolve data dependencies. • The total number of stalls is given by fstall · M · K (fraction of instructions that are stalls, times the total number of instructions, times the average number of stalls per instruction). • The pipeline performance becomes: • Ncyc = N + M + (fstall · M · K) - 1. • CPI = Ncyc/M = 1 + (fstall · K) + (N - 1)/M.

Effect of Exceptions • Assume that we have M instructions executing on an N-segment

Effect of Exceptions • Assume that we have M instructions executing on an N-segment pipeline with no stalls, but that a fraction fex of the instructions raise an exception in the EX stage. Further assume that each exception requires that (a) the pipeline segments before the EX stage be flushed, (b) that the exception be handled, requiring an average of H cycles per exception, then that (c) the instruction causing the exception and its following instructions be reloaded into the pipeline. • Thus, fex · M instructions will cause exceptions.

Effect of Exceptions • In the MIPS pipeline, each of these instructions causes three

Effect of Exceptions • In the MIPS pipeline, each of these instructions causes three instructions to be flushed out of the pipe (IF, ID, and EX stages), which incurs a penalty of four cycles (one cycle to flush, and three to reload) plus H cycles to handle the exception. Thus, the pipeline performance equations become: • Ncyc = N - 1 + (1 - fex) · M + (fex · M · (H + 4)) , • which we can rewrite as • Ncyc = M + [N - 1 - M + (1 - fex) · M + (fex · M · (H + 4))]. • Rearranging terms, the equation for CPI can be expressed as • CPI = Ncyc/M = 1 + [1 - fex + (fex · (H+4)) - 1 + (N - 1)/M]. • After combining terms, this becomes: • CPI = Ncyc/M = 1 + [(fex · (H+3)) + (N - 1)/M].