Skip to main content

Runner

Struct Runner 

Source
pub struct Runner<'a, const N: usize, M: Mask = u8> { /* private fields */ }
Expand description

Runs an Executable for a 2 x 2 quad in lockstep (N = 4: lanes 0 and 1 the top row, 2 and 3 the bottom), as a GPU does: lanes that diverge are masked, a screen derivative is a difference inside the quad, a lane that is discarded goes on as a helper. Any other N runs that many invocations of their own (N = 1, one), in lockstep and masked where they diverge, each as it would run alone: its own steps and budget, a discard ending it, the derivatives of its inputs the ones the caller gives for every lane. A runner is reused for any number of runs.

Implementations§

Source§

impl<'a, const N: usize, M: Mask> Runner<'a, N, M>

Source

pub fn new( exe: &'a Executable, bound: &'a Bound<'a>, backend: &'a mut dyn Backend, derivatives: Option<&'a [[[u32; 4]; 2]]>, ) -> Self

A runner of exe over bound, answering requests through backend. Invocations of their own that read derivatives of their inputs take them in derivatives, the same for every lane; a quad takes its own.

Source

pub fn with_scratch( exe: &'a Executable, bound: &'a Bound<'a>, backend: &'a mut dyn Backend, derivatives: Option<&'a [[[u32; 4]; 2]]>, scratch: Scratch<N>, ) -> Self

Runner::new on registers kept from an earlier runner of the same program (Runner::into_scratch): the literals are already in them.

Source

pub fn into_scratch(self) -> Scratch<N>

Give the registers back, to start the next runner of this program with.

Source

pub fn run(&mut self, args: [&[[u32; 4]]; N]) -> Result<[Output; N], String>

Run once, each lane with its arguments (one register per entry argument, the lanes of its value first).

Source

pub fn run_first( &mut self, args: [&[[u32; 4]]; N], count: usize, ) -> Result<[Output; N], String>

Runner::run with lanes 0..count only; the outputs of the others are empty (independent invocations).

Trait Implementations§

Source§

impl<const N: usize, M: Mask> Debug for Runner<'_, N, M>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, const N: usize, M = u8> !RefUnwindSafe for Runner<'a, N, M>

§

impl<'a, const N: usize, M = u8> !Send for Runner<'a, N, M>

§

impl<'a, const N: usize, M = u8> !Sync for Runner<'a, N, M>

§

impl<'a, const N: usize, M = u8> !UnwindSafe for Runner<'a, N, M>

§

impl<'a, const N: usize, M> Forget for Runner<'a, N, M>

§

impl<'a, const N: usize, M> Freeze for Runner<'a, N, M>
where [u64; N]: Freeze, [Vec<[u32; 4]>; N]: Freeze, [Decision; N]: Freeze, M: Freeze,

§

impl<'a, const N: usize, M> Unpin for Runner<'a, N, M>
where [u64; N]: Unpin, [Vec<[u32; 4]>; N]: Unpin, [Decision; N]: Unpin, M: Unpin,

§

impl<'a, const N: usize, M> UnsafeUnpin for Runner<'a, N, M>

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.