cubecl-core 0.11.0-pre.1

CubeCL core create
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use cubecl_ir::{FastMath, Scope};
use enumset::EnumSet;

pub fn fast_math_expand<R>(
    scope: &Scope,
    value: EnumSet<FastMath>,
    body: impl FnOnce(&Scope) -> R,
) -> R {
    let prev = scope.state().modes.fp_math_mode;
    scope.state_mut().modes.fp_math_mode = value;
    let res = body(scope);
    scope.state_mut().modes.fp_math_mode = prev;

    res
}