pub struct LocalTuner<AK: AutotuneKey, ID> { /* private fields */ }Expand description
A local tuner allows to create a tuner for a specific key that can be different from the server key.
Implementations§
Source§impl<AK, ID> LocalTuner<AK, ID>
impl<AK, ID> LocalTuner<AK, ID>
Sourcepub fn init<I, Out, Id, F>(
&self,
id: &ID,
init_set: F,
) -> Arc<TunableSet<AK, I, Out, Id>> ⓘwhere
F: Fn() -> TunableSet<AK, I, Out, Id> + 'static + Send + Sync,
Id: Send + Sync + 'static,
I: TuneInputs,
Out: AutotuneOutput,
pub fn init<I, Out, Id, F>(
&self,
id: &ID,
init_set: F,
) -> Arc<TunableSet<AK, I, Out, Id>> ⓘwhere
F: Fn() -> TunableSet<AK, I, Out, Id> + 'static + Send + Sync,
Id: Send + Sync + 'static,
I: TuneInputs,
Out: AutotuneOutput,
Get or initialize the TunableSet for id.
Returns a cached Arc<TunableSet> keyed by the TypeId of init_set
and by id, so the initializer runs once per device rather than once
per process.
The device is part of the key because a set is routinely built from the
device it will run on: a closure captures that device’s
Client to ask what it supports, or reads its hardware
properties to decide which tunables are worth offering at all. Keyed by
the initializer alone, whichever device tuned first would answer those
questions for every device that followed — promoting kernels onto
hardware that cannot run them, or withholding kernels from hardware
that can.
Sourcepub fn fastest_identity<I, Out, Id>(
&self,
id: &ID,
operations: &TunableSet<AK, I, Out, Id>,
key: &AK,
) -> Option<Id>where
I: TuneInputs,
Id: Clone,
pub fn fastest_identity<I, Out, Id>(
&self,
id: &ID,
operations: &TunableSet<AK, I, Out, Id>,
key: &AK,
) -> Option<Id>where
I: TuneInputs,
Id: Clone,
What the fastest tunable in operations for key on id is
identified by: None until a result for the key is
settled — tuned by a round in this process, or read back from disk and validated by an
execute.
operations must be the set id executes, as init returns it for the
initializer execute is handed: a result is an index into that set, and results are kept
per id alone, so a set another initializer built under the same id would map it onto
another tunable.
It reads results and never produces one: it never starts a round, never waits on one in
flight, never validates a persisted result, and never resets the tuner’s cache after an
environment switch — it reports nothing settled there until the next execute.
Sourcepub fn execute<'a, I: TuneInputs, Out, Id>(
&self,
id: &ID,
client: &Client,
operations: Arc<TunableSet<AK, I, Out, Id>>,
inputs: <I as TuneInputs>::At<'a>,
) -> Out
pub fn execute<'a, I: TuneInputs, Out, Id>( &self, id: &ID, client: &Client, operations: Arc<TunableSet<AK, I, Out, Id>>, inputs: <I as TuneInputs>::At<'a>, ) -> Out
Execute the fastest operation in a TunableSet, triggering a tuning pass on
the first call for a given key.
Auto Trait Implementations§
impl<AK, ID> !Freeze for LocalTuner<AK, ID>
impl<AK, ID> RefUnwindSafe for LocalTuner<AK, ID>
impl<AK, ID> Send for LocalTuner<AK, ID>
impl<AK, ID> Sync for LocalTuner<AK, ID>
impl<AK, ID> Unpin for LocalTuner<AK, ID>
impl<AK, ID> UnsafeUnpin for LocalTuner<AK, ID>
impl<AK, ID> UnwindSafe for LocalTuner<AK, ID>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more