UnaryRepeatParams
UnaryRepeatParams为用于控制操作数地址步长的数据结构。结构体内包含操作数相邻迭代间相同datablock的地址步长,操作数同一迭代内不同datablock的地址步长等参数。
相邻迭代间的地址步长参数说明请参考repeatStride(相邻迭代间相同datablock的地址步长);同一迭代内datablock的地址步长参数说明请参考dataBlockStride(同一迭代内不同datablock的地址步长)。
结构体具体定义为:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
const int32_t DEFAULT_BLK_NUM = 8; const int32_t DEFAULT_BLK_STRIDE = 1; const uint8_t DEFAULT_REPEAT_STRIDE = 8; struct UnaryRepeatParams { __aicore__ UnaryRepeatParams() { blockNumber = DEFAULT_BLK_NUM; dstBlkStride = DEFAULT_BLK_STRIDE; srcBlkStride = DEFAULT_BLK_STRIDE; dstRepStride = DEFAULT_REPEAT_STRIDE; srcRepStride = DEFAULT_REPEAT_STRIDE; halfBlock = false; } __aicore__ UnaryRepeatParams(const uint16_t dstBlkStrideIn, const uint16_t srcBlkStrideIn, const uint8_t dstRepStrideIn, const uint8_t srcRepStrideIn) { dstBlkStride = dstBlkStrideIn; srcBlkStride = srcBlkStrideIn; dstRepStride = dstRepStrideIn; srcRepStride = srcRepStrideIn; } __aicore__ UnaryRepeatParams(const uint16_t dstBlkStrideIn, const uint16_t srcBlkStrideIn, const uint8_t dstRepStrideIn, const uint8_t srcRepStrideIn, const bool halfBlockIn) { dstBlkStride = dstBlkStrideIn; srcBlkStride = srcBlkStrideIn; dstRepStride = dstRepStrideIn; srcRepStride = srcRepStrideIn; halfBlock = halfBlockIn; } uint32_t blockNumber = 0; uint16_t dstBlkStride = 0; uint16_t srcBlkStride = 0; uint8_t dstRepStride = 0; uint8_t srcRepStride = 0; bool repeatStrideMode = false; bool strideSizeMode = false; bool halfBlock = false; }; |
其中,blockNumber,repeatStrideMode,strideSizeMode为保留参数,用户无需关心,使用默认值即可。halfBlock表示CastDeq指令的结果写入对应UB的上半(halfBlock = true)还是下半(halfBlock = false)部分。用户需要自行定义dataBlockStride参数,包含dstBlkStride,srcBlkStride,以及repeatStride参数,包含dstRepStride,srcRepStride。
父主题: 数据类型定义