RegTensor

功能说明

Reg矢量计算基本单元,RegTensor位宽为VL(Vector Length),具体值可能因不同AI处理器型号而异。

定义原型

1
template <typename T, const RegTrait& regTrait = RegTraitNumOne> struct RegTensor;

函数说明

模板参数T,支持的数据类型(宽度)为b8/b16/b32/b64。

数据类型宽度

数据类型

b8

Ascend 950PR/Ascend 950DT,支持的数据类型为:bool/int8_t/uint8_t/fp4x2_e2m1_t/fp4x2_e1m2_t/hifloat8_t/fp8_e5m2_t/fp8_e4m3fn_t/fp8_e8m0_t( fp4x2_e2m1_t/fp4x2_e1m2_t这两个b4类型在Vector侧的内存排布需要为两个一组,表现为b8类型;int4b_t也使用b8类型表达;bool数据类型只支持数据搬运)。

b16

Ascend 950PR/Ascend 950DT,支持的数据类型为:int16_t/uint16_t/half/bfloat16_t。

b32

Ascend 950PR/Ascend 950DT,支持的数据类型为:int32_t/uint32_t/float/complex32。

b64

Ascend 950PR/Ascend 950DT,支持的数据类型为:int64_t/uint64_t/complex64。

模板参数regTrait,表示该RegTensor类型内部包含的矢量Reg数量。regTrait为RegTraitNumOne时,该RegTensor类型中包含1个相应数据类型的矢量Reg,长度为VL。regTrait为RegTraitNumTwo时,该RegTensor类型中包含2个相应数据类型的矢量Reg,总长度为2 * VL,每个矢量Reg长度为VL。

模板参数regTrait

支持的数据类型宽度

RegTraitNumOne

Ascend 950PR/Ascend 950DT,支持的数据类型宽度为:b8/b16/b32/b64。

RegTraitNumTwo

Ascend 950PR/Ascend 950DT,支持的数据类型宽度为:b64/complex32。

支持的型号

Ascend 950PR/Ascend 950DT(VL=256B)

约束说明

无

调用示例