Skip to main content

DeviceStream

Trait DeviceStream 

Source
pub trait DeviceStream {
    type Fence: Fence + Send + 'static;
    type DeviceStorage: ComputeStorage;
    type HostStorage: ComputeStorage;
    type Signal: Copy;

    // Required methods
    fn device_memory(&mut self) -> &mut MemoryManagement<Self::DeviceStorage>;
    fn host_memory(&mut self) -> &mut MemoryManagement<Self::HostStorage>;
    fn drop_queue(&mut self) -> &mut PendingDropQueue<Self::Fence>;
    fn capturing(&mut self) -> &mut StreamCapture;
    fn info_cache(&mut self) -> &mut MetadataInfoCache<Handle>;
    fn signal(&self) -> Self::Signal;
    fn fence(signal: Self::Signal) -> Self::Fence;
}
Expand description

The state a backend’s stream keeps beside its driver handle.

All of it moves in step with the work queued on that stream, which is why it is the stream’s and not the device’s: the deferred frees a fenced flush releases, the capture window that forbids allocating, the per-launch info buffers a capture may not evict, and the memory the stream’s kernels see.

Required Associated Types§

Source

type Fence: Fence + Send + 'static

The fence this backend records on a stream. Fencing is how the drop queue knows the device is done with what it is holding.

Source

type DeviceStorage: ComputeStorage

The storage backing the memory this stream’s kernels address.

Source

type HostStorage: ComputeStorage

The storage backing the host buffers that stage transfers to it.

Source

type Signal: Copy

A cheap, copyable identifier for this stream.

It exists so a fence can be recorded while the stream’s own fields are borrowed: draining the drop queue needs a fresh fence per rotation, and the queue is reached through &mut self.

Required Methods§

Source

fn device_memory(&mut self) -> &mut MemoryManagement<Self::DeviceStorage>

The memory this stream’s kernels see. Allocations are per stream, so a buffer resolves to the stream that created it and nowhere else.

Source

fn host_memory(&mut self) -> &mut MemoryManagement<Self::HostStorage>

The pinned host memory this stream stages transfers through.

Source

fn drop_queue(&mut self) -> &mut PendingDropQueue<Self::Fence>

Frees deferred until the device is known to be done with them.

Source

fn capturing(&mut self) -> &mut StreamCapture

Where this stream sits in the graph-capture lifecycle.

Source

fn info_cache(&mut self) -> &mut MetadataInfoCache<Handle>

The per-launch metadata buffers this stream reuses.

Source

fn signal(&self) -> Self::Signal

This stream’s signal.

Source

fn fence(signal: Self::Signal) -> Self::Fence

Record a fence on the stream signal names, signalled once everything already enqueued on it has run.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§