acldvppMalloc

Applicability

Product

Supported

Atlas A3 training products / Atlas A3 inference products

Atlas A2 training products / Atlas A2 inference products

Atlas 200I/500 A2 inference products

Atlas inference products

Atlas training products

Description

Allocates device memory for media processing. The allocated huge page memory meets the data processing requirements (for example, the start address is 128-byte aligned).

Restrictions

  • After this API is called to allocate memory, the acldvppFree API must be called to free the memory if the memory is not used.
  • Performance deterioration will be caused by too frequent calls to acldvppMalloc and acldvppFree. You are advised to allocate or manage memory in advance to avoid unnecessary memory allocation and deallocation.
  • The allocation size is the input size rounded up to the nearest multiple of 32, plus 32 bytes.
  • When the output of media data processing is used as the input of model inference, if you use this API to allocate a large memory block and divide and manage the memory, each memory segment must meet the following requirements:
    • The memory size is rounded up to an integral multiple of 32 + 32 bytes (m=ALIGN_UP[len,32]+32 bytes).

      len indicates the size of a memory segment. ALIGN_UP[len,k] indicates rounding up to a multiple of k bytes as in this formula: ((len – 1)/k + 1) × k.

    • The memory start address must be 128-byte-aligned (ALIGN_UP[m, 128]).
  • If memory allocation by this API call fails, it only indicates that available huge memory is insufficient. Before using huge page memory, you can call aclrtGetMemInfo to query free huge page memory.
  • Media data processing can access a maximum of 16 GB address space in each process.

    This restriction applies to the following products:

    Atlas A3 training products / Atlas A3 inference products

    Atlas A2 training products / Atlas A2 inference products

    Atlas inference products

Prototype

aclError acldvppMalloc(void **devPtr, size_t size)

Parameters

Parameter

Input/Output

Description

devPtr

Output

Pointer to the pointer to the allocated device memory.

size

Input

Requested allocation size in bytes.

Returns

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

See Also

For details about the API call sequence and example, see DVPP Image/Video Processing (V1).