acltdtAllocBuf

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

Atlas training product

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

1
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;

Currently, only ACL_TDT_NORMAL_MEM is supported.

buf

Output

Shared buffer to be output when the allocation is successful. For details about the type definition, see acltdtBuf.

Returns

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

Restrictions

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