Skip to main content

Emittable

Trait Emittable 

Source
pub trait Emittable: Differentiable + PartialEq {
    const ELEMENT: &'static str;
    const ZERO: &'static str;
    const NEGATIVE_INFINITY: &'static str;
    const ACCUMULATION: Option<&'static str> = None;

    // Required method
    fn literal(&self) -> String;
}
Expand description

An element type StableHLO emission can render: its MLIR type name and the literal forms MLIR’s float syntax accepts.

Finite values print in shortest-round-trip decimal (normalized to carry a dot, which MLIR requires); non-finite values print as IEEE bit-pattern hex, the only literal form MLIR has for them.

Required Associated Constants§

Source

const ELEMENT: &'static str

The MLIR element type name, such as f32.

Source

const ZERO: &'static str

The literal of the additive identity, seeding sum reduces and zero pads.

Source

const NEGATIVE_INFINITY: &'static str

The literal of negative infinity, seeding max reduces.

Provided Associated Constants§

Source

const ACCUMULATION: Option<&'static str> = None

The MLIR element type accumulating operations compute in before converting back, or None when they accumulate in the element type itself.

It must name the element’s Differentiable::Accumulator whenever that type differs from the element: matmuls, sum reductions, fold, and scatter then emit the wider result type with an explicit convert back — the precision is IR semantics, never an implementation’s private choice.

Required Methods§

Source

fn literal(&self) -> String

Formats this element as an MLIR literal.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Emittable for f32

Source§

const ELEMENT: &'static str = "f32"

Source§

const ZERO: &'static str = "0.0"

Source§

const NEGATIVE_INFINITY: &'static str = "0xFF800000"

Source§

fn literal(&self) -> String

Source§

impl Emittable for f64

Source§

const ELEMENT: &'static str = "f64"

Source§

const ZERO: &'static str = "0.0"

Source§

const NEGATIVE_INFINITY: &'static str = "0xFFF0000000000000"

Source§

fn literal(&self) -> String

Implementors§

Source§

impl Emittable for Bf16

Source§

const ELEMENT: &'static str = "bf16"

Source§

const ZERO: &'static str = "0.0"

Source§

const NEGATIVE_INFINITY: &'static str = "0xFF80"

Source§

const ACCUMULATION: Option<&'static str>