pub struct GraphBuffer<T: DeviceRepr> { /* private fields */ }Expand description
Device memory whose allocation is retained by CUDA graph objects.
GraphBuffer values are created through Graph::create_buffer,
Graph::zeroes_buffer, or Graph::buffer_from_slice. Graph and
executable-graph APIs that accept GraphBuffer retain the underlying
allocation so graph replay cannot outlive the device pointers baked into
CUDA graph nodes.
Implementations§
Source§impl<T> GraphBuffer<T>
impl<T> GraphBuffer<T>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn byte_len(&self) -> usize
pub fn context(&self) -> Option<&Context>
pub fn as_ptr(&self) -> *const T
pub fn as_mut_ptr(&mut self) -> *mut T
Sourcepub fn copy_from_host(&mut self, host_slice: &[T]) -> Result<()>
pub fn copy_from_host(&mut self, host_slice: &[T]) -> Result<()>
Copies a host slice into this graph-retained device buffer.
This updates the stable allocation used by graph-buffer node APIs. The caller is still responsible for ordering this copy against graph launches that read or write the same allocation.
§Errors
Returns an error if host_slice does not have the same length as this
buffer or if CUDA rejects the copy.
Sourcepub fn copy_to_host(&self, host_slice: &mut [T]) -> Result<()>
pub fn copy_to_host(&self, host_slice: &mut [T]) -> Result<()>
Copies this graph-retained device buffer into a host slice.
§Errors
Returns an error if host_slice does not have the same length as this
buffer or if CUDA rejects the copy.
Sourcepub fn copy_from_buffer(&mut self, src: &Self) -> Result<()>
pub fn copy_from_buffer(&mut self, src: &Self) -> Result<()>
Copies another graph-retained buffer into this buffer.
§Errors
Returns an error if the buffers have different lengths or if CUDA rejects the copy.