How to calculate effective CPI for a 3 level cache

user2990107 picture user2990107 · Nov 25, 2013 · Viewed 13k times · Source

I am hopelessly stuck on a homework problem, and I would love some help understanding it better. Here is what I was given:

  1. CPU base CPI = 2, clock rate = 2GHz
  2. Primary Cache, Miss Rate/Instruction = 7%
  3. L-2 Cache access time = 15ns
  4. L-2 Cache, Local Miss Rate/Instruction = 30%
  5. L-3 Cache access time = 30ns
  6. L-3 Cache, Global Miss Rate/Instruction = 3%, Main memory access time = 150ns

What is the effective CPI?

It is my understanding that I need to calculate the miss penalty for each cache level.

  • L1 miss penalty = Access time of L2 = 15ns / (1ns/2cc) = 30 clock cycles
  • L2 miss penalty = Access time of L3 = 30ns / (1ns/2cc) = 60 clock cycles
  • L3 miss penalty = Access time of MM = 150ns / (1ns/2cc) = 300 clock cycles

Now I need to calculate the effective CPI. This is where I am a bit confused.

I believe the formula should be:

CPI = BaseCPI + (%L1 MR/Instr * L1 Miss Penalty) + (%L1 MR/Instr * %L2 MR/Instr * L2 Miss Penalty) + (%Global MR/Instr * L3 Miss Penalty)

If I do this, I get

CPI = 2.0 + (0.07 * 30) + (0.07 * 0.3 * 60) + (0.03 * 300) = 14.36


After emailing my instructor because no one in the class understood the 1-2 minute explanation of global and local, I was told that my answer is close, but wrong. If anyone could provide some insight, or even point me towards a good tutorial, I would be grateful. I can understand how to figure out effective CPI for 1 and 2 level caches. Making the jump to 3 confuses me.

Answer

AnnaC picture AnnaC · Aug 25, 2016

What if it is like this : for a two level cache The effective CPI is:

CPi= CPI(normal)+MissRAteL1*MissPenaltyL2+GlobalMissRAte*TotalMissPenalty

then for three level cache it might be:

CPI=CPI+MissRateL1*MissPenaltyL2+(MISSRATEL2/MissRAteL1)(MissPEnaltyL1+MissPEnaltyL2)+GlobalMissRate(MissPEnaltyL1+MissPEnaltyL2+MissPEnaltyL3)

CPI=2+7%x60+(7%/30%)x(60+30)+3%x(300+60+90)..