acldvppMalloc
Applicability
|
Product |
Supported |
|---|---|
|
Atlas 350 Accelerator Card |
☓ |
|
|
√ |
|
|
√ |
|
|
√ |
|
|
√ |
|
|
√ |
Function 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 interface is invoked to apply for memory, if the memory is not used, invoke the acldvppFree interface to release the memory in a timely manner.
- If the acldvppMalloc interface is frequently called to apply for memory and the acldvppFree interface is frequently called to release memory, the performance is affected. You are advised to perform memory pre-allocation or secondary management in advance to avoid frequent memory application and release.
- 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 the nearest multiple of 32 plus 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]).
- The memory size is rounded up to the nearest multiple of 32 plus 32 bytes (m = ALIGN_UP[len,32] + 32 bytes).
- 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 the aclrtGetMemInfo API to query the 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 product /Atlas A3 inference product Atlas A2 training product /Atlas A2 inference product Atlas inference product
Prototype
1
|
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 |
Allocated memory size, in bytes. |
Returns
0 on success; otherwise, failure. For details, see aclError.