ReadSpmBuffer

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product/Atlas A3 inference product

Atlas A2 training product/Atlas A2 inference product

Atlas 200I/500 A2 inference product

x

Atlas inference product AI Core

Atlas inference product Vector Core

x

Atlas training product

Function Usage

Reads data from the SPM buffer back to the local data.

Prototype

  • Applicable to continuous and discontinuous data readback:
    1
    2
    template <typename T>
    __aicore__ inline void ReadSpmBuffer(const LocalTensor<T>& readBuffer, const DataCopyParams& copyParams, int32_t readOffset = 0)
    
  • Applicable to continuous temporary data readback:
    1
    2
    template <typename T>
    __aicore__ inline void ReadSpmBuffer(const LocalTensor<T>& readBuffer, const int32_t readSize, int32_t readOffset = 0)
    

Parameters

Table 1 API parameters

Parameter

Input/Output

Meaning

readBuffer

Input

Readback target local memory.

copyParams

Input

Movement parameter, DataCopyParams type. For details about the structure definition of DataCopyParams, see Table 2.

readSize

Input

Number of read elements.

readOffset

Input

Offset of the SPM buffer, in bytes.

Table 2 Parameters in the DataCopyParams structure

Parameter

Description

blockCount

Number of data chunks to be transferred, which is of the uint16_t type. The value range is [1, 4095].

blockLen

Length of each data chunk to be transferred, in the unit of a data block (32 bytes). The value is of the uint16_t type. The value range is [1, 65535].

Notes:

  • When dst is located in C2PIPE2GM, the unit is 128 bytes.
  • Generally, dst in C2 indicates the length of a data chunk in the source operand. The unit is 64 bytes. For the Atlas 350 Accelerator Card, dst in C2 indicates the length of a data chunk in the source operand. The unit is 32 bytes.

srcGap

Gap between adjacent data chunks of the source operand (the distance from the tail of one data chunk to the head of the next). The unit is a data block (32 bytes). The value is of the uint16_t type and must not exceed the value range of this data type.

In the scenario of L1 Buffer -> Fixpipe Buffer, srcGap refers to the gap between adjacent data chunks of the source operand (the distance from the head of one data chunk to the head of the next). The unit is a data block (32 bytes). The value is of the uint16_t type and must not exceed the value range of this data type.

dstGap

Gap between adjacent data chunks of the destination operand (the distance from the tail of one data chunk to the head of the next). The unit is a data block (32 bytes). The value is of the uint16_t type and must not exceed the value range of this data type.

Notes:

  • When dst is located in C2PIPE2GM, the unit is 128 bytes.
  • Generally, dst in C2 indicates the length of a data chunk in the source operand. The unit is 64 bytes. For the Atlas 350 Accelerator Card, dst in C2 indicates the length of a data chunk in the source operand. The unit is 32 bytes.

In the scenario of L1 Buffer -> Fixpipe Buffer, dstGap refers to the gap between adjacent data chunks of the source operand (the distance from the head of one data chunk to the head of the next). The unit is a data block (32 bytes). The value is of the uint16_t type and must not exceed the value range of this data type.

Constraints

None

Returns

None

Example

For details about the calling example, see Example.