Struct WgpuServer

Source
pub struct WgpuServer {
    pub compilation_options: WgpuCompilationOptions,
    /* private fields */
}
Expand description

Wgpu compute server.

Fields§

§compilation_options: WgpuCompilationOptions

Implementations§

Source§

impl WgpuServer

Source§

impl WgpuServer

Source

pub fn new( memory_properties: MemoryDeviceProperties, memory_config: MemoryConfiguration, compilation_options: WgpuCompilationOptions, device: Device, queue: Queue, tasks_max: usize, backend: Backend, time_measurement: TimeMeasurement, ) -> Self

Create a new server.

Trait Implementations§

Source§

impl ComputeServer for WgpuServer

Source§

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.

Source§

fn sync(&mut self) -> impl Future<Output = ()> + 'static

Returns the total time of GPU work this sync completes.

Source§

type Kernel = Box<dyn CubeTask<AutoCompiler>>

The kernel type defines the computation algorithms.
Source§

type Storage = WgpuStorage

The storage type defines how data is stored and accessed.
Source§

type Feature = Feature

The type of the features supported by the server.
Source§

type Info = Backend

Information that can be retrieved for the runtime.
Source§

fn read( &mut self, bindings: Vec<Binding>, ) -> impl Future<Output = Vec<Vec<u8>>> + Send + 'static

Given bindings, returns the owned resources as bytes.
Source§

fn get_resource(&mut self, binding: Binding) -> BindingResource<WgpuResource>

Given a resource handle, returns the storage resource.
Source§

fn empty(&mut self, size: usize) -> Handle

Reserves size bytes in the storage, and returns a handle over them.
Source§

unsafe fn execute( &mut self, kernel: Self::Kernel, count: CubeCount, bindings: Bindings, mode: ExecutionMode, )

Executes the kernel over the given memory handles. Read more
Source§

fn flush(&mut self)

Flush all outstanding tasks in the server.
Source§

fn start_profile(&mut self)

Enable collecting timestamps.
Source§

fn end_profile(&mut self) -> ProfileDuration

Disable collecting timestamps.
Source§

fn memory_usage(&self) -> MemoryUsage

The current memory usage of the server.
Source§

fn memory_cleanup(&mut self)

Ask the server to release memory that it can release.
Source§

fn read_tensor( &mut self, bindings: Vec<BindingWithMeta>, ) -> impl Future<Output = Vec<Vec<u8>>> + Send + 'static

Given tensor handles, returns the owned resources as bytes.
Source§

fn create_tensor( &mut self, data: &[u8], shape: &[usize], _elem_size: usize, ) -> (Handle, Vec<usize>)

Given a resource as bytes with shape, stores it and returns the tensor handle. May or may not be contiguous, depending on what’s best for the given runtime. Always use strides to index. For example, in CUDA, this will allocate a padded tensor where the last dimension is padded to the cache lines, so row access is faster.
Source§

fn empty_tensor( &mut self, shape: &[usize], elem_size: usize, ) -> (Handle, Vec<usize>)

Reserves shape bytes in the storage, and returns a handle to it.
Source§

impl Debug for WgpuServer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

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.

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.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,