# ROCm Documentation has moved to docs.amd.com
Memory Management¶
hipPointerGetAttributes¶
-
hipError_t
hipPointerGetAttributes
(hipPointerAttribute_t *attributes, const void *ptr)¶ Return attributes for the specified pointer.
- Return
#hipSuccess, #hipErrorInvalidDevice, #hipErrorInvalidValue
- See
hipGetDeviceCount, hipGetDevice, hipSetDevice, hipChooseDevice
- Parameters
[out] attributes
: for the specified pointer[in] pointer
: to get attributes for
hipMalloc¶
-
hipError_t
hipMalloc
(void **ptr, size_t size)¶ Allocate memory on the default accelerator.
If size is 0, no memory is allocated, *ptr returns nullptr, and hipSuccess is returned.
- Parameters
[out] ptr
: Pointer to the allocated memory[in] size
: Requested memory size
- Return
#hipSuccess, #hipErrorMemoryAllocation, #hipErrorInvalidValue (bad context, null *ptr)
- See
hipMallocPitch, hipFree, hipMallocArray, hipFreeArray, hipMalloc3D, hipMalloc3DArray, hipHostFree, hipHostMalloc
hipHostMalloc¶
-
hipError_t
hipHostMalloc
(void **ptr, size_t size, unsigned int flags)¶ Allocate device accessible page locked host memory.
If size is 0, no memory is allocated, *ptr returns nullptr, and hipSuccess is returned.
- Parameters
[out] ptr
: Pointer to the allocated host pinned memory[in] size
: Requested memory size[in] flags
: Type of host memory allocation
- Return
#hipSuccess, #hipErrorMemoryAllocation
- See
hipSetDeviceFlags, hipHostFree
hipHostGetDevicePointer¶
-
hipError_t
hipHostGetDevicePointer
(void **devPtr, void *hstPtr, unsigned int flags)¶ Get Device pointer from Host Pointer allocated through hipHostMalloc.
- Return
#hipSuccess, #hipErrorInvalidValue, #hipErrorMemoryAllocation
- See
- Parameters
[out] dstPtr
: Device Pointer mapped to passed host pointer[in] hstPtr
: Host Pointer allocated through hipHostMalloc[in] flags
: Flags to be passed for extension
hipHostGetFlags¶
-
hipError_t
hipHostGetFlags
(unsigned int *flagsPtr, void *hostPtr)¶ Return flags associated with host pointer.
- Return
#hipSuccess, #hipErrorInvalidValue
- See
- Parameters
[out] flagsPtr
: Memory location to store flags[in] hostPtr
: Host Pointer allocated through hipHostMalloc
hipHostRegister¶
-
hipError_t
hipHostRegister
(void *hostPtr, size_t sizeBytes, unsigned int flags)¶ Register host memory so it can be accessed from the current device.
Flags:
hipHostRegisterDefault Memory is Mapped and Portable
hipHostRegisterPortable Memory is considered registered by all contexts. HIP only supports one context so this is always assumed true.
hipHostRegisterMapped Map the allocation into the address space for the current device. The device pointer can be obtained with hipHostGetDevicePointer.
- Parameters
[out] hostPtr
: Pointer to host memory to be registered.[in] sizeBytes
: size of the host memory[in] flags.
: See below.
After registering the memory, use hipHostGetDevicePointer to obtain the mapped device pointer. On many systems, the mapped device pointer will have a different value than the mapped host pointer. Applications must use the device pointer in device code, and the host pointer in device code.
On some systems, registered memory is pinned. On some systems, registered memory may not be actually be pinned but uses OS or hardware facilities to all GPU access to the host memory.
Developers are strongly encouraged to register memory blocks which are aligned to the host cache-line size. (typically 64-bytes but can be obtains from the CPUID instruction).
If registering non-aligned pointers, the application must take care when register pointers from the same cache line on different devices. HIP’s coarse-grained synchronization model does not guarantee correct results if different devices write to different parts of the same cache block - typically one of the writes will “win” and overwrite data from the other registered memory region.
- Return
#hipSuccess, #hipErrorMemoryAllocation
- See
hipHostUnregister¶
-
hipError_t
hipHostUnregister
(void *hostPtr)¶ Un-register host pointer.
- Return
Error code
- See
- Parameters
[in] hostPtr
: Host pointer previously registered with hipHostRegister
hipMallocPitch¶
-
hipError_t
hipMallocPitch
(void **ptr, size_t *pitch, size_t width, size_t height)¶ Allocates at least width (in bytes) * height bytes of linear memory Padding may occur to ensure alighnment requirements are met for the given row The change in width size due to padding will be returned in *pitch.
Currently the alignment is set to 128 bytes
If size is 0, no memory is allocated, *ptr returns nullptr, and hipSuccess is returned.
- Parameters
[out] ptr
: Pointer to the allocated device memory[out] pitch
: Pitch for allocation (in bytes)[in] width
: Requested pitched allocation width (in bytes)[in] height
: Requested pitched allocation height
- Return
Error code
- See
hipMalloc, hipFree, hipMallocArray, hipFreeArray, hipHostFree, hipMalloc3D, hipMalloc3DArray, hipHostMalloc
hipFree¶
-
hipError_t
hipFree
(void *ptr)¶ Free memory allocated by the hcc hip memory allocation API.
This API performs an implicit hipDeviceSynchronize() call. If pointer is NULL, the hip runtime is initialized and hipSuccess is returned.
- Return
#hipSuccess
- Return
#hipErrorInvalidDevicePointer (if pointer is invalid, including host pointers allocated with hipHostMalloc)
- See
hipMalloc, hipMallocPitch, hipMallocArray, hipFreeArray, hipHostFree, hipMalloc3D, hipMalloc3DArray, hipHostMalloc
- Parameters
[in] ptr
: Pointer to memory to be freed
hipMemcpy¶
-
hipError_t
hipMemcpy
(void *dst, const void *src, size_t sizeBytes, hipMemcpyKind kind)¶ Copy data from src to dst.
It supports memory from host to device, device to host, device to device and host to host The src and dst must not overlap.
For hipMemcpy, the copy is always performed by the current device (set by hipSetDevice). For multi-gpu or peer-to-peer configurations, it is recommended to set the current device 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/dest as the peerDevice argument. if this is not done, the hipMemcpy will still work, but will perform the copy using a staging buffer on the host.
- Return
#hipSuccess, #hipErrorInvalidValue, #hipErrorMemoryFree, #hipErrorUnknowni
- See
hipArrayCreate, hipArrayDestroy, hipArrayGetDescriptor, hipMemAlloc, hipMemAllocHost, hipMemAllocPitch, hipMemcpy2D, hipMemcpy2DAsync, hipMemcpy2DUnaligned, hipMemcpyAtoA, hipMemcpyAtoD, hipMemcpyAtoH, hipMemcpyAtoHAsync, hipMemcpyDtoA, hipMemcpyDtoD, hipMemcpyDtoDAsync, hipMemcpyDtoH, hipMemcpyDtoHAsync, hipMemcpyHtoA, hipMemcpyHtoAAsync, hipMemcpyHtoDAsync, hipMemFree, hipMemFreeHost, hipMemGetAddressRange, hipMemGetInfo, hipMemHostAlloc, hipMemHostGetDevicePointer
- Parameters
[out] dst
: Data being copy to[in] src
: Data being copy from[in] sizeBytes
: Data size in bytes[in] copyType
: Memory copy type
hipMemcpyHtoD¶
-
hipError_t
hipMemcpyHtoD
(hipDeviceptr_t dst, void *src, size_t sizeBytes)¶ Copy data from Host to Device.
- Return
#hipSuccess, #hipErrorDeInitialized, #hipErrorNotInitialized, #hipErrorInvalidContext, #hipErrorInvalidValue
- See
hipArrayCreate, hipArrayDestroy, hipArrayGetDescriptor, hipMemAlloc, hipMemAllocHost, hipMemAllocPitch, hipMemcpy2D, hipMemcpy2DAsync, hipMemcpy2DUnaligned, hipMemcpyAtoA, hipMemcpyAtoD, hipMemcpyAtoH, hipMemcpyAtoHAsync, hipMemcpyDtoA, hipMemcpyDtoD, hipMemcpyDtoDAsync, hipMemcpyDtoH, hipMemcpyDtoHAsync, hipMemcpyHtoA, hipMemcpyHtoAAsync, hipMemcpyHtoDAsync, hipMemFree, hipMemFreeHost, hipMemGetAddressRange, hipMemGetInfo, hipMemHostAlloc, hipMemHostGetDevicePointer
- Parameters
[out] dst
: Data being copy to[in] src
: Data being copy from[in] sizeBytes
: Data size in bytes
hipMemcpyDtoH¶
-
hipError_t
hipMemcpyDtoH
(void *dst, hipDeviceptr_t src, size_t sizeBytes)¶ Copy data from Device to Host.
- Return
#hipSuccess, #hipErrorDeInitialized, #hipErrorNotInitialized, #hipErrorInvalidContext, #hipErrorInvalidValue
- See
hipArrayCreate, hipArrayDestroy, hipArrayGetDescriptor, hipMemAlloc, hipMemAllocHost, hipMemAllocPitch, hipMemcpy2D, hipMemcpy2DAsync, hipMemcpy2DUnaligned, hipMemcpyAtoA, hipMemcpyAtoD, hipMemcpyAtoH, hipMemcpyAtoHAsync, hipMemcpyDtoA, hipMemcpyDtoD, hipMemcpyDtoDAsync, hipMemcpyDtoH, hipMemcpyDtoHAsync, hipMemcpyHtoA, hipMemcpyHtoAAsync, hipMemcpyHtoDAsync, hipMemFree, hipMemFreeHost, hipMemGetAddressRange, hipMemGetInfo, hipMemHostAlloc, hipMemHostGetDevicePointer
- Parameters
[out] dst
: Data being copy to[in] src
: Data being copy from[in] sizeBytes
: Data size in bytes
hipMemcpyDtoD¶
-
hipError_t
hipMemcpyDtoD
(hipDeviceptr_t dst, hipDeviceptr_t src, size_t sizeBytes)¶ Copy data from Device to Device.
- Return
#hipSuccess, #hipErrorDeInitialized, #hipErrorNotInitialized, #hipErrorInvalidContext, #hipErrorInvalidValue
- See
hipArrayCreate, hipArrayDestroy, hipArrayGetDescriptor, hipMemAlloc, hipMemAllocHost, hipMemAllocPitch, hipMemcpy2D, hipMemcpy2DAsync, hipMemcpy2DUnaligned, hipMemcpyAtoA, hipMemcpyAtoD, hipMemcpyAtoH, hipMemcpyAtoHAsync, hipMemcpyDtoA, hipMemcpyDtoD, hipMemcpyDtoDAsync, hipMemcpyDtoH, hipMemcpyDtoHAsync, hipMemcpyHtoA, hipMemcpyHtoAAsync, hipMemcpyHtoDAsync, hipMemFree, hipMemFreeHost, hipMemGetAddressRange, hipMemGetInfo, hipMemHostAlloc, hipMemHostGetDevicePointer
- Parameters
[out] dst
: Data being copy to[in] src
: Data being copy from[in] sizeBytes
: Data size in bytes
hipMemcpyHtoDAsync¶
-
hipError_t
hipMemcpyHtoDAsync
(hipDeviceptr_t dst, void *src, size_t sizeBytes, hipStream_t stream)¶ Copy data from Host to Device asynchronously.
- Return
#hipSuccess, #hipErrorDeInitialized, #hipErrorNotInitialized, #hipErrorInvalidContext, #hipErrorInvalidValue
- See
hipArrayCreate, hipArrayDestroy, hipArrayGetDescriptor, hipMemAlloc, hipMemAllocHost, hipMemAllocPitch, hipMemcpy2D, hipMemcpy2DAsync, hipMemcpy2DUnaligned, hipMemcpyAtoA, hipMemcpyAtoD, hipMemcpyAtoH, hipMemcpyAtoHAsync, hipMemcpyDtoA, hipMemcpyDtoD, hipMemcpyDtoDAsync, hipMemcpyDtoH, hipMemcpyDtoHAsync, hipMemcpyHtoA, hipMemcpyHtoAAsync, hipMemcpyHtoDAsync, hipMemFree, hipMemFreeHost, hipMemGetAddressRange, hipMemGetInfo, hipMemHostAlloc, hipMemHostGetDevicePointer
- Parameters
[out] dst
: Data being copy to[in] src
: Data being copy from[in] sizeBytes
: Data size in bytes
hipMemcpyDtoHAsync¶
-
hipError_t
hipMemcpyDtoHAsync
(void *dst, hipDeviceptr_t src, size_t sizeBytes, hipStream_t stream)¶ Copy data from Device to Host asynchronously.
- Return
#hipSuccess, #hipErrorDeInitialized, #hipErrorNotInitialized, #hipErrorInvalidContext, #hipErrorInvalidValue
- See
hipArrayCreate, hipArrayDestroy, hipArrayGetDescriptor, hipMemAlloc, hipMemAllocHost, hipMemAllocPitch, hipMemcpy2D, hipMemcpy2DAsync, hipMemcpy2DUnaligned, hipMemcpyAtoA, hipMemcpyAtoD, hipMemcpyAtoH, hipMemcpyAtoHAsync, hipMemcpyDtoA, hipMemcpyDtoD, hipMemcpyDtoDAsync, hipMemcpyDtoH, hipMemcpyDtoHAsync, hipMemcpyHtoA, hipMemcpyHtoAAsync, hipMemcpyHtoDAsync, hipMemFree, hipMemFreeHost, hipMemGetAddressRange, hipMemGetInfo, hipMemHostAlloc, hipMemHostGetDevicePointer
- Parameters
[out] dst
: Data being copy to[in] src
: Data being copy from[in] sizeBytes
: Data size in bytes
hipMemcpyDtoDAsync¶
-
hipError_t
hipMemcpyDtoDAsync
(hipDeviceptr_t dst, hipDeviceptr_t src, size_t sizeBytes, hipStream_t stream)¶ Copy data from Device to Device asynchronously.
- Return
#hipSuccess, #hipErrorDeInitialized, #hipErrorNotInitialized, #hipErrorInvalidContext, #hipErrorInvalidValue
- See
hipArrayCreate, hipArrayDestroy, hipArrayGetDescriptor, hipMemAlloc, hipMemAllocHost, hipMemAllocPitch, hipMemcpy2D, hipMemcpy2DAsync, hipMemcpy2DUnaligned, hipMemcpyAtoA, hipMemcpyAtoD, hipMemcpyAtoH, hipMemcpyAtoHAsync, hipMemcpyDtoA, hipMemcpyDtoD, hipMemcpyDtoDAsync, hipMemcpyDtoH, hipMemcpyDtoHAsync, hipMemcpyHtoA, hipMemcpyHtoAAsync, hipMemcpyHtoDAsync, hipMemFree, hipMemFreeHost, hipMemGetAddressRange, hipMemGetInfo, hipMemHostAlloc, hipMemHostGetDevicePointer
- Parameters
[out] dst
: Data being copy to[in] src
: Data being copy from[in] sizeBytes
: Data size in bytes
hipMemcpyToSymbolAsync¶
-
hipError_t hipMemcpyToSymbolAsync (const void *symbolName, const void *src, size_t sizeBytes, size_t offset, hipMemcpyKind kind, hipStream_t stream __dparm(0))
Copies
sizeBytes
bytes from the memory area pointed to bysrc
to the memory area pointed to byoffset
bytes from the start of symbolsymbol
.The memory areas may not overlap. Symbol can either be a variable that resides in global or constant memory space, or it can be a character string, naming a variable that resides in global or constant memory space. Kind can be either hipMemcpyHostToDevice or hipMemcpyDeviceToDevice hipMemcpyToSymbolAsync() is asynchronous with respect to the host, so the call may return before copy is complete. TODO: cudaErrorInvalidSymbol and cudaErrorInvalidMemcpyDirection is not supported, use hipErrorUnknown for now.
- Return
#hipSuccess, #hipErrorInvalidValue, #hipErrorMemoryFree, #hipErrorUnknown
- See
hipMemcpy, hipMemcpy2D, hipMemcpyToArray, hipMemcpy2DToArray, hipMemcpyFromArray, hipMemcpy2DFromArray, hipMemcpyArrayToArray, hipMemcpy2DArrayToArray, hipMemcpyFromSymbol, hipMemcpyAsync, hipMemcpy2DAsync, hipMemcpyToArrayAsync, hipMemcpy2DToArrayAsync, hipMemcpyFromArrayAsync, hipMemcpy2DFromArrayAsync, hipMemcpyToSymbolAsync, hipMemcpyFromSymbolAsync
- Parameters
[in] symbolName
: - Symbol destination on device[in] src
: - Data being copy from[in] sizeBytes
: - Data size in bytes[in] offset
: - Offset from start of symbol in bytes[in] kind
: - Type of transfer
hipMemcpyFromSymbol¶
-
hipError_t hipMemcpyFromSymbol (void *dst, const void *symbolName, size_t sizeBytes, size_t offset __dparm(0), hipMemcpyKind kind __dparm(hipMemcpyDeviceToHost))
hipMemcpyAsync¶
-
hipError_t hipMemcpyAsync (void *dst, const void *src, size_t sizeBytes, hipMemcpyKind kind, hipStream_t stream __dparm(0))
Copy data from src to dst asynchronously.
For multi-gpu or peer-to-peer configurations, it is recommended to use a stream which is a 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/dest as the peerDevice argument. if this is not done, the hipMemcpy will still work, but will perform the copy using a staging buffer on the host.
- Warning
If host or dest are not pinned, the memory copy will be performed synchronously. For best performance, use hipHostMalloc to allocate host memory that is transferred asynchronously.
- Warning
on HCC hipMemcpyAsync does not support overlapped H2D and D2H copies. For hipMemcpy, the copy is always performed by the device associated with the specified stream.
- Return
#hipSuccess, #hipErrorInvalidValue, #hipErrorMemoryFree, #hipErrorUnknown
- See
hipMemcpy, hipMemcpy2D, hipMemcpyToArray, hipMemcpy2DToArray, hipMemcpyFromArray, hipMemcpy2DFromArray, hipMemcpyArrayToArray, hipMemcpy2DArrayToArray, hipMemcpyToSymbol, hipMemcpyFromSymbol, hipMemcpy2DAsync, hipMemcpyToArrayAsync, hipMemcpy2DToArrayAsync, hipMemcpyFromArrayAsync, hipMemcpy2DFromArrayAsync, hipMemcpyToSymbolAsync, hipMemcpyFromSymbolAsync
- Parameters
[out] dst
: Data being copy to[in] src
: Data being copy from[in] sizeBytes
: Data size in bytes[in] accelerator_view
: Accelerator view which the copy is being enqueued
hipMemset¶
-
hipError_t
hipMemset
(void *dst, int value, size_t sizeBytes)¶ Fills the first sizeBytes bytes of the memory area pointed to by dest with the constant byte value value.
- Return
#hipSuccess, #hipErrorInvalidValue, #hipErrorNotInitialized
- Parameters
[out] dst
: Data being filled[in] constant
: value to be set[in] sizeBytes
: Data size in bytes
hipMemsetD8¶
-
hipError_t
hipMemsetD8
(hipDeviceptr_t dest, unsigned char value, size_t sizeBytes)¶ Fills the first sizeBytes bytes of the memory area pointed to by dest with the constant byte value value.
- Return
#hipSuccess, #hipErrorInvalidValue, #hipErrorNotInitialized
- Parameters
[out] dst
: Data ptr to be filled[in] constant
: value to be set[in] sizeBytes
: Data size in bytes
hipMemsetAsync¶
-
hipError_t hipMemsetAsync (void *dst, int value, size_t sizeBytes, hipStream_t stream __dparm(0))
Fills the first sizeBytes bytes of the memory area pointed to by dev with the constant byte value value.
hipMemsetAsync() is asynchronous with respect to the host, so the call may return before the memset is complete. The operation can optionally be associated to a stream by passing a non-zero stream argument. If stream is non-zero, the operation may overlap with operations in other streams.
- Return
#hipSuccess, #hipErrorInvalidValue, #hipErrorMemoryFree
- Parameters
[out] dst
: Pointer to device memory[in] value
: - Value to set for each byte of specified memory[in] sizeBytes
: - Size in bytes to set[in] stream
: - Stream identifier
hipMemset2D¶
-
hipError_t
hipMemset2D
(void *dst, size_t pitch, int value, size_t width, size_t height)¶ Fills the memory area pointed to by dst with the constant value.
- Return
#hipSuccess, #hipErrorInvalidValue, #hipErrorMemoryFree
- Parameters
[out] dst
: Pointer to device memory[in] pitch
: - data size in bytes[in] value
: - constant value to be set[in] width
:[in] height
:
hipMemGetInfo¶
-
hipError_t
hipMemGetInfo
(size_t *free, size_t *total)¶ Query memory info.
Return snapshot of free memory, and total allocatable memory on the device.
Returns in *free a snapshot of the current free memory.
- Return
#hipSuccess, #hipErrorInvalidDevice, #hipErrorInvalidValue
- Warning
On HCC, the free memory only accounts for memory allocated by this process and may be optimistic.
hipMallocArray¶
-
hipError_t hipMallocArray (hipArray **array, const hipChannelFormatDesc *desc, size_t width, size_t height __dparm(0), unsigned int flags __dparm(hipArrayDefault))
Allocate an array on the device.
- Return
#hipSuccess, #hipErrorMemoryAllocation
- See
hipMalloc, hipMallocPitch, hipFree, hipFreeArray, hipHostMalloc, hipHostFree
- Parameters
[out] array
: Pointer to allocated array in device memory[in] desc
: Requested channel format[in] width
: Requested array allocation width[in] height
: Requested array allocation height[in] flags
: Requested properties of allocated array
hipFreeArray¶
-
hipError_t
hipFreeArray
(hipArray *array)¶ Frees an array on the device.
- Return
#hipSuccess, #hipErrorInvalidValue, #hipErrorInitializationError
- See
hipMalloc, hipMallocPitch, hipFree, hipMallocArray, hipHostMalloc, hipHostFree
- Parameters
[in] array
: Pointer to array to free
hipMalloc3DArray¶
-
hipError_t
hipMalloc3DArray
(hipArray **array, const struct hipChannelFormatDesc *desc, struct hipExtent extent, unsigned int flags)¶ Allocate an array on the device.
- Return
#hipSuccess, #hipErrorMemoryAllocation
- See
hipMalloc, hipMallocPitch, hipFree, hipFreeArray, hipHostMalloc, hipHostFree
- Parameters
[out] array
: Pointer to allocated array in device memory[in] desc
: Requested channel format[in] extent
: Requested array allocation width, height and depth[in] flags
: Requested properties of allocated array
hipMemcpy2D¶
-
hipError_t
hipMemcpy2D
(void *dst, size_t dpitch, const void *src, size_t spitch, size_t width, size_t height, hipMemcpyKind kind)¶ Copies data between host and device.
- Return
#hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidPitchValue, #hipErrorInvalidDevicePointer, #hipErrorInvalidMemcpyDirection
- See
hipMemcpy, hipMemcpyToArray, hipMemcpy2DToArray, hipMemcpyFromArray, hipMemcpyToSymbol, hipMemcpyAsync
- Parameters
[in] dst
: Destination memory address[in] dpitch
: Pitch of destination memory[in] src
: Source memory address[in] spitch
: Pitch of source memory[in] width
: Width of matrix transfer (columns in bytes)[in] height
: Height of matrix transfer (rows)[in] kind
: Type of transfer
hipMemcpy2DAsync¶
-
hipError_t hipMemcpy2DAsync (void *dst, size_t dpitch, const void *src, size_t spitch, size_t width, size_t height, hipMemcpyKind kind, hipStream_t stream __dparm(0))
Copies data between host and device.
- Return
#hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidPitchValue, #hipErrorInvalidDevicePointer, #hipErrorInvalidMemcpyDirection
- See
hipMemcpy, hipMemcpyToArray, hipMemcpy2DToArray, hipMemcpyFromArray, hipMemcpyToSymbol, hipMemcpyAsync
- Parameters
[in] dst
: Destination memory address[in] dpitch
: Pitch of destination memory[in] src
: Source memory address[in] spitch
: Pitch of source memory[in] width
: Width of matrix transfer (columns in bytes)[in] height
: Height of matrix transfer (rows)[in] kind
: Type of transfer[in] stream
: Stream to use
hipMemcpy2DToArray¶
-
hipError_t
hipMemcpy2DToArray
(hipArray *dst, size_t wOffset, size_t hOffset, const void *src, size_t spitch, size_t width, size_t height, hipMemcpyKind kind)¶ Copies data between host and device.
- Return
#hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidPitchValue, #hipErrorInvalidDevicePointer, #hipErrorInvalidMemcpyDirection
- See
hipMemcpy, hipMemcpyToArray, hipMemcpy2D, hipMemcpyFromArray, hipMemcpyToSymbol, hipMemcpyAsync
- Parameters
[in] dst
: Destination memory address[in] dpitch
: Pitch of destination memory[in] src
: Source memory address[in] spitch
: Pitch of source memory[in] width
: Width of matrix transfer (columns in bytes)[in] height
: Height of matrix transfer (rows)[in] kind
: Type of transfer
hipMemcpyToArray¶
-
hipError_t
hipMemcpyToArray
(hipArray *dst, size_t wOffset, size_t hOffset, const void *src, size_t count, hipMemcpyKind kind)¶ Copies data between host and device.
- Return
#hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidPitchValue, #hipErrorInvalidDevicePointer, #hipErrorInvalidMemcpyDirection
- See
hipMemcpy, hipMemcpy2DToArray, hipMemcpy2D, hipMemcpyFromArray, hipMemcpyToSymbol, hipMemcpyAsync
- Parameters
[in] dst
: Destination memory address[in] dpitch
: Pitch of destination memory[in] src
: Source memory address[in] spitch
: Pitch of source memory[in] width
: Width of matrix transfer (columns in bytes)[in] height
: Height of matrix transfer (rows)[in] kind
: Type of transfer
hipMemcpy3D¶
-
hipError_t
hipMemcpy3D
(const struct hipMemcpy3DParms *p)¶ Copies data between host and device.
- Return
#hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidPitchValue, #hipErrorInvalidDevicePointer, #hipErrorInvalidMemcpyDirection
- See
hipMemcpy, hipMemcpy2DToArray, hipMemcpy2D, hipMemcpyFromArray, hipMemcpyToSymbol, hipMemcpyAsync
- Parameters
[in] p
: 3D memory copy parameters