SetTensorB

功能说明

设置矩阵乘的右矩阵B。

函数原型

__aicore__ inline void SetTensorB(const GlobalTensor<SrcT>& gm, bool isTransposeB = false);

__aicore__ inline void SetTensorB(const LocalTensor<SrcT>& rightMatrix, bool isTransposeB = false);

参数说明

表1 参数说明

参数名

输入/输出

描述

gm

输入

B矩阵在Global Memory上的首地址。

Atlas推理系列产品AI Core,支持的数据类型为:half

Atlas A2训练系列产品,支持的数据类型为:half/float/bfloat16_t/int8_t

rightMatrix

输入

B矩阵在TSCM上的首地址或者在VECCALC上的首地址。

Atlas推理系列产品AI Core,支持的数据类型为:half

Atlas A2训练系列产品,支持的数据类型为:half/float/bfloat16_t/int8_t

  • 若设置TSCM首地址,默认矩阵可全载,已经位于TSCM,Iterate接口无需再进行GM->A1/B1搬运。
  • 若设置VECCALC首地址,

    针对Atlas A2训练系列产品:Iterate通路为VECCALC->GM->A1/B1,不进行格式转换。

isTransposeB

输入

B矩阵是否需要转置。

注意:若B矩阵MatmulType ISTRANS参数设置为true,此参数可以为true也可以为false,即运行时可以转置和非转置交替使用;

若B矩阵MatmulType ISTRANS参数设置为false,此参数只能设置为false,若强行设置为true,精度会有异常。

返回值

支持的型号

Atlas A2训练系列产品

Atlas推理系列产品AI Core

注意事项

传入的TensorB地址空间大小需要保证不小于singleK * singleN。