acltdtAllocBuf

Applicability

Product

Supported

Atlas A3 training products / Atlas A3 inference products

x

Atlas A2 training products / Atlas A2 inference products

x

Atlas 200I/500 A2 inference products

Atlas inference products

x

Atlas training products

x

Description

Allocates the shared buffer.

After the acltdtAllocBuf API is used to allocate a buffer, the length of the data area is the value of the size parameter. Before valid data is entered, the initial value of the valid data size of the buffer is 0. After valid data is entered into the buffer, set the valid data size by calling acltdtSetBufDataLen.

The buffer allocated by the acltdtAllocBuf call needs to be freed by the acltdtFreeBuf call.

Prototype

aclError acltdtAllocBuf(size_t size, uint32_t type, acltdtBuf *buf)

Parameters

Parameter

Input/Output

Description

size

Input

Memory size of a specified data area, in bytes. The value cannot exceed 4 GB.

type

Input

Type of the shared buffer. The options are as follows:

typedef enum {
    ACL_TDT_NORMAL_MEM = 0,
    ACL_TDT_DVPP_MEM
} acltdtAllocBufType;

buf

Output

Shared buffer to be output when the allocation is successful.

Returns

0 on success; else, failure. For details, see aclError.

Restrictions

  • For the Atlas 200I/500 A2 inference products , this API can be used only in the Ascend RC .

See Also

For details about the API call sequence and example, see Shared Buffer Management.