Skip to main content

GraphBuffer

Struct GraphBuffer 

Source
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>
where T: DeviceRepr + Send + Sync,

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn byte_len(&self) -> usize

Source

pub fn context(&self) -> Option<&Context>

Source

pub fn as_ptr(&self) -> *const T

Source

pub fn as_mut_ptr(&mut self) -> *mut T

Source

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.

Source

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.

Source

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.

Source

pub fn copy_to_host_vec(&self) -> Result<Vec<T>>

Trait Implementations§

Source§

impl<T: Debug + DeviceRepr> Debug for GraphBuffer<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T> Freeze for GraphBuffer<T>

§

impl<T> RefUnwindSafe for GraphBuffer<T>
where T: RefUnwindSafe,

§

impl<T> Send for GraphBuffer<T>
where T: Sync + Send,

§

impl<T> Sync for GraphBuffer<T>
where T: Sync + Send,

§

impl<T> Unpin for GraphBuffer<T>

§

impl<T> UnsafeUnpin for GraphBuffer<T>

§

impl<T> UnwindSafe for GraphBuffer<T>
where T: RefUnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.