cubecl_hip_sys

Function hipMallocAsync

Source
pub unsafe extern "C" fn hipMallocAsync(
    dev_ptr: *mut *mut c_void,
    size: usize,
    stream: hipStream_t,
) -> hipError_t
Expand description

@brief Allocates memory with stream ordered semantics

Inserts a memory allocation operation into @p stream. A pointer to the allocated memory is returned immediately in *dptr. The allocation must not be accessed until the allocation operation completes. The allocation comes from the memory pool associated with the stream’s device.

@note The default memory pool of a device contains device memory from that device. @note Basic stream ordering allows future work submitted into the same stream to use the allocation. Stream query, stream synchronize, and HIP events can be used to guarantee that the allocation operation completes before work submitted in a separate stream runs. @note During stream capture, this function results in the creation of an allocation node. In this case, the allocation is owned by the graph instead of the memory pool. The memory pool’s properties are used to set the node’s creation parameters.

@param [out] dev_ptr Returned device pointer of memory allocation @param [in] size Number of bytes to allocate @param [in] stream The stream establishing the stream ordering contract and the memory pool to allocate from

@return #hipSuccess, #hipErrorInvalidValue, #hipErrorNotSupported, #hipErrorOutOfMemory

@see hipMallocFromPoolAsync, hipFreeAsync, hipMemPoolTrimTo, hipMemPoolGetAttribute, hipDeviceSetMemPool, hipMemPoolSetAttribute, hipMemPoolSetAccess, hipMemPoolGetAccess

@warning : This API is marked as beta, meaning, while this is feature complete, it is still open to changes and may have outstanding issues.

@note This API is implemented on Linux, under development on Windows.