pub unsafe extern "C" fn hipMemAllocPitch(
dptr: *mut hipDeviceptr_t,
pitch: *mut usize,
widthInBytes: usize,
height: usize,
elementSizeBytes: c_uint,
) -> hipError_t
Expand description
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
@param[out] dptr Pointer to the allocated device memory @param[out] pitch Pitch for allocation (in bytes) @param[in] widthInBytes Requested pitched allocation width (in bytes) @param[in] height Requested pitched allocation height @param[in] elementSizeBytes The size of element bytes, should be 4, 8 or 16
If size is 0, no memory is allocated, ptr returns nullptr, and hipSuccess is returned. The intended usage of pitch is as a separate parameter of the allocation, used to compute addresses within the 2D array. Given the row and column of an array element of type T, the address is computed as: T pElement = (T*)((char*)BaseAddress + Row * Pitch) + Column;
@return Error code
@see hipMalloc, hipFree, hipMallocArray, hipFreeArray, hipHostFree, hipMalloc3D, hipMalloc3DArray, hipHostMalloc