pub struct TunableSet<K, F, Output>where
K: AutotuneKey,
F: TuneInputs,
Output: 'static,{ /* private fields */ }Expand description
A set of candidate tunable functions for autotune, sharing a key generator and an
input generator. See TuneInputs for the F parameter.
Implementations§
Source§impl<K, F, Output> TunableSet<K, F, Output>where
K: AutotuneKey,
F: TuneInputs,
Output: 'static,
impl<K, F, Output> TunableSet<K, F, Output>where
K: AutotuneKey,
F: TuneInputs,
Output: 'static,
Sourcepub fn new(
key_gen: impl KeyGenerator<K, F>,
input_gen: impl InputGenerator<K, F>,
) -> TunableSet<K, F, Output>
pub fn new( key_gen: impl KeyGenerator<K, F>, input_gen: impl InputGenerator<K, F>, ) -> TunableSet<K, F, Output>
Create a tunable set from a key generator and an input generator.
Sourcepub fn with_stack_tuning(
self,
reference: usize,
revision: &str,
workload: impl for<'a> Fn(&<F as TuneInputs>::At<'a>) -> String + Send + Sync + 'static,
) -> TunableSet<K, F, Output>
pub fn with_stack_tuning( self, reference: usize, revision: &str, workload: impl for<'a> Fn(&<F as TuneInputs>::At<'a>) -> String + Send + Sync + 'static, ) -> TunableSet<K, F, Output>
Register an exact workload signature and a known-safe reference for full-stack tuning. The input generator MUST isolate all mutable state for each benchmark invocation. Include dtype, exact shape/strides, precision, optional inputs and semantic parameters.
pub fn stack_reference(&self) -> Option<usize>
pub fn stack_workload<'a>( &self, inputs: &<F as TuneInputs>::At<'a>, ) -> Option<String>
Sourcepub fn new_cloning_inputs(
key_gen: impl KeyGenerator<K, F>,
) -> TunableSet<K, F, Output>
pub fn new_cloning_inputs( key_gen: impl KeyGenerator<K, F>, ) -> TunableSet<K, F, Output>
Shorthand for new with a [CloneInputGenerator]: benchmarks run
on clones of the real call inputs.
Sourcepub fn with(self, tunable: Tunable<K, F, Output>) -> TunableSet<K, F, Output>
pub fn with(self, tunable: Tunable<K, F, Output>) -> TunableSet<K, F, Output>
Register a tunable with this tunable set.
Sourcepub fn autotunables(&self) -> impl Iterator<Item = &TuneFn<F, Output>>
pub fn autotunables(&self) -> impl Iterator<Item = &TuneFn<F, Output>>
All candidate operations in this set, in registration order.
Sourcepub fn fastest(&self, fastest_index: usize) -> &TuneFn<F, Output>
pub fn fastest(&self, fastest_index: usize) -> &TuneFn<F, Output>
Returns the operation for the given index, matching the order returned by
autotunables. Tunables are tried in order, so index 0 should be a good default.
Sourcepub fn compute_checksum(&self) -> String
pub fn compute_checksum(&self) -> String
Compute a checksum that invalidates outdated cached auto-tune results when the set of tunable names changes.
Sourcepub fn stack_checksum(&self) -> String
pub fn stack_checksum(&self) -> String
Separate, length-delimited manifest for the opt-in full-stack cache.
Sourcepub fn generate_key<'a>(&self, inputs: &<F as TuneInputs>::At<'a>) -> K
pub fn generate_key<'a>(&self, inputs: &<F as TuneInputs>::At<'a>) -> K
Generate a key from a set of inputs
Sourcepub fn generate_inputs<'a>(
&self,
key: &K,
inputs: &<F as TuneInputs>::At<'a>,
) -> <F as TuneInputs>::At<'a>
pub fn generate_inputs<'a>( &self, key: &K, inputs: &<F as TuneInputs>::At<'a>, ) -> <F as TuneInputs>::At<'a>
Generate a set of test inputs from a key and reference inputs.