Skip to main content

GuestClient

Struct GuestClient 

Source
pub struct GuestClient<Q: DriverQueue>{ /* private fields */ }
Expand description

Bounded, single-owner reference driver over a portable command queue.

The type performs no internal locking. Callers that share one client across execution contexts choose their own synchronization policy; ordinary single-owner polling needs none.

Implementations§

Source§

impl<Q> GuestClient<Q>

Source

pub fn new(queue: Q, config: GuestConfig) -> Result<Self, ClientInitError>

Construct a client after transport feature and queue setup.

Source

pub fn queue_state(&self) -> QueueState

Current queue lifecycle snapshot.

Source

pub const fn config(&self) -> GuestConfig

Validated guest configuration.

Source

pub const fn device_info(&self) -> Option<DeviceInfo>

Latest discovery result in the current epoch.

Source

pub const fn health(&self) -> ClientHealth

Current response-tracking health.

Source

pub fn disable_used_notifications(&mut self) -> Result<(), QueueError<Q::Error>>

Disable used notifications before draining completions.

Source

pub fn enable_used_notifications( &mut self, ) -> Result<NotificationRecheck, QueueError<Q::Error>>

Atomically enable used notifications and check for missed completions.

Source

pub fn pump(&mut self) -> Result<PumpResult, QueueError<Q::Error>>

Consume and classify at most one used-ring entry.

Source

pub fn poll<O: Operation>( &mut self, pending: Pending<O>, ) -> RequestPoll<O, Q::Chain, Q::Error, <Q::Chain as DriverChainBuffer>::Error>

Poll one typed operation, consuming at most one queue completion.

Source

pub fn reset( &mut self, next_epoch: QueueEpoch, ) -> Result<Q::Reclaimed, QueueError<Q::Error>>

Reset the queue and invalidate all pending operations and typed handles.

Published chains are returned by the queue’s reclaimed collection. Chains already popped from the used ring are retained for Self::pop_recovered_completion.

Source

pub fn reconfigure_queue( &mut self, size: QueueSize, ) -> Result<(), QueueSetupError<<Q as DriverQueue>::Error>>
where Q: QueueControl<Error = <Q as DriverQueue>::Error>,

Configure and ready the command queue after transport reset.

Source

pub fn pop_recovered_completion(&mut self) -> Option<UsedChain<Q::Chain>>

Recover one completion that had been popped before reset invalidated its pending token.

Source

pub fn take_unexpected_completion(&mut self) -> Option<UsedChain<Q::Chain>>

Recover the unexpected completion that forced reset.

Source

pub fn get_device_info( &mut self, chain: Q::Chain, ) -> StartResult<Q, GetDeviceInfo>

Start protocol discovery.

Source

pub fn create_context( &mut self, chain: Q::Chain, ) -> StartResult<Q, CreateContext>

Start context creation.

Source

pub fn destroy_context( &mut self, chain: Q::Chain, context: Context, ) -> StartResult<Q, DestroyContext>

Start context destruction, consuming the handle until completion or failure recovery.

Source

pub fn allocate_buffer( &mut self, chain: Q::Chain, context: &Context, desc: BufferDesc, ) -> StartResult<Q, AllocateBuffer>

Start a bounded buffer allocation.

Source

pub fn free_buffer( &mut self, chain: Q::Chain, buffer: Buffer, ) -> StartResult<Q, FreeBuffer>

Start buffer release, consuming the handle until completion or failure recovery.

Source

pub fn write_buffer<R: ReadableBytes + ?Sized>( &mut self, chain: Q::Chain, buffer: &Buffer, offset: u64, source: &R, ) -> StartResult<Q, WriteBuffer>

Start a copy from caller source bytes into a provider-owned buffer.

Source

pub fn write_buffer_prepared( &mut self, chain: Q::Chain, buffer: &Buffer, range: BufferRange, ) -> StartResult<Q, WriteBuffer>

Start a zero-copy buffer write from an already prepared request-chain tail.

Bytes beginning after the transfer prefix are left untouched and become the write payload.

Source

pub fn read_buffer( &mut self, chain: Q::Chain, buffer: &Buffer, range: BufferRange, ) -> StartResult<Q, ReadBuffer>

Start a provider-buffer read whose bytes remain in the reclaimed chain.

Source

pub fn load_program<R: ReadableBytes + ?Sized>( &mut self, chain: Q::Chain, context: &Context, desc: ProgramDesc, artifact: &R, ) -> StartResult<Q, LoadProgram>

Start loading an opaque program artifact directly from caller bytes.

Source

pub fn load_program_prepared( &mut self, chain: Q::Chain, context: &Context, desc: ProgramDesc, artifact_bytes: u64, ) -> StartResult<Q, LoadProgram>

Start a zero-copy program load from an already prepared request-chain tail.

Artifact bytes beginning after the fixed load prefix are left untouched.

Source

pub fn unload_program( &mut self, chain: Q::Chain, program: Program, ) -> StartResult<Q, UnloadProgram>

Start program release, consuming the handle until completion or failure recovery.

Source

pub fn create_execution_queue( &mut self, chain: Q::Chain, context: &Context, ) -> StartResult<Q, CreateExecutionQueue>

Start creation of an accelerator execution queue.

Source

pub fn destroy_execution_queue( &mut self, chain: Q::Chain, queue: ExecutionQueue, ) -> StartResult<Q, DestroyExecutionQueue>

Start execution-queue release, consuming the handle until completion or failure recovery.

Source

pub fn submit( &mut self, chain: Q::Chain, queue: &ExecutionQueue, program: &Program, bindings: &[Binding<'_>], timeout_ns: u64, ) -> StartResult<Q, Submit>

Start submission with bindings encoded directly into the caller chain.

Source

pub fn poll_event( &mut self, chain: Q::Chain, event: &Event, ) -> StartResult<Q, PollEvent>

Start a nonblocking event-state poll.

Source

pub fn cancel_event( &mut self, chain: Q::Chain, event: &Event, ) -> StartResult<Q, CancelEvent>

Start event cancellation.

Source

pub fn destroy_event( &mut self, chain: Q::Chain, event: Event, ) -> StartResult<Q, DestroyEvent>

Start event release, consuming the handle until completion or failure recovery.

Auto Trait Implementations§

§

impl<Q> Freeze for GuestClient<Q>
where Q: Freeze, <Q as DriverQueue>::Chain: Freeze,

§

impl<Q> RefUnwindSafe for GuestClient<Q>

§

impl<Q> Send for GuestClient<Q>
where Q: Send, <Q as DriverQueue>::Chain: Send,

§

impl<Q> Sync for GuestClient<Q>
where Q: Sync, <Q as DriverQueue>::Chain: Sync,

§

impl<Q> Unpin for GuestClient<Q>
where Q: Unpin, <Q as DriverQueue>::Chain: Unpin,

§

impl<Q> UnsafeUnpin for GuestClient<Q>

§

impl<Q> UnwindSafe for GuestClient<Q>

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
§

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

§

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.

§

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.