Skip to main content

GpuBackendCore

Struct GpuBackendCore 

Source
pub struct GpuBackendCore { /* private fields */ }
Expand description

One process-owned GPU backend core.

Every value of this type is a public handle. Clones mint a new PublicHandleLease, and dropping the last lease signals close the same way Self::close does. Dropping all handles therefore never leaks the device owner, but neither does it wait for cleanup; callers that need to know when the devices are reusable call one of the close_and_wait* methods first.

Implementations§

Source§

impl GpuBackendCore

Source

pub fn new(config: ValidatedGpuBackendConfig) -> Result<Self>

Claims the process owner of the configured devices, installs their GPU resources, and publishes the backend.

Only one backend may be live per process; a second call while one is live, or while a closed one is still draining, fails with the backend_already_live reason. Construction blocks the calling thread for the CUDA context, memory manager, and stream pool installation of every device. On failure the close coordinator takes over every installed resource, and the error carries rollback_cleanup facts that say whether that cleanup reached quiescence within its bounded slice or was transferred to the coordinator’s thread. In the latter case the owner lease is released asynchronously, so a retry may briefly observe backend_already_live.

Source§

impl GpuBackendCore

Source

pub fn session_capability(&self) -> GpuBackendSession

Mints the capability that session and optimizer state hold.

A session is not a public handle: it holds the resource core weakly, so any number of live sessions neither delay the last-handle close signal nor keep the resource generation reachable after close has taken it. The observation core is held strongly because attempt reports and metrics must stay readable after the GPU resources are gone.

Source

pub fn device_startup_records(&self) -> &[GpuBackendDeviceStartupRecord]

Source

pub fn kvikio_process_config(&self) -> Option<KvikioProcessConfig>

KvikIO’s process settings as applied when this backend was built, or None for a cuDF build without KvikIO support.

Source

pub fn identity(&self) -> GpuBackendCoreIdentity

Source

pub fn begin_attempt( &self, request: BeginAttemptRequest, ) -> Result<AttemptBegin>

Source

pub fn backend_metrics_snapshot(&self) -> BackendMetricsSnapshot

Returns one coherent pull snapshot for this backend resource generation.

The snapshot has a monotonic store generation so a consumer can detect whether it combined observations from different points in time.

Source

pub fn close(&self) -> bool

Signals close without waiting. Returns true only for the caller that won the lifecycle gate; later calls, and a last-handle drop after an explicit close, return false and change nothing.

From the winning call on, every new admission, service read, and attempt begin fails with the backend_closing reason, while work that already holds a permit runs to completion. Cleanup proceeds on the coordinator’s thread.

Source

pub fn close_snapshot(&self) -> GpuBackendCloseSnapshot

Point-in-time close progress. Readable at any time, including before close and from inside observation delivery.

Source

pub fn close_and_wait( &self, timeout: Duration, ) -> Result<GpuBackendCloseSnapshot>

Signals close and blocks the calling thread until both quiescence scopes are reached or timeout elapses.

A timeout returns ServiceOverloaded with reason backend_close_timeout and the quiescence facts at that moment; cleanup continues on the coordinator’s thread and a later call can observe its completion. A cleanup failure returns Internal with reason cleanup_failed_closed; the owner lease is then retained, and the devices cannot be claimed again in this process. Calling from a runtime observation observer is rejected with reentrant_observation_close before close is signalled, because that observer is itself observation work the wait would need to finish.

Source

pub fn close_and_wait_until( &self, deadline: Instant, ) -> Result<GpuBackendCloseSnapshot>

Self::close_and_wait against an absolute deadline. Lock contention inside the wait consumes this same deadline.

Source

pub async fn close_and_wait_async( &self, timeout: Duration, ) -> Result<GpuBackendCloseSnapshot>

Self::close_and_wait for callers on a Tokio runtime. The wait parks a thread, so it runs on the host runtime’s blocking pool; the reentrancy check runs first, on the caller’s task, so a rejected call never spawns.

Trait Implementations§

Source§

impl Clone for GpuBackendCore

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GpuBackendCore

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more