Skip to main content

Shim

Trait Shim 

Source
pub trait Shim {
    // Required methods
    fn name(&self) -> String;
    fn supports(&self, class: ClassId) -> Support;
    fn fits(&self, op: &Op, g: &TensorGraph) -> Result<(), String>;
    fn numerics(&self) -> Option<Contract>;

    // Provided methods
    fn activation(
        &self,
        _consumer: &Op,
        _operand: usize,
        _g: &TensorGraph,
    ) -> Option<QuantFormat> { ... }
    fn rules(&self) -> Vec<(Position, ChipRule<'_>)> { ... }
}
Expand description

What a chip allows.

Required Methods§

Source

fn name(&self) -> String

The chip and the configuration it answers for, e.g. cuda-lane:rtx3060:TwoPassInt8.

Source

fn supports(&self, class: ClassId) -> Support

What the chip’s link does with class. Every chip answers by a match over every class with no catch-all arm, so a class added to the registry fails the build until each chip answers it.

Source

fn fits(&self, op: &Op, g: &TensorGraph) -> Result<(), String>

Whether the chip’s link builds op as it stands — its shapes, its accesses, its destination: Ok, or why not.

Source

fn numerics(&self) -> Option<Contract>

The numerics contract of the knob point the chip answers for, or None while the chip has not declared it.

Provided Methods§

Source

fn activation( &self, _consumer: &Op, _operand: usize, _g: &TensorGraph, ) -> Option<QuantFormat>

The quantized form consumer reads its operand operand in, or None for one it reads as its values.

Source

fn rules(&self) -> Vec<(Position, ChipRule<'_>)>

The chip’s own rules, each linked into the table where its position says.

Implementors§