IAE Academy

GATE 2024 CS1 Q.56: solution and answer

GATE 2024 · CS1Q.56 · 2 marks · NAT

A given program has 25% load/store instructions. Suppose the ideal CPI (cycles per instruction) without any memory stalls is 2. The program exhibits 2% miss rate on instruction cache and 8% miss rate on data cache. The miss penalty is 100 cycles. The speedup (rounded off to two decimal places) achieved with a perfect cache (i.e., with NO data or instruction cache misses) is _______

See the question in the paper

Answer and solution

ANSWER

The speedup achieved with a perfect cache is .

Official answer: 3.00Source: Official answer key, GATE 2024 CS1 (IISc Bengaluru)

  1. CPI_ideal (with a perfect cache, i.e. no memory stalls at all) is given directly in the stem: .

  2. Instruction-cache stall cycles per instruction: every instruction must be fetched, so the instruction-cache miss rate applies to all instructions. cycles per instruction.

  3. Data-cache stall cycles per instruction: only load/store instructions access the data cache, so the data-cache miss rate is scaled by the load/store fraction. cycles per instruction.

  4. Real CPI (with the actual instruction and data caches, misses included) is the ideal CPI plus both stall contributions:

  5. Since the clock cycle time and the instruction count are unchanged between the real machine and the perfect-cache machine, execution time is proportional to CPI. So the speedup from a perfect cache is

KEY IDEA

Memory stall cycles per instruction are added on top of the ideal (memory-stall-free) CPI to get the real CPI; speedup from a perfect cache is the ratio of real CPI to ideal CPI, since clock rate and instruction count are unchanged.

WATCH OUT FOR

Applying the data-cache miss rate to every instruction instead of scaling it by the 25% load/store fraction (or forgetting to add both instruction-cache and data-cache stalls), which gives a wrong real CPI and hence a wrong speedup.

From the GATE 2024 CS1 paper. Every question of this paper · Download the full paper · All 22 Memory & cache questions, with notes

More Memory & cache questions