BinaryRepeatParams
BinaryRepeatParams为用于控制操作数地址步长的数据结构。结构体内包含操作数相邻迭代间相同block的地址步长,操作数同一迭代内不同block的地址步长等参数。
相邻迭代间的地址步长参数说明请参考Repeat stride(相邻迭代间相同datablock的地址步长);同一迭代内datablock的地址步长参数说明请参考Block stride(同一迭代内不同datablock的地址步长)。
结构体具体定义为:
const int32_t DEFAULT_BLK_NUM = 8; const int32_t DEFAULT_BLK_STRIDE = 1; const uint8_t DEFAULT_REPEAT_STRIDE = 8; struct BinaryRepeatParams { __aicore__ BinaryRepeatParams() { blockNumber = DEFAULT_BLK_NUM; dstBlkStride = DEFAULT_BLK_STRIDE; src0BlkStride = DEFAULT_BLK_STRIDE; src1BlkStride = DEFAULT_BLK_STRIDE; dstRepStride = DEFAULT_REPEAT_STRIDE; src0RepStride = DEFAULT_REPEAT_STRIDE; src1RepStride = DEFAULT_REPEAT_STRIDE; } __aicore__ BinaryRepeatParams(const uint8_t dstBlkStrideIn, const uint8_t src0BlkStrideIn, const uint8_t src1BlkStrideIn, const uint8_t dstRepStrideIn, const uint8_t src0RepStrideIn, const uint8_t src1RepStrideIn) { dstBlkStride = dstBlkStrideIn; src0BlkStride = src0BlkStrideIn; src1BlkStride = src1BlkStrideIn; dstRepStride = dstRepStrideIn; src0RepStride = src0RepStrideIn; src1RepStride = src1RepStrideIn; } uint32_t blockNumber = 0; uint8_t dstBlkStride = 0; uint8_t src0BlkStride = 0; uint8_t src1BlkStride = 0; uint8_t dstRepStride = 0; uint8_t src0RepStride = 0; uint8_t src1RepStride = 0; bool repeatStrideMode = false; bool strideSizeMode = false; };
其中,blockNumber,repeatStrideMode和strideSizeMode 为保留参数,用户无需关心,使用默认值即可。用户需要自行定义Block stride参数,包含dstBlkStride,src0BlkStride和src1BlkStride,以及Repeat stride参数,包含dstRepStride,src0RepStride和src1RepStride。
父主题: 基础数据结构