计算3级缓存的实际/有效CPI [英] Calculating actual/effective CPI for 3 level cache

查看:178
本文介绍了计算3级缓存的实际/有效CPI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

(a)您将获得一个具有两级缓存(L1和L2)的内存系统。规格如下:

(a) You are given a memory system that has two levels of cache (L1 and L2). Following are the specifications:


  • L1缓存的命中时间:2个时钟周期

  • 命中率L1高速缓存:92%

  • 对L2高速缓存未命中的罚款(L2的命中时间):8个时钟周期

  • L2高速缓存命中率:86%

  • 对主存储器的错失惩罚:37个时钟周期

  • 假设当前主存储器的命中率为100%。

  • Hit time of L1 cache: 2 clock cycles
  • Hit rate of L1 cache: 92%
  • Miss penalty to L2 cache (hit time of L2): 8 clock cycles
  • Hit rate of L2 cache: 86%
  • Miss penalty to main memory: 37 clock cycles
  • Assume for the moment that hit rate of main memory is 100%.

给出一个2000指令程序,该指令程序具有37%的数据传输指令(加载/存储),请计算此情况下的CPI(每个指令的时钟周期)。

Given a 2000 instruction program with 37% data transfer instructions (loads/stores), calculate the CPI (Clock Cycles per Instruction) for this scenario.

For this part, I calculated it like this (am I doing this right?):

(m1: miss rate of L1, m2: miss rate of L2)

AMAT = HitTime_L1 + m1*(HitTime_L2 + m2*MissPenalty_L2)
CPI(actual) = CPI(ideal) + (AMAT - CPI(ideal))*AverageMemoryAccess

(b)现在让我们添加另一级缓存,即L2高速缓存和主内存之间的L3高速缓存。请考虑以下情况:

(b) Now lets add another level of cache, i.e., L3 cache between the L2 cache and the main memory. Consider the following:


  • 对L3缓存的错罚(L3缓存的命中时间):13个时钟周期

  • L3缓存的命中率:81%

  • 对主存储器的错失惩罚:37个时钟周期

  • 其他规格仍作为(a)部分

  • Miss penalty to L3 cache (hit time of L3 cache): 13 clock cycles
  • Hit rate of L3 cache: 81%
  • Miss penalty to main memory: 37 clock cycles
  • Other specifications remain as part (a)

对于相同的2000指令程序(具有37%的数据传输指令),请计算CPI。

For the same 2000 instruction program (which has 37% data transfer instructions), calculate the CPI.

(m1: miss rate of L1, m2: miss rate of L2, m3: miss rate of L3)

AMAT = HitTime_L1 
         + m1*(HitTime_L2 + m2*MissPenalty_L2)
           + m2*(HitTime_L3 + m3*MissPenalty_L3)

此公式正确吗,在此公式中我应在哪里向主存储器添加未命中罚款?
应该加上L3的罚分,但我不确定。

Is this formula correct and where do I add the miss penalty to main memory in this formula? It should probably be added with the miss penalty of L3 but I am not sure.

推荐答案

(a)如果您注意到MissPenalty_L2参数就是您所说的对主内存的小姐罚款,那么AMAT计算是正确的。

(a) The AMAT calculation is correct if you notice that the MissPenalty_L2 parameter is what you called Miss penalty to main memory.

CPI有点困难。
首先,让我们假设CPU没有流水线化(顺序处理器)。

The CPI is a bit more difficult. First of all, let's assume that the CPU is not pipelined (sequential processor).

每条指令有1.37个内存访问(一次访问可获取指令)和0.37(根据数据传输说明)。理想的情况是L1缓存中命中所有内存。
因此,知道:

There are 1.37 memory accesses per instruction (one access to fetch the instruction and 0.37 due to data transfer instructions). The ideal case is that all memory acceses hit in the L1 cache. So, knowing that:

CPI(ideal) = CPI(computation) + CPI(mem) = 
             CPI(computation) + Memory_Accesses_per_Instruction*HitTime_L1 =
             CPI(computation) + 1.37*HitTime_L1

对于实内存,平均内存访问时间为AMAT,因此:

With real memory, the average memory access time is AMAT, so:

CPI(actual) = CPI(computation) + Memory_Accesses_per_Instruction*AMAT =
              CPI(ideal) + Memory_Accesses_per_Instruction*(AMAT - HitTime_L1) =
              CPI(ideal) + 1.37*(AMAT - HitTime_L1)

(b)您的AMAT计算错误。在L2丢失后,它跟随L3访问,可能是命中或未命中。尝试自己完成练习。

(b) Your AMAT calculation is wrong. After a miss at L2, it follows a L3 access that can be a hit or a miss. Try to finish the exercise yourself.

这篇关于计算3级缓存的实际/有效CPI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆