aclrtMemManagedPrefetchAsync
Function
Prefetches the unified virtual memory (UVM)
The memory operated on by this API must be allocated using aclrtMemAllocManaged. This is an asynchronous API. A successful call only indicates that the task is successfully issued, not executed. After calling this API, call the synchronization API (for example, aclrtSynchronizeStream) to ensure that the memory prefetch task is complete.
This is an encapsulated API that applies only to C++ programs. It internally calls the C API aclrtMemManagedPrefetchAsync.
Prototype
1 2 | template <typename T> aclError aclrtMemManagedPrefetchAsync(const T *ptr, size_t size, aclrtMemManagedLocation location, uint32_t flags, aclrtStream stream) |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
ptr |
Input |
Address of the memory to be prefetched. The address range must be within the UVM memory range, that is, [0x90000000000ULL, 0x90000000000ULL + 3 TB). |
size |
Input |
Length of the memory to be prefetched, in bytes. The value must be 2-MB aligned. The value range is (0, 3 TB]. |
location |
Input |
Location information of the physical memory. location contains two members: id and type. For details about the type definition, see aclrtMemManagedLocation. |
flags |
Input |
Reserved. The value is fixed at 0. |
stream |
Input |
Stream for executing the memory prefetch task. For details about the type definition, see aclrtStream. |
Returns
0 on success; otherwise, failure. For details, see aclError.