pub struct GuestClient<Q: DriverQueue>where
Q::Chain: DriverChainBuffer,{ /* 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>
impl<Q> GuestClient<Q>
Sourcepub fn new(queue: Q, config: GuestConfig) -> Result<Self, ClientInitError>
pub fn new(queue: Q, config: GuestConfig) -> Result<Self, ClientInitError>
Construct a client after transport feature and queue setup.
Sourcepub fn queue_state(&self) -> QueueState
pub fn queue_state(&self) -> QueueState
Current queue lifecycle snapshot.
Sourcepub const fn config(&self) -> GuestConfig
pub const fn config(&self) -> GuestConfig
Validated guest configuration.
Sourcepub const fn device_info(&self) -> Option<DeviceInfo>
pub const fn device_info(&self) -> Option<DeviceInfo>
Latest discovery result in the current epoch.
Sourcepub const fn health(&self) -> ClientHealth
pub const fn health(&self) -> ClientHealth
Current response-tracking health.
Sourcepub fn disable_used_notifications(&mut self) -> Result<(), QueueError<Q::Error>>
pub fn disable_used_notifications(&mut self) -> Result<(), QueueError<Q::Error>>
Disable used notifications before draining completions.
Sourcepub fn enable_used_notifications(
&mut self,
) -> Result<NotificationRecheck, QueueError<Q::Error>>
pub fn enable_used_notifications( &mut self, ) -> Result<NotificationRecheck, QueueError<Q::Error>>
Atomically enable used notifications and check for missed completions.
Sourcepub fn pump(&mut self) -> Result<PumpResult, QueueError<Q::Error>>
pub fn pump(&mut self) -> Result<PumpResult, QueueError<Q::Error>>
Consume and classify at most one used-ring entry.
Sourcepub fn poll<O: Operation>(
&mut self,
pending: Pending<O>,
) -> RequestPoll<O, Q::Chain, Q::Error, <Q::Chain as DriverChainBuffer>::Error>
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.
Sourcepub fn reset(
&mut self,
next_epoch: QueueEpoch,
) -> Result<Q::Reclaimed, QueueError<Q::Error>>
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.
Sourcepub fn reconfigure_queue(
&mut self,
size: QueueSize,
) -> Result<(), QueueSetupError<<Q as DriverQueue>::Error>>
pub fn reconfigure_queue( &mut self, size: QueueSize, ) -> Result<(), QueueSetupError<<Q as DriverQueue>::Error>>
Configure and ready the command queue after transport reset.
Sourcepub fn pop_recovered_completion(&mut self) -> Option<UsedChain<Q::Chain>>
pub fn pop_recovered_completion(&mut self) -> Option<UsedChain<Q::Chain>>
Recover one completion that had been popped before reset invalidated its pending token.
Sourcepub fn take_unexpected_completion(&mut self) -> Option<UsedChain<Q::Chain>>
pub fn take_unexpected_completion(&mut self) -> Option<UsedChain<Q::Chain>>
Recover the unexpected completion that forced reset.
Sourcepub fn get_device_info(
&mut self,
chain: Q::Chain,
) -> StartResult<Q, GetDeviceInfo>
pub fn get_device_info( &mut self, chain: Q::Chain, ) -> StartResult<Q, GetDeviceInfo>
Start protocol discovery.
Sourcepub fn create_context(
&mut self,
chain: Q::Chain,
) -> StartResult<Q, CreateContext>
pub fn create_context( &mut self, chain: Q::Chain, ) -> StartResult<Q, CreateContext>
Start context creation.
Sourcepub fn destroy_context(
&mut self,
chain: Q::Chain,
context: Context,
) -> StartResult<Q, DestroyContext>
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.
Sourcepub fn allocate_buffer(
&mut self,
chain: Q::Chain,
context: &Context,
desc: BufferDesc,
) -> StartResult<Q, AllocateBuffer>
pub fn allocate_buffer( &mut self, chain: Q::Chain, context: &Context, desc: BufferDesc, ) -> StartResult<Q, AllocateBuffer>
Start a bounded buffer allocation.
Sourcepub fn free_buffer(
&mut self,
chain: Q::Chain,
buffer: Buffer,
) -> StartResult<Q, FreeBuffer>
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.
Sourcepub fn write_buffer<R: ReadableBytes + ?Sized>(
&mut self,
chain: Q::Chain,
buffer: &Buffer,
offset: u64,
source: &R,
) -> StartResult<Q, WriteBuffer>
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.
Sourcepub fn write_buffer_prepared(
&mut self,
chain: Q::Chain,
buffer: &Buffer,
range: BufferRange,
) -> StartResult<Q, WriteBuffer>
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.
Sourcepub fn read_buffer(
&mut self,
chain: Q::Chain,
buffer: &Buffer,
range: BufferRange,
) -> StartResult<Q, ReadBuffer>
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.
Sourcepub fn load_program<R: ReadableBytes + ?Sized>(
&mut self,
chain: Q::Chain,
context: &Context,
desc: ProgramDesc,
artifact: &R,
) -> StartResult<Q, LoadProgram>
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.
Sourcepub fn load_program_prepared(
&mut self,
chain: Q::Chain,
context: &Context,
desc: ProgramDesc,
artifact_bytes: u64,
) -> StartResult<Q, LoadProgram>
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.
Sourcepub fn unload_program(
&mut self,
chain: Q::Chain,
program: Program,
) -> StartResult<Q, UnloadProgram>
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.
Sourcepub fn create_execution_queue(
&mut self,
chain: Q::Chain,
context: &Context,
) -> StartResult<Q, CreateExecutionQueue>
pub fn create_execution_queue( &mut self, chain: Q::Chain, context: &Context, ) -> StartResult<Q, CreateExecutionQueue>
Start creation of an accelerator execution queue.
Sourcepub fn destroy_execution_queue(
&mut self,
chain: Q::Chain,
queue: ExecutionQueue,
) -> StartResult<Q, DestroyExecutionQueue>
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.
Sourcepub fn submit(
&mut self,
chain: Q::Chain,
queue: &ExecutionQueue,
program: &Program,
bindings: &[Binding<'_>],
timeout_ns: u64,
) -> StartResult<Q, Submit>
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.
Sourcepub fn poll_event(
&mut self,
chain: Q::Chain,
event: &Event,
) -> StartResult<Q, PollEvent>
pub fn poll_event( &mut self, chain: Q::Chain, event: &Event, ) -> StartResult<Q, PollEvent>
Start a nonblocking event-state poll.
Sourcepub fn cancel_event(
&mut self,
chain: Q::Chain,
event: &Event,
) -> StartResult<Q, CancelEvent>
pub fn cancel_event( &mut self, chain: Q::Chain, event: &Event, ) -> StartResult<Q, CancelEvent>
Start event cancellation.
Sourcepub fn destroy_event(
&mut self,
chain: Q::Chain,
event: Event,
) -> StartResult<Q, DestroyEvent>
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.