如何在gem5中配置矩阵乘法器

如何在gem5中配置矩阵乘法器

问题描述:

我们计划使用gem5模拟Google的Tensor处理单元(TPU).我们不确定在gem5上从哪里开始.我们已经按照学习文件夹中的所有教程进行了学习.首先,我们要实现矩阵乘法器.我们该怎么做?

We are planning to simulate google's Tensor processing unit(TPU) using gem5. We are not sure where to start with on gem5. We have followed all the tutorials in the learning folder. First, we want to implement matrix multiplier. How can we do that?

如果我正确理解,您想向gem5添加一个新设备,该设备会进行矩阵乘法.

If I understood correctly, you want to add a new device to gem5, that does matrix multiplication.

我还没有看到关于将设备添加到gem5的任何很好的教程.当我学习它时,我会写一个.

I have not seen any good tutorials on adding devices to gem5 yet. When I learn it, I will write one.

因此,最好的选择是查看现有的gem5源代码,在src/dev下查看,并尝试查找与您的设备最相似的设备.

So, your best bet is to have a look at existing gem5 source code, look under src/dev, and try to find the device that looks most similar to yours.

设备/gem5界面应该不会太难:基本上,您只需要了解如何执行以下操作即可:

The device / gem5 interface should not be too hard: you basically just have to understand how to do the following:

  • 注册
  • 中断
  • DMA

然后,我建议您使用以下方法进行测试:

Then, I recommend that you test those things out with:

  • 裸机程序. 这是一个可能的设置.这些使您可以跳过启动,这是一个巨大的胜利.
  • 一个Linux内核模块,当您感觉即将完成时可以实际运行内容
  • bare metal programs. Here is a possible setup. These will allow you to skip boot, which is a huge win.
  • a Linux kernel module, to actually run content, when you feel that you are almost done

也许您可以从有关QEMU的答案中得到一些启发:

Maybe you can get some inspiration from this related QEMU answer: How to add a new device in QEMU source code?