SetBufferLen

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

Atlas inference product AI Core

Atlas inference product Vector Core

Atlas training product

Function Usage

Sets the buffer length. When calling the operator[] function to create a new LocalTensor, you are advised to call this API to set the length of the new LocalTensor so that the compiler can automatically optimize memory and synchronization.

Prototype

1
__aicore__ inline void SetBufferLen(uint32_t dataLen)

Parameters

Table 1 Parameters

Parameter

Input/Output

Description

dataLen

Input

Number of elements in the buffer.

Returns

None

Restrictions

None

Examples

1
2
3
// Example: Use SetBufferLen to change the length of the requested tensor to 1024 bytes.
AscendC::LocalTensor<float> tmpBuffer2 = tempBmm2Queue.AllocTensor<float>();
tmpBuffer2.SetBufferLen(1024);