pub struct CapturedGraph { /* private fields */ }Expand description
A captured and instantiated CUDA graph that can be replayed with
launch.
Created via begin_capture + GPU ops + end_capture.
The graph holds references to all device memory used during capture.
Those buffers must remain allocated for the lifetime of the graph.
Allocator pool integration (CL-278). When created via
end_capture_with_pool, the graph holds a strong reference to
the CapturePool that recorded its allocations. The pool keeps
every registered buffer alive until the last CapturedGraph
referencing it is dropped, which guarantees the device pointers
recorded in the graph remain valid across replays. Without the
pool, callers must manually keep buffers alive (the original
end_capture API).
Implementations§
Source§impl CapturedGraph
impl CapturedGraph
Sourcepub fn launch(&self) -> GpuResult<()>
pub fn launch(&self) -> GpuResult<()>
Replay all operations captured in this graph.
Before calling this, update any DeviceScalar values and perform
any pre-launch memcpys (e.g., position embeddings). All updates must
be on the same stream the graph was captured on.
Bumps num_replays on success.
Sourcepub fn upload(&self) -> GpuResult<()>
pub fn upload(&self) -> GpuResult<()>
Pre-upload the graph’s executable resources to the device.
The first launch of a freshly instantiated graph
pays a one-time cost for the driver to copy the exec into GPU
memory. Calling upload up front shifts that cost out of the
hot replay loop. Subsequent uploads are a no-op. CL-454.
Sourcepub fn num_replays(&self) -> u64
pub fn num_replays(&self) -> u64
Number of successful replays issued on this graph. CL-454.
Sourcepub fn is_uploaded(&self) -> bool
pub fn is_uploaded(&self) -> bool
Returns true if upload has been called on
this graph. CL-454.
Sourcepub fn pool_buffer_count(&self) -> usize
pub fn pool_buffer_count(&self) -> usize
Number of buffers held alive by this graph’s allocator pool. Returns 0 if the graph was created without a pool. CL-278.
Sourcepub fn pool(&self) -> Option<&Arc<CapturePool>>
pub fn pool(&self) -> Option<&Arc<CapturePool>>
Return the Arc<CapturePool> this graph is using, if any.
Allows sharing the same pool between multiple graphs so they
all keep the same buffers alive. CL-454.
Auto Trait Implementations§
impl !Freeze for CapturedGraph
impl RefUnwindSafe for CapturedGraph
impl !Send for CapturedGraph
impl !Sync for CapturedGraph
impl Unpin for CapturedGraph
impl UnsafeUnpin for CapturedGraph
impl UnwindSafe for CapturedGraph
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more