cubecl_core/frontend/options.rs
1use cubecl_ir::{FastMath, Scope};
2use enumset::EnumSet;
3
4pub fn fast_math_expand<R>(
5 scope: &mut Scope,
6 value: EnumSet<FastMath>,
7 body: impl FnOnce(&mut Scope) -> R,
8) -> R {
9 let prev = scope.modes.borrow().fp_math_mode;
10 scope.modes.borrow_mut().fp_math_mode = value;
11 let res = body(scope);
12 scope.modes.borrow_mut().fp_math_mode = prev;
13
14 res
15}