简体   繁体   English

如何计算3级缓存的有效CPI

[英]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 CPU基数CPI = 2,时钟频率= 2GHz
  2. Primary Cache, Miss Rate/Instruction = 7% 主缓存,错失率/指令= 7%
  3. L-2 Cache access time = 15ns L-2缓存访问时间= 15ns
  4. L-2 Cache, Local Miss Rate/Instruction = 30% L-2缓存,本地丢失率/指令= 30%
  5. L-3 Cache access time = 30ns L-3缓存访问时间= 30ns
  6. L-3 Cache, Global Miss Rate/Instruction = 3%, Main memory access time = 150ns L-3高速缓存,全局丢失率/指令= 3%,主存储器访问时间= 150ns

What is the effective CPI ? 什么是有效的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 L1未命中罚分= L2的访问时间= 15ns /(1ns / 2cc)= 30个时钟周期
  • L2 miss penalty = Access time of L3 = 30ns / (1ns/2cc) = 60 clock cycles L2未命中罚分= L3的访问时间= 30ns /(1ns / 2cc)= 60个时钟周期
  • L3 miss penalty = Access time of MM = 150ns / (1ns/2cc) = 300 clock cycles L3未命中损失= MM的访问时间= 150ns /(1ns / 2cc)= 300个时钟周期

Now I need to calculate the effective CPI . 现在我需要计算有效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) CPI = BaseCPI +(%L1 MR / Instr * L1 Miss Misalty)+(%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 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. 在给我的导师发电子邮件后,因为班上没有人理解全球和地方的1-2分钟解释,我被告知我的答案很接近,但错了。 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. 我可以理解如何计算1级和2级缓存的有效CPI Making the jump to 3 confuses me. 跳到3会让我感到困惑。

What if it is like this : for a two level cache The effective CPI is: 如果是这样的话:对于两级缓存有效的CPI是:

CPi= CPI(normal)+MissRAteL1*MissPenaltyL2+GlobalMissRAte*TotalMissPenalty CPi = CPI(正常)+ 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 = 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).. CPI = 2 + 7%+ X60(7%/ 30%)×(60 + 30)+ 3%×(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. 如果我们假设我们将执行1,000,000条指令,给定您的主要缓存命中率,其中93%将会命中,只需要2CPI。 7%, or 70,000 will need to hit lower cache levels. 7%或70,000将需要达到较低的缓存级别。 Of that 70,000, 70% (49,000) will hit in L2 and require 15ns (or 30CPI). 在70,000中,70%(49,000)将达到L2并且需要15ns(或30CPI)。 That leaves 21,000 that need to come from L3 or lower. 这留下了21,000,需要来自L3或更低。 97% (20370) will hit in L3 and require 60CPI. 97%(20370)将在L3中命中并需要60CPI。 The remaining 630 will require memory access at 300CPI. 剩余的630将需要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. 因此,整个桩的总时钟为930,000 * 2 + 49,000 * 30 + 20370 * 60 + 630 * 300,总计4,741,200,根据指令数1,000,000,有效CPI为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? 它还假设,例如,在60个时钟的L2中的未命中罚分是整个惩罚 - 换句话说,在主要和L2中丢失并且必须从L3获取的访问仅花费60个时钟,或者它是否花费60个时钟时钟从L3获取它到L2然后另外30个时钟从L2到主要,然后是通常的2个时钟,在L2未命中总共92个时钟? 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.. 嘿伙计们,我也在242,我也不知道这是不对,但这就是我得到的......

    main miss penalty = 150ns/(1/2) = 300 cycles . 主要未命中罚分= 150ns /(1/2)= 300次循环。 L2 miss = 15 ns/(1/2) = 30 cycles. L2未命中= 15 ns /(1/2)= 30个周期。 L3 miss = 30 ns/(1/2)= 60 cycles . L3未命中= 30 ns /(1/2)= 60个周期。

    so the cpi = 2+(.07*300)+(.07*.3*30)+(.03*60) = 25.43 所以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 有效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. 他的回答是L1和L3是正确的,但我必须考虑L2的本地错失率。 Not sure what that means yet, but hope this little info helps 不确定这意味着什么,但希望这些小信息有所帮助

WCU problem, right? WCU问题吧? I have the same class. 我有同一个班级。

Check D2L. 检查D2L。 Pages 18-20 of the full Chapter 5 pdf that is provided. 提供完整的第5章pdf的第18-20页。 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. 他似乎暗示它是正确的,但这可能只是语言障碍的误解。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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