Autotune
Module
Provides interfaces to adaptive compilation in Mojo.
autotune
autotune[T: AnyType, *Ts: AnyType](value: T, values: !pop.pack<Ts>) -> T
Fork compilation to evaluate each of the provided values.
Parameters:
- T (
AnyType
): The first value type. - Ts (
*AnyType
): The types of the rest of the parameters.
Args:
- value (
T
): The first value in the pack. - values (
!pop.pack<Ts>
): The tail values.
Returns:
The value being used in the current compilation fork.
autotune_fork
autotune_fork[type: AnyType, *values: type]()
Fork compilation to evaluate each of the provided values.
Return parameters: out: The value being used in the current compilation fork.
Parameters:
- type (
AnyType
): The type of the parameters to be evaluated. - values (
*type
): A list of parameters to be evaluated.
search
search[fn_type: AnyType, candidates: VariadicList[fn_type], evaluator: fn(Pointer[fn_type], Int) -> Int]()
Find the best implementation among all candidates.
The function runs the search among the list of candidates using the provided evaluator. The evaluator function needs to take two inputs: a pointer to array of all candidates and the size of that array - and return an index of the best candidate.
Return parameters: The best found candidate.
Parameters:
- fn_type (
AnyType
): The signature type of the function. - candidates (
VariadicList[fn_type]
): A list of candidates to search from. - evaluator (
fn(Pointer[fn_type], Int) -> Int
): The evaluator function.