Struct cubecl_core::client::ComputeClient
source · pub struct ComputeClient<Server, Channel>where
Server: ComputeServer,{ /* private fields */ }
Expand description
The ComputeClient is the entry point to require tasks from the ComputeServer. It should be obtained for a specific device via the Compute struct.
Implementations§
source§impl<Server, Channel> ComputeClient<Server, Channel>where
Server: ComputeServer,
Channel: ComputeChannel<Server>,
impl<Server, Channel> ComputeClient<Server, Channel>where
Server: ComputeServer,
Channel: ComputeChannel<Server>,
sourcepub fn new(
channel: Channel,
features: Arc<<Server as ComputeServer>::FeatureSet>,
) -> ComputeClient<Server, Channel>
pub fn new( channel: Channel, features: Arc<<Server as ComputeServer>::FeatureSet>, ) -> ComputeClient<Server, Channel>
Create a new client.
sourcepub async fn read_async(&self, binding: Binding<Server>) -> Vec<u8>
pub async fn read_async(&self, binding: Binding<Server>) -> Vec<u8>
Given a binding, returns owned resource as bytes.
sourcepub fn get_resource(
&self,
binding: Binding<Server>,
) -> <<Server as ComputeServer>::Storage as ComputeStorage>::Resource
pub fn get_resource( &self, binding: Binding<Server>, ) -> <<Server as ComputeServer>::Storage as ComputeStorage>::Resource
Given a resource handle, returns the storage resource.
sourcepub fn create(&self, data: &[u8]) -> Handle<Server>
pub fn create(&self, data: &[u8]) -> Handle<Server>
Given a resource, stores it and returns the resource handle.
sourcepub fn empty(&self, size: usize) -> Handle<Server>
pub fn empty(&self, size: usize) -> Handle<Server>
Reserves size
bytes in the storage, and returns a handle over them.
sourcepub fn execute(
&self,
kernel: <Server as ComputeServer>::Kernel,
count: <Server as ComputeServer>::DispatchOptions,
bindings: Vec<Binding<Server>>,
)
pub fn execute( &self, kernel: <Server as ComputeServer>::Kernel, count: <Server as ComputeServer>::DispatchOptions, bindings: Vec<Binding<Server>>, )
Executes the kernel
over the given bindings
.
sourcepub unsafe fn execute_unchecked(
&self,
kernel: <Server as ComputeServer>::Kernel,
count: <Server as ComputeServer>::DispatchOptions,
bindings: Vec<Binding<Server>>,
)
pub unsafe fn execute_unchecked( &self, kernel: <Server as ComputeServer>::Kernel, count: <Server as ComputeServer>::DispatchOptions, bindings: Vec<Binding<Server>>, )
Executes the kernel
over the given bindings
without performing any bound checks.
§Safety
Without checks, the out-of-bound reads and writes can happen.
sourcepub fn features(&self) -> &<Server as ComputeServer>::FeatureSet
pub fn features(&self) -> &<Server as ComputeServer>::FeatureSet
Get the features supported by the compute server.
Trait Implementations§
source§impl<S, C> Clone for ComputeClient<S, C>where
S: ComputeServer,
C: ComputeChannel<S>,
impl<S, C> Clone for ComputeClient<S, C>where
S: ComputeServer,
C: ComputeChannel<S>,
source§fn clone(&self) -> ComputeClient<S, C>
fn clone(&self) -> ComputeClient<S, C>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<Server, Channel> Debug for ComputeClient<Server, Channel>
impl<Server, Channel> Debug for ComputeClient<Server, Channel>
Auto Trait Implementations§
impl<Server, Channel> Freeze for ComputeClient<Server, Channel>where
Channel: Freeze,
impl<Server, Channel> RefUnwindSafe for ComputeClient<Server, Channel>
impl<Server, Channel> Send for ComputeClient<Server, Channel>where
Channel: Send,
impl<Server, Channel> Sync for ComputeClient<Server, Channel>where
Channel: Sync,
impl<Server, Channel> Unpin for ComputeClient<Server, Channel>where
Channel: Unpin,
impl<Server, Channel> UnwindSafe for ComputeClient<Server, Channel>
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
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)