Struct cubecl_core::channel::RefCellComputeChannel
source · pub struct RefCellComputeChannel<Server> { /* private fields */ }
Expand description
A channel using a ref cell to access the server with mutability.
§Important
Only use this channel if you don’t use any threading in your application, otherwise it will panic or cause undefined behaviors.
This is mosly useful for no-std
environments where threads aren’t supported, otherwise prefer
the mutex or the mpsc channels.
Implementations§
source§impl<Server> RefCellComputeChannel<Server>where
Server: ComputeServer,
impl<Server> RefCellComputeChannel<Server>where
Server: ComputeServer,
sourcepub fn new(server: Server) -> RefCellComputeChannel<Server>
pub fn new(server: Server) -> RefCellComputeChannel<Server>
Create a new cell compute channel.
Trait Implementations§
source§impl<S> Clone for RefCellComputeChannel<S>
impl<S> Clone for RefCellComputeChannel<S>
source§fn clone(&self) -> RefCellComputeChannel<S>
fn clone(&self) -> RefCellComputeChannel<S>
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> ComputeChannel<Server> for RefCellComputeChannel<Server>where
Server: ComputeServer + Send,
impl<Server> ComputeChannel<Server> for RefCellComputeChannel<Server>where
Server: ComputeServer + Send,
source§fn read(
&self,
binding: Binding<Server>,
) -> Pin<Box<dyn Future<Output = Vec<u8>> + Send>>
fn read( &self, binding: Binding<Server>, ) -> Pin<Box<dyn Future<Output = Vec<u8>> + Send>>
Given a binding, returns owned resource as bytes
source§fn get_resource(
&self,
binding: Binding<Server>,
) -> <<Server as ComputeServer>::Storage as ComputeStorage>::Resource
fn get_resource( &self, binding: Binding<Server>, ) -> <<Server as ComputeServer>::Storage as ComputeStorage>::Resource
Given a resource handle, return the storage resource.
source§fn create(&self, resource: &[u8]) -> Handle<Server>
fn create(&self, resource: &[u8]) -> Handle<Server>
Given a resource as bytes, stores it and returns the resource handle
source§fn empty(&self, size: usize) -> Handle<Server>
fn empty(&self, size: usize) -> Handle<Server>
Reserves
size
bytes in the storage, and returns a handle over themsource§unsafe fn execute(
&self,
kernel_description: <Server as ComputeServer>::Kernel,
count: <Server as ComputeServer>::DispatchOptions,
bindings: Vec<Binding<Server>>,
kind: ExecutionMode,
)
unsafe fn execute( &self, kernel_description: <Server as ComputeServer>::Kernel, count: <Server as ComputeServer>::DispatchOptions, bindings: Vec<Binding<Server>>, kind: ExecutionMode, )
source§impl<Server> Debug for RefCellComputeChannel<Server>where
Server: Debug,
impl<Server> Debug for RefCellComputeChannel<Server>where
Server: Debug,
impl<Server> Send for RefCellComputeChannel<Server>where
Server: ComputeServer,
This is unsafe, since no concurrency is supported by the RefCell
channel.
However using this channel should only be done in single threaded environments such as no-std
.
impl<Server> Sync for RefCellComputeChannel<Server>where
Server: ComputeServer,
Auto Trait Implementations§
impl<Server> Freeze for RefCellComputeChannel<Server>
impl<Server> !RefUnwindSafe for RefCellComputeChannel<Server>
impl<Server> Unpin for RefCellComputeChannel<Server>
impl<Server> !UnwindSafe for RefCellComputeChannel<Server>
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
)