简体   繁体   中英

How to calculate effective CPI for a 3 level cache

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.

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)..

It might help to think about it from a different direction. If we assume we are going to execute 1,000,000 instructions, given your primary cache hit rate, 93% of those will hit and only require 2CPI. 7%, or 70,000 will need to hit lower cache levels. Of that 70,000, 70% (49,000) will hit in L2 and require 15ns (or 30CPI). That leaves 21,000 that need to come from L3 or lower. 97% (20370) will hit in L3 and require 60CPI. The remaining 630 will require memory access at 300CPI.

So the total clocks for the whole pile is 930,000 * 2 + 49,000 * 30 + 20370 * 60 + 630 * 300, which is a total of 4,741,200, which, given the instruction count of 1,000,000, gives an effective CPI of 4.7412.

That may still not be right, as I'm not entirely sure what the difference between the global/local miss rate is in this particular question, and how to apply it here, but this at least shows a different approach to help understand the question. It also assumes that, for example, the miss penalty in L2 of 60 clocks is the entire penalty - in other words, does an access that misses in primary and L2 and has to fetch from L3 take only 60 clocks, or does it take 60 clocks to fetch it from L3 into L2 and then an additional 30 clocks to get it from L2 into primary, and then the usual 2 clocks, for a total of 92 clocks on an L2 miss? Perhaps that's the distinction between local/global?

  • Hey guys, I'm in 242 also, i don't know if this is right either but this is what i got..

    main miss penalty = 150ns/(1/2) = 300 cycles . L2 miss = 15 ns/(1/2) = 30 cycles. L3 miss = 30 ns/(1/2)= 60 cycles .

    so the cpi = 2+(.07*300)+(.07*.3*30)+(.03*60) = 25.43

Hey so I emailed him asking about this solution

Effective CPI = 2.0 + .07 x 30 + .30 x 60 + .03 x 300 = 31.1

and his response was that L1 and L3 were correct but that I had to take into account the local miss rate for L2. Not sure what that means yet, but hope this little info helps

WCU problem, right? I have the same class.

Check D2L. Pages 18-20 of the full Chapter 5 pdf that is provided. The required textbook Computer Organization and Design goes into pretty good detail about these kinds of problems. From a quick glance, I think you may be doing a few incorrect operations. Correct numbers...wrong operations. I'm working on the problem myself. I shall post here if I find my answer

After talking the professor, he said that this formula is right, but told me that he could not tell me if the answer was correct or not. He seemed to be hinting at it being correct, but it could just be a language barrier misunderstanding.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM