pub unsafe extern "C" fn hipMemcpy2DAsync(
dst: *mut c_void,
dpitch: usize,
src: *const c_void,
spitch: usize,
width: usize,
height: usize,
kind: hipMemcpyKind,
stream: hipStream_t,
) -> hipError_tExpand description
@brief Copies data between host and device asynchronously.
hipMemcpy2DAsync supports memory matrix copy from the pointed area src to the pointed area dst. The copy direction is defined by kind which must be one of #hipMemcpyHostToDevice, #hipMemcpyDeviceToHost, #hipMemcpyDeviceToDevice or #hipMemcpyDefault. dpitch and spitch are the widths in bytes for memory matrix corresponds to dst and src. width cannot exceed dpitch or spitch.
The copy is always performed by the device associated with the specified stream. The API is asynchronous with respect to the host, so the call may return before the copy is complete. The copy can optionally be excuted in a specific stream by passing a non-zero stream argument, for HostToDevice or DeviceToHost copies, the copy can overlap with operations in other streams.
For multi-gpu or peer-to-peer configurations, it is recommended to use a stream which is attached to the device where the src data is physically located.
For optimal peer-to-peer copies, the copy device must be able to access the src and dst pointers (by calling hipDeviceEnablePeerAccess) with copy agent as the current device and src/dst as the peerDevice argument. If enabling device peer access is not done, the API will still work, but will perform the copy using a staging buffer on the host.
@note If host or dst are not pinned, the memory copy will be performed synchronously. For best performance, use hipHostMalloc to allocate host memory that is transferred asynchronously.
@param[in] dst Pointer to destination memory address @param[in] dpitch Pitch size in bytes of destination memory @param[in] src Pointer to source memory address @param[in] spitch Pitch size in bytes of source memory @param[in] width Width of matrix transfer (columns in bytes) @param[in] height Height of matrix transfer (rows) @param[in] kind Type of transfer @param[in] stream Stream to use @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidPitchValue, #hipErrorInvalidDevicePointer, #hipErrorInvalidMemcpyDirection
@see hipMemcpy, hipMemcpyToArray, hipMemcpy2DToArray, hipMemcpyFromArray, hipMemcpyToSymbol, hipMemcpyAsync