aclrtMallocCached

Description

Allocates size bytes of linear memory on the device and returns in *devPtr a pointer to the allocated memory. The allocated memory is cacheable.

The memory allocated by calling aclrtMallocCached is equivalent to the memory allocated by calling aclrtMalloc. Both of them support cache, and you do not need to handle the cache consistency between the CPU and NPU.

Restrictions

Other restrictions are the same as those of aclrtMalloc.

Prototype

aclError aclrtMallocCached(void **devPtr, size_t size, aclrtMemMallocPolicy policy)

Parameters

Parameter

Input/Output

Description

devPtr

Output

Pointer to the pointer to the allocated device memory.

size

Input

Requested allocation size in bytes.

Must not be 0.

policy

Input

Memory allocation policy.

Returns

The value 0 indicates success, and other values indicate failure. For details, see aclError.