cubecl_core::frontend

Trait Float

Source
pub trait Float:
    Numeric
    + Exp
    + Log
    + Log1p
    + Cos
    + Sin
    + Tanh
    + Powf
    + Sqrt
    + Round
    + Floor
    + Ceil
    + Erf
    + Recip
    + Magnitude
    + Normalize
    + Dot
    + Into<Self::ExpandType>
    + Add<Output = Self>
    + Sub<Output = Self>
    + Mul<Output = Self>
    + Div<Output = Self>
    + AddAssign
    + SubAssign
    + MulAssign
    + DivAssign
    + PartialOrd
    + PartialEq {
    const DIGITS: u32;
    const EPSILON: Self;
    const INFINITY: Self;
    const MANTISSA_DIGITS: u32;
    const MAX_10_EXP: i32;
    const MAX_EXP: i32;
    const MIN_10_EXP: i32;
    const MIN_EXP: i32;
    const MIN_POSITIVE: Self;
    const NAN: Self;
    const NEG_INFINITY: Self;
    const RADIX: u32;

    // Required methods
    fn new(val: f32) -> Self;
    fn vectorized(val: f32, vectorization: u32) -> Self;
    fn vectorized_empty(vectorization: u32) -> Self;
    fn __expand_vectorized_empty(
        context: &mut CubeContext,
        vectorization: u32,
    ) -> <Self as CubeType>::ExpandType;

    // Provided methods
    fn __expand_new(
        context: &mut CubeContext,
        val: f32,
    ) -> <Self as CubeType>::ExpandType { ... }
    fn __expand_vectorized(
        context: &mut CubeContext,
        val: f32,
        vectorization: u32,
    ) -> <Self as CubeType>::ExpandType { ... }
}
Expand description

Floating point numbers. Used as input in float kernels

Required Associated Constants§

Required Methods§

Source

fn new(val: f32) -> Self

Source

fn vectorized(val: f32, vectorization: u32) -> Self

Source

fn vectorized_empty(vectorization: u32) -> Self

Source

fn __expand_vectorized_empty( context: &mut CubeContext, vectorization: u32, ) -> <Self as CubeType>::ExpandType

Provided Methods§

Source

fn __expand_new( context: &mut CubeContext, val: f32, ) -> <Self as CubeType>::ExpandType

Source

fn __expand_vectorized( context: &mut CubeContext, val: f32, vectorization: u32, ) -> <Self as CubeType>::ExpandType

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Float for f32

Source§

const DIGITS: u32 = 6u32

Source§

const EPSILON: Self = 1.1920929E-7f32

Source§

const INFINITY: Self = +Inf_f32

Source§

const MANTISSA_DIGITS: u32 = 24u32

Source§

const MAX_10_EXP: i32 = 38i32

Source§

const MAX_EXP: i32 = 128i32

Source§

const MIN_10_EXP: i32 = -37i32

Source§

const MIN_EXP: i32 = -125i32

Source§

const MIN_POSITIVE: Self = 1.17549435E-38f32

Source§

const NAN: Self = NaN_f32

Source§

const NEG_INFINITY: Self = -Inf_f32

Source§

const RADIX: u32 = 2u32

Source§

fn new(val: f32) -> Self

Source§

fn vectorized(val: f32, _vectorization: u32) -> Self

Source§

fn vectorized_empty(vectorization: u32) -> Self

Source§

fn __expand_vectorized_empty( context: &mut CubeContext, vectorization: u32, ) -> <Self as CubeType>::ExpandType

Source§

impl Float for f64

Source§

const DIGITS: u32 = 15u32

Source§

const EPSILON: Self = 2.2204460492503131E-16f64

Source§

const INFINITY: Self = +Inf_f64

Source§

const MANTISSA_DIGITS: u32 = 53u32

Source§

const MAX_10_EXP: i32 = 308i32

Source§

const MAX_EXP: i32 = 1_024i32

Source§

const MIN_10_EXP: i32 = -307i32

Source§

const MIN_EXP: i32 = -1_021i32

Source§

const MIN_POSITIVE: Self = 2.2250738585072014E-308f64

Source§

const NAN: Self = NaN_f64

Source§

const NEG_INFINITY: Self = -Inf_f64

Source§

const RADIX: u32 = 2u32

Source§

fn new(val: f32) -> Self

Source§

fn vectorized(val: f32, _vectorization: u32) -> Self

Source§

fn vectorized_empty(vectorization: u32) -> Self

Source§

fn __expand_vectorized_empty( context: &mut CubeContext, vectorization: u32, ) -> <Self as CubeType>::ExpandType

Source§

impl Float for bf16

Source§

const DIGITS: u32 = 2u32

Source§

const EPSILON: Self = bf16::EPSILON

Source§

const INFINITY: Self = bf16::INFINITY

Source§

const MANTISSA_DIGITS: u32 = 8u32

Source§

const MAX_10_EXP: i32 = 38i32

Source§

const MAX_EXP: i32 = 128i32

Source§

const MIN_10_EXP: i32 = -37i32

Source§

const MIN_EXP: i32 = -125i32

Source§

const MIN_POSITIVE: Self = bf16::MIN_POSITIVE

Source§

const NAN: Self = bf16::NAN

Source§

const NEG_INFINITY: Self = bf16::NEG_INFINITY

Source§

const RADIX: u32 = 2u32

Source§

fn new(val: f32) -> Self

Source§

fn vectorized(val: f32, _vectorization: u32) -> Self

Source§

fn vectorized_empty(vectorization: u32) -> Self

Source§

fn __expand_vectorized_empty( context: &mut CubeContext, vectorization: u32, ) -> <Self as CubeType>::ExpandType

Source§

impl Float for f16

Source§

const DIGITS: u32 = 3u32

Source§

const EPSILON: Self = f16::EPSILON

Source§

const INFINITY: Self = f16::INFINITY

Source§

const MANTISSA_DIGITS: u32 = 11u32

Source§

const MAX_10_EXP: i32 = 4i32

Source§

const MAX_EXP: i32 = 16i32

Source§

const MIN_10_EXP: i32 = -4i32

Source§

const MIN_EXP: i32 = -13i32

Source§

const MIN_POSITIVE: Self = f16::MIN_POSITIVE

Source§

const NAN: Self = f16::NAN

Source§

const NEG_INFINITY: Self = f16::NEG_INFINITY

Source§

const RADIX: u32 = 2u32

Source§

fn new(val: f32) -> Self

Source§

fn vectorized(val: f32, _vectorization: u32) -> Self

Source§

fn vectorized_empty(vectorization: u32) -> Self

Source§

fn __expand_vectorized_empty( context: &mut CubeContext, vectorization: u32, ) -> <Self as CubeType>::ExpandType

Implementors§