aclrtMemManagedPrefetchBatchAsync

Note: This API is reserved and is not supported currently.

Function

Prefetches the unified virtual memory (UVM) in a batch.

The memory operated by this API must be allocated using aclrtMemAllocManaged. This is an asynchronous API. A successful call only indicates that the task is successfully delivered, not executed. After calling this API, call the synchronization API (for example, aclrtSynchronizeStream) to ensure that the memory prefetch task is complete.

Prototype

1
aclError aclrtMemManagedPrefetchBatchAsync(const void** ptrs, size_t* sizes, size_t count, aclrtMemManagedLocation* prefetchLocs, size_t* prefetchLocIdxs, size_t numPrefetchLocs, uint64_t flags, aclrtStream stream)

Parameters

Parameter

Input/Output

Description

ptrs

Input

Array of memory addresses to be prefetched. Each address must fall within the UVM memory range: [0x90000000000ULL, 0x90000000000ULL + 3 TB).

sizes

Input

Length array of the memory to be prefetched. This array stores the size of each UVM memory segment to be prefetched. The unit is bytes. The length of each segment must be aligned to 2 MB. Value range: (0, 3 TB]

count

Input

Length of the ptrs and sizes arrays.

prefetchLocs

Input

Location information array of the physical memory. Each location information contains two members: id and type. For details about the type definition, see aclrtMemManagedLocation.

prefetchLocIdxs

Input

Index array of the physical memory prefetch information. It specifies the prefetch range applicable to each physical address in the prefetchLocs array. For the physical address specified by prefetchLocs[k], the UVM memory addresses of the elements pointed to by the subscript from prefetchLocIdxs[k] to prefetchLocIdxs[k+1] – 1 in the ptrs array are prefetched. For the physical address specified by prefetchLocs[numPrefetchLocs – 1], the UVM memory addresses of the elements pointed to by the subscript from prefetchLocIdxs[numPrefetchLocs – 1] to count – 1 in the ptrs array are prefetched.

numPrefetchLocs

Input

Length of the prefetchLocs and prefetchLocIdxs arrays.

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.

Restrictions

  • This API prefetches the data specified in ptrs to the physical memory region specified in prefetchLocs. The size of each prefetch operation is specified by sizes. The ptrs and sizes arrays must have the same length specified by count.
  • In a batch prefetch operation, each entry in the prefetchLocs array can be applied to multiple prefetch operations. The prefetchLocIdxs array specifies the start UVM address index to be prefetched for the corresponding physical memory region. The prefetchLocs and prefetchLocIdxs arrays must have the same length specified by numPrefetchLocs. For example, if the batch processing contains 10 prefetch operations listed in ptrs/sizes, where the first six need to be prefetched to one physical memory region and the last four need to be prefetched to another physical memory region, then numPrefetchLocs is 2, prefetchLocIdxs is {0,6}, and prefetchLocs contains two groups of physical memory location information. Note that the first entry of prefetchLocIdxs must be 0. Each entry must be greater than the previous one, and the last entry must be less than count. In addition, numPrefetchLocs must be less than or equal to count.