您当前的位置: 首页 > 

FPGA硅农

暂无认证

  • 2浏览

    0关注

    282博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

谷歌TPU分析之脉动阵列

FPGA硅农 发布时间:2020-11-06 21:43:27 ,浏览量:2

在之前的博客中,介绍了一种使用脉动阵列计算矩阵乘法的方法,在那篇博客中,脉动阵列的主要特点是:数据从左向右流动,而权重则从上向下流动。而在谷歌第一代的TPU中,其脉动阵列却并非是这种形式的。 在谷歌的TPU中,权重是预先存储在 P x ∗ P y P_x*P_y Px​∗Py​个PE上的,并且整个计算过程权重都保持不动,即weight stationary,而数据自左向右流动,同时,每个PE单元的部分和则自上而下流动,下面是一个具体的计算过程演示: 在这里插入图片描述 c++模拟代码:

#include
#include
#include
#include
#define M 4
#define N 4
using namespace std;
typedef int dtype;
struct PE{
   dtype weight;
   dtype feature;
   dtype psum;
};

class Systolic{
public:
    PE pe_arr[M][N];
public:
    void Init(){                  //初始化,psum置0
        for(int i=0;i            
关注
打赏
1658642721
查看更多评论
0.0395s