Skip to main content

CompilerSpec

Enum CompilerSpec 

Source
pub enum CompilerSpec {
    Identity {
        elements: usize,
    },
    Int8Identity {
        elements: usize,
        line_size: usize,
    },
    Fp8ToBf16 {
        format: Fp8Format,
        elements: usize,
    },
    Matmul {
        m: usize,
        k: usize,
        n: usize,
    },
    Fp8Matmul {
        format: Fp8Format,
        m: usize,
        k: usize,
        n: usize,
    },
    Int8Matmul {
        m: usize,
        k: usize,
        n: usize,
        left_zero_point: i8,
        right_zero_point: i8,
    },
    Int32ToInt8Rescale {
        elements: usize,
        multiplier: i32,
        shift: i8,
        output_zero_point: i8,
    },
    MaxPool2d {
        input_h: usize,
        input_w: usize,
        channels: usize,
        output_h: usize,
        output_w: usize,
        kernel_h: usize,
        kernel_w: usize,
        stride_h: usize,
        stride_w: usize,
    },
}
Expand description

A validated operator specialization ready for the compiler helper. Each variant names its input and output dtypes; the closed shape is integers only, so no guest bytes cross the boundary.

Variants§

§

Identity

BF16 → BF16 elementwise copy of elements values (a positive multiple of 1,024 values).

Fields

§elements: usize
§

Int8Identity

Exact INT8 → INT8 elementwise copy. line_size is the complete DMA line selected by admission; no tail staging or dtype conversion is permitted.

Fields

§elements: usize
§line_size: usize
§

Fp8ToBf16

Explicit FP8 storage conversion to BF16. Every finite source value is exactly representable, so the output is bit-exact except for permitted NaN canonicalization.

Fields

§format: Fp8Format
§elements: usize
§

Matmul

BF16 × BF16 → FP32 matrix multiply C[M, N] = A[M, K] · B[K, N] (batch 1). Each of m, k, n is a positive multiple of the corresponding MATMUL tile dimension and at most 512. The FP32 output is the TOSA-mandated accumulator (issue #82).

Fields

§

Fp8Matmul

Fused FP8 × FP8 → FP32 matrix multiply (batch 1): the graph’s explicit BF16 promotion is performed on the compute core, per L1 tile, instead of through DDR.

Numerically identical to CompilerSpec::Fp8ToBf16 followed by CompilerSpec::Matmul — FP8 → BF16 is exact for every encoding and the multiply is the same BF16 → FP32 kernel — so fusing is a placement choice, not a change of numerical contract. It removes the caller-visible BF16 tensors and their DDR round trip.

Fields

§format: Fp8Format
§

Int8Matmul

Exact zero-point-aware INT8 × INT8 → INT32 matrix multiply (batch 1).

The serialized TOSA zero points are part of the specialization and therefore also part of the compiler cache key. Arithmetic is (a - a_zp) * (b - b_zp) accumulated in INT32.

Fields

§left_zero_point: i8
§right_zero_point: i8
§

Int32ToInt8Rescale

Exact signed INT32 → INT8 scale32 RESCALE with one shared multiplier and shift.

Fields

§elements: usize
§multiplier: i32
§shift: i8
§output_zero_point: i8
§

MaxPool2d

Batch-1 BF16 NHWC MAX_POOL2D with zero padding and propagating NaNs. The complete static specialization is carried to the helper so no TOSA bytes cross the subprocess boundary.

Fields

§input_h: usize
§input_w: usize
§channels: usize
§output_h: usize
§output_w: usize
§kernel_h: usize
§kernel_w: usize
§stride_h: usize
§stride_w: usize

Trait Implementations§

Source§

impl Clone for CompilerSpec

Source§

fn clone(&self) -> CompilerSpec

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for CompilerSpec

Source§

impl Debug for CompilerSpec

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for CompilerSpec

Source§

impl Hash for CompilerSpec

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for CompilerSpec

Source§

fn eq(&self, other: &CompilerSpec) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for CompilerSpec

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.