实现缓存建模框架 [英] Implementing a cache modeling framework

查看:26
本文介绍了实现缓存建模框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想对英特尔架构(LRU、包含、K-Way Associative 等)中的缓存行为进行建模.我阅读了维基百科、Ulrich Drepper 的关于内存的优秀论文,以及英特尔手册第 3A 卷:系统编程指南(第11章,但不是很有帮助,因为它们只解释了可以在软件级别进行操作的内容).我也读了一堆学术论文,但像往常一样,他们不会让他们的代码可用于复制......即使在要求之后也是如此.我的问题是,是否已经有一个公开可用的框架来模拟缓存行为?如果没有,是否有文件详细说明英特尔缓存在最深层次上的行为?我找不到.

解决方案

有很多缓存模拟器,(如果这是真的,为了准确性可能值得实施),但除此之外,我认为整体行为不应受到这些细节的太大影响, 用于任何实际用途.

I would like to model the behavior of caches in Intel architectures (LRU, inclusive, K-Way Associative, etc)., I've read wikipedia, Ulrich Drepper's great paper on memory, and the Intel Manual Volume 3A: System Programming Guide (chapter 11, but it's not very helpful, because they only explain what can be manipulated at the software level). I've also read a bunch of academic papers, but as usual, they do not make their code available for replication... even after asking for it. My question is, is there already a publicly available framework to model cache behavior? If not, is there a document detailing the behavior of caches from Intel at the deepest levels? I could not find one.

解决方案

There are plenty of cache simulators out there, Dinero for e.g. (pun obviously intended) should be fairly simple and is often used for educational purposes.
Note that this simulator is trace-driven, it means it feeds on a list of memory access addresses, it doesn't know how to run a binary. You can produce such traces by emulating them with binary instrumentation tools, for e.g.

etc.. Note that some of these offer internal cache simulators already, and may be possible to play with.

Other simulators can simulate full CPU/system behavior, not just caches, and can therefore support running a binary. Most of them include within them a simulated cache system. For e.g.:

and many others

On the other hand, writing your own cache simulator is fairly simple - if you can work on a memory trace (writing an actual fronend is way more complicated). You won't be able to get a too detailed spec on actual caches in Intel/AMD products, but the basic functionality is detailed in any computer architecture textbook or even wikipedia, the parameters (size, associativity, coherency policies) are mostly documented in the published guides, and may often change between product generations. You can always ask here if you encounter any specific question :)

Edit:

Regarding the second part of the question - there's no publicly available documentation of the exact cache implementation of Intel CPUs, but the dry "specs" (size, associativity, policies) are in the optimization guide: Now, modeling these caches should be straightforward, but there may be some hidden caveats, like powerdown features or specialized LRU behaviors. One such reported example can be found here - http://blog.stuffedcow.net/2013/01/ivb-cache-replacement/ (if this is true, it might be worth implementing for accuracy), but aside from that I believe the overall behavior shouldn't be affected by these details too much, for any practical use.

这篇关于实现缓存建模框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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