Struct burn::backend::wgpu::WgpuServer
pub struct WgpuServer<C>where
C: WgpuCompiler,{ /* private fields */ }
Expand description
Wgpu compute server.
Implementations§
§impl<C> WgpuServer<C>where
C: WgpuCompiler,
impl<C> WgpuServer<C>where
C: WgpuCompiler,
pub fn new(
memory_management: MemoryManagement<WgpuStorage>,
device: Arc<Device>,
queue: Arc<Queue>,
tasks_max: usize,
) -> WgpuServer<C>
pub fn new( memory_management: MemoryManagement<WgpuStorage>, device: Arc<Device>, queue: Arc<Queue>, tasks_max: usize, ) -> WgpuServer<C>
Create a new server.
Trait Implementations§
§impl<C> ComputeServer for WgpuServer<C>where
C: WgpuCompiler,
impl<C> ComputeServer for WgpuServer<C>where
C: WgpuCompiler,
§fn create(&mut self, data: &[u8]) -> Handle
fn create(&mut self, data: &[u8]) -> Handle
When we create a new handle from existing data, we use custom allocations so that we don’t have to execute the current pending tasks.
This is important, otherwise the compute passes are going to be too small and we won’t be able to fully utilize the GPU.
§fn sync(&mut self) -> impl Future<Output = ()> + 'static
fn sync(&mut self) -> impl Future<Output = ()> + 'static
Returns the total time of GPU work this sync completes.
§fn sync_elapsed(
&mut self,
) -> impl Future<Output = Result<Duration, TimestampsError>> + 'static
fn sync_elapsed( &mut self, ) -> impl Future<Output = Result<Duration, TimestampsError>> + 'static
Returns the total time of GPU work this sync completes.
§type Storage = WgpuStorage
type Storage = WgpuStorage
The storage type defines how data is stored and accessed.
§fn read(
&mut self,
binding: Binding,
) -> impl Future<Output = Vec<u8>> + Send + 'static
fn read( &mut self, binding: Binding, ) -> impl Future<Output = Vec<u8>> + Send + 'static
Given a handle, returns the owned resource as bytes.
§fn get_resource(&mut self, binding: Binding) -> BindingResource<WgpuServer<C>>
fn get_resource(&mut self, binding: Binding) -> BindingResource<WgpuServer<C>>
Given a resource handle, returns the storage resource.
§fn empty(&mut self, size: usize) -> Handle
fn empty(&mut self, size: usize) -> Handle
Reserves
size
bytes in the storage, and returns a handle over them.§unsafe fn execute(
&mut self,
kernel: <WgpuServer<C> as ComputeServer>::Kernel,
count: CubeCount,
bindings: Vec<Binding>,
mode: ExecutionMode,
)
unsafe fn execute( &mut self, kernel: <WgpuServer<C> as ComputeServer>::Kernel, count: CubeCount, bindings: Vec<Binding>, mode: ExecutionMode, )
§fn memory_usage(&self) -> MemoryUsage
fn memory_usage(&self) -> MemoryUsage
The current memory usage of the server.
§fn enable_timestamps(&mut self)
fn enable_timestamps(&mut self)
Enable collecting timestamps.
§fn disable_timestamps(&mut self)
fn disable_timestamps(&mut self)
Disable collecting timestamps.
Auto Trait Implementations§
impl<C> Freeze for WgpuServer<C>
impl<C> !RefUnwindSafe for WgpuServer<C>
impl<C> Send for WgpuServer<C>
impl<C> Sync for WgpuServer<C>
impl<C> Unpin for WgpuServer<C>where
C: Unpin,
impl<C> !UnwindSafe for WgpuServer<C>
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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