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>
impl<'a, const N: usize, M: Mask> Runner<'a, N, M>
Sourcepub fn new(
exe: &'a Executable,
bound: &'a Bound<'a>,
backend: &'a mut dyn Backend,
derivatives: Option<&'a [[[u32; 4]; 2]]>,
) -> Self
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.
Sourcepub 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
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.
Sourcepub fn into_scratch(self) -> Scratch<N>
pub fn into_scratch(self) -> Scratch<N>
Give the registers back, to start the next runner of this program with.