GATE / CS ARCHIVE

GATE CSE 2000 / QUESTION 12(b)

Pipeline average with conditional branches

Computer Organization & Architecture · Pipelining & Hazards · Full GATE CSE 2000 paper

GATE 2000, Q12(b) Descriptive
Report issue

Pipelining & Hazards

Question 12(b), GATE 2000: An ideal five-stage pipeline has stage time 2 ns; every instruction uses all five stages. For a nonoverlapped branch, the following instruction is not fetched until the branch completes. Branches are 20% of all executed instructions. Compute steady-state average time, ignoring finite-stream fill/drain overhead. Of the branch instructions, 80% are conditional; half of those are taken. For a not-taken conditional branch the following instructions may overlap.

Task: Find the revised average instruction execution time.
Question 12(b), GATE 2000: An ideal five-stage pipeline has stage time 2 ns; every instruction uses all five stages. For a nonoverlapped branch, the following instruction is not fetched until the branch completes. Branches are 20% of all executed instructions. Compute steady-state average time, ignoring finite-stream fill/drain overhead. Of the branch instructions, 80% are conditional; half of those are taken. For a not-taken conditional branch the following instructions may overlap.

Task: Find the revised average instruction execution time.
Question 12(b), GATE 2000: An ideal five-stage pipeline has stage time 2 ns; every instruction uses all five stages. For a nonoverlapped branch, the following instruction is not fetched until the branch completes. Branches are 20% of all executed instructions. Compute steady-state average time, ignoring finite-stream fill/drain overhead. Of the branch instructions, 80% are conditional; half of those are taken. For a not-taken conditional branch the following instructions may overlap.

Task: Find the revised average instruction execution time.
Question 12(b), GATE 2000: An ideal five-stage pipeline has stage time 2 ns; every instruction uses all five stages. For a nonoverlapped branch, the following instruction is not fetched until the branch completes. Branches are 20% of all executed instructions. Compute steady-state average time, ignoring finite-stream fill/drain overhead. Of the branch instructions, 80% are conditional; half of those are taken. For a not-taken conditional branch the following instructions may overlap.

Task: Find the revised average instruction execution time.
Tap to enlarge
Shared context

An ideal five-stage pipeline has stage time 2 ns; every instruction uses all five stages. For a nonoverlapped branch, the following instruction is not fetched until the branch completes. Branches are 20% of all executed instructions. Compute steady-state average time, ignoring finite-stream fill/drain overhead. Of the branch instructions, 80% are conditional; half of those are taken. For a not-taken conditional branch the following instructions may overlap.

Answer & solution

Answer: 2.96 ns per instruction (CPI 1.48). (no official key was published)

1. Within the branch population, 20% are unconditional and always impose the no-overlap rule. Another 80%×50%=40% are taken conditional branches. Thus 60% of branches impose the four-cycle penalty.

2. As branches are 20% of all instructions, the fraction of all instructions causing the penalty is 0.20×0.60=0.12. The remaining 0.88 do not interrupt ideal overlap under the stated model.

3. Average CPI is 1+0.12×4=1.48, giving 1.48×2=2.96 ns. Equivalently 0.88×2+0.12×10=2.96 ns.

4. The 50% figure applies only to conditional branches, not to every branch. Ignoring the unconditional 20% of branches would incorrectly reduce the answer to 2.64 ns. No branch prediction or extra recovery penalty is introduced beyond the assumptions given.

Original paper, page 8