Skip to main content

hipMemDiscardAndPrefetchBatchAsync

Function hipMemDiscardAndPrefetchBatchAsync 

Source
pub unsafe extern "C" fn hipMemDiscardAndPrefetchBatchAsync(
    dptrs: *mut *mut c_void,
    sizes: *mut usize,
    count: usize,
    prefetchLocs: *mut hipMemLocation,
    prefetchLocIdxs: *mut usize,
    numPrefetchLocs: usize,
    flags: c_ulonglong,
    stream: hipStream_t,
) -> hipError_t
Expand description

@brief Discards and prefetches a batch of memory ranges asynchronously.

@param [in] dptrs pointers to the memory ranges @param [in] sizes sizes in bytes of the memory ranges @param [in] count number of memory ranges @param [in] prefetchLocs array of target locations for prefetching @param [in] prefetchLocIdxs indices mapping each range to a prefetch location @param [in] numPrefetchLocs number of unique prefetch locations @param [in] flags flags for future use, must be zero now. @param [in] stream stream to enqueue the operation

@returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotSupported

Semantically equivalent to calling @p hipMemDiscardBatchAsync followed by @p hipMemPrefetchBatchAsync, but combines both operations into a single command submission for reduced overhead.

@warning Reading from a discarded range without first writing or prefetching to it will return an indeterminate value.

@note All memory ranges must be managed memory allocated via hipMallocManaged or system-allocated memory (if device supports pageable memory access). @note This API is implemented on Linux and requires XNACK to be enabled. @note This API is marked as beta, meaning, while this is feature complete, it is still open to changes and may have outstanding issues.

@see hipMemDiscardBatchAsync, hipMemPrefetchBatchAsync, hipMallocManaged