Data format conversion, generally used to convert NCHW format to NC1HWC0 format. In particular, it can also be used for two-dimensional matrix data block transposition. This interface can process 512 Bytes of data (16 DataBlocks) within a single Repeat. Depending on the data type, it supports matrix transposition of different shapes (for example, when the data type is half, a single Repeat can complete a 16*16 matrix transposition), and it also supports multiple Repeat operations.
The conversion rules within a single repeat are as follows:
When the input data type bit width is 16-bit, each DataBlock contains 16 numbers. The instruction internally loops 16 times, and each loop takes values from the corresponding positions in the specified 16 DataBlocks to form a new DataBlock unit and places it in the destination address. As shown in the figure below, srcList[0]-srcList[15] in the figure represent the 16 DataBlocks of the source operand.
When the data type bit width is 32-bit, each DataBlock contains 8 numbers. The instruction internally loops 8 times, and each loop takes values from the corresponding positions in the specified 16 DataBlocks to form 2 new DataBlocks and places them in the destination address. As shown in the figure below:
-When the data type bit width is 8-bit, each DataBlock contains 32 numbers. The instruction internally loops 16 times, and each loop takes values from the corresponding positions in the specified 16 DataBlocks to form half a DataBlock and places it in the destination address. Whether the read and store are in the high half or low half of the DataBlock is determined by the parameters srcHighHalf and dstHighHalf. As shown in the figure below:
Based on the above conversion rules, this interface is used for NC1HWC0 format conversion or matrix transposition. NC1HWC0 format conversion is relatively complex, and the specific conversion method is given here:
When converting NCHW format to NC1HWC0 format, if the data type bit width is 32-bit or 16-bit, then C0=16; if the data type bit width is 8-bit, then C0=32. The following figure uses C0=16 as an example for illustration:
None
PIPE_TYPE_V
- For operand address alignment constraints, refer to .
- For operand address overlap constraints, refer to .
- When converting NCHW format to NC1HWC0 format, the typical usage is to configure each element in src/dst as the starting point of each HW plane.
- For better performance, when the data type bit width is 8-bit, it is recommended to first fix dst_high_half/src_high_half, then Repeat in the HW direction, and then change dst_high_half/src_high_half.