UnaryRepeatParams

UnaryRepeatParams is a data structure that controls the operand address strides. It contains such parameters as those that specify the address stride of the operand for the same data block between adjacent iterations and address stride of the operand between different data blocks in a single iteration.

For details about the address stride of the operand between adjacent iterations, see repeatStride. For details about the address stride of the operand between different data blocks in a single iteration, see dataBlockStride.

The specific definition of the structure is as follows:

 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, and strideSizeMode are reserved parameters. You can use the default values. halfBlock indicates that the result of the CastDeq instruction is written to the upper half (halfBlock = true) or the lower half (halfBlock = false) of the UB. You need to define the dataBlockStride parameters (including dstBlkStride and srcBlkStride) and define the repeatStride parameters (including dstRepStride and srcRepStride).