Allocates device memory asynchronously on a stream, without initializing it. This doesn't actually allocate if `T` is zero sized. # Safety The allocated memory retains all of the unsafety of [`DeviceBuffer::uninitialized`], with the additional consideration that the memory cannot be used until it is actually allocated on the stream. This means proper stream ordering semantics must be followed,
(size: usize, stream: &Stream)
| 71 | /// |
| 72 | /// You can synchronize the stream to ensure the memory allocation operation is complete. |
| 73 | pub unsafe fn uninitialized_async(size: usize, stream: &Stream) -> CudaResult<Self> { |
| 74 | let ptr = if size > 0 && size_of::<T>() > 0 { |
| 75 | cuda_malloc_async(stream, size)? |
| 76 | } else { |
| 77 | DevicePointer::null() |
| 78 | }; |
| 79 | Ok(DeviceBuffer { |
| 80 | buf: ptr, |
| 81 | len: size, |
| 82 | }) |
| 83 | } |
| 84 | |
| 85 | /// Enqueues an operation to free the memory backed by this [`DeviceBuffer`] on a |
| 86 | /// particular stream. The stream will free the allocation as soon as it reaches |
nothing calls this directly
no test coverage detected