Skip to main content

SchedulerStreamBackend

Trait SchedulerStreamBackend 

Source
pub trait SchedulerStreamBackend {
    type Task: Debug;
    type Stream: Debug + StreamMemory;
    type Factory: StreamFactory<Stream = Self::Stream>;

    // Required methods
    fn enqueue(
        task: Self::Task,
        stream: &mut Self::Stream,
        failures: &mut ErrorGraph,
    );
    fn flush(stream: &mut Self::Stream, failures: &mut ErrorGraph);
    fn factory(&mut self) -> &mut Self::Factory;

    // Provided method
    fn requires_isolation(_stream: &Self::Stream) -> bool { ... }
}
Expand description

Defines a trait for a scheduler stream backend, specifying the types and behavior for task scheduling.

Required Associated Types§

Source

type Task: Debug

Type representing a task.

Source

type Stream: Debug + StreamMemory

Type representing a stream, which exposes the memory its kernels see through StreamMemory.

Source

type Factory: StreamFactory<Stream = Self::Stream>

Type for the stream factory, which creates streams of type Self::Stream.

Required Methods§

Source

fn enqueue( task: Self::Task, stream: &mut Self::Stream, failures: &mut ErrorGraph, )

Enqueues a task onto a given stream for execution.

failures is the device’s failure store, handed down because running a task reserves memory (staging, uniforms), and reserving is where a pool sheds the failures its slices carry.

Source

fn flush(stream: &mut Self::Stream, failures: &mut ErrorGraph)

Flush the inner stream queue to ensure ordering between different streams.

Source

fn factory(&mut self) -> &mut Self::Factory

Returns a mutable reference to the stream factory.

Provided Methods§

Source

fn requires_isolation(_stream: &Self::Stream) -> bool

Whether this stream currently requires its own tasks to execute on itself — no interleaving of its tasks onto another stream, and no other stream’s tasks onto it. While any stream involved in an execution requires isolation, the scheduler falls back to the sequential path. A graph capture engages this for its whole prepare → record window. Defaults to false.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§