High-dimensional Sharding APIs

  • This section describes the high-dimensional tensor sharding compute APIs in the basic vector compute APIs. If you do not need to use such APIs, skip this section.
  • repeatTime, dataBlockStride, repeatStride, and mask in the following are general descriptions, and their names may not be the same as their parameter names in specific commands.

    For example, the data block stride (address stride between adjacent data blocks in a single iteration) refers to dstBlkStride and srcBlkStride in one-operand APIs, and dstBlkStride, src0BlkStride, and src1BlkStride in two-operand APIs.

    You can find the meaning of each parameter in the parameter description of a specific API.

Using high-dimensional tensor sharding compute APIs can make full use of hardware advantages and enable you to flexibly control the iteration execution of instructions and the address stride of operands.

Vector compute is implemented by the Vector Unit. The source and destination operands of vector compute are stored in the UB. In each iteration, the Vector Unit fetches eight data blocks (each data block has consecutive internal addresses, with a length of 32 bytes) from the UB for computation, and writes the computation results into the corresponding eight data blocks. The following figure shows the Exp computation of eight data blocks in a single iteration.

Figure 1 Exp computation of eight data blocks in a single iteration

The following describes the configurations of , , and mask and provides examples.

dataBlockStride

dataBlockStride refers to the address stride between adjacent data blocks in the same iteration.

repeatStride

repeatStride refers to the address stride of the same data block between adjacent iterations.

mask

The mask parameter controls the elements that participate in computation in each iteration. You can set this parameter in contiguous mode or bitwise mode.