cubecl_macros

Attribute Macro tune

Source
#[tune]
Expand description

Crates a tuning set with a specific signature. Should return a tuple of benchmark inputs.

§Arguments

  • name - the name of the generated operations struct (default: PascalCaseFnName)
  • key - the name of the key input parameter (default: key)
  • create_key - path to function that creates the key. If not specified, new must be implemented manually.
  • should_run - path to override function for the should_run function of the set.
  • operations - ordered list of operations returned by this tune set

§Example

#[tune(create_key = key_from_input, operations(operation_1, operation_2))]
pub fn my_operations(key: MyKey, input: JitTensor<f32, 4>) -> JitTensor<f32, 4> {
    let bench_input = random_tensor_like(input, -1.0, 1.0);
     
    (bench_input)
}

fn key_from_input(input: &JitTensor<f32, 4>) -> MyKey {
    MyKey::new(input.shape.dims)
}