Skip to main content

Precision

Enum Precision 

Source
pub enum Precision {
    Fp32,
    Tf32,
    Bf16,
}
Expand description

Numeric mode for the whole pipeline

The variant docs describe the CUDA backend. On Apple silicon (the Metal backend), Fp32 runs every stage in FP32, Bf16 runs only the vision backbone and both necks in BF16 (FP32 accumulation and residual stream) and every later stage in FP32, since Apple GPUs run FP32 matrix math within about 20% of BF16, and Tf32 is rejected

Variants§

§

Fp32

Strict FP32 (no TF32 or BF16 anywhere): the parity reference path. cuBLAS GEMMs run in pedantic math and cuBLASLt linears with FP32 compute, with bias and activations fused into their epilogues. The vision backbone’s attention runs a fused flash-attention kernel on FP32 FMAs with an online softmax, so it never writes the score matrix; the detector’s attention stays materialized

§

Tf32

The FP32 path with TF32 tensor-core GEMMs (FP32 accumulation), the way ONNX Runtime’s CUDA provider runs FP32 models by default, with FP32 weights and activations and bias and activations fused into cuBLASLt epilogues. Attention without a causal mask or additive bias, the detector’s box-biased cross-attention included, runs a fused flash-attention kernel on TF32 tensor cores with an FP32 softmax; the rest stays materialized. CUDA only

The first call of each GEMM shape times cuBLASLt’s top candidate algorithms and switches from its first choice only to one more than 5% faster. A candidate near that margin can win in one run and lose in the next, so outputs can differ slightly between runs (about 0.00001 in score)

§

Bf16

Tensor-core GEMMs with FP32 accumulation. The vision backbone, necks, text encoder MLP and fusion encoder FFN keep BF16 weights and activations; the rest of the text encoder and fusion encoder, the detector and point decoder keep FP32 ones, and cuBLAS may round their GEMM inputs to BF16 (CUBLAS_COMPUTE_32F_FAST_16BF), though it picks TF32 kernels for most of them. Unmasked attention with head dim 32 or 64, and the detector’s box-biased cross-attention, run the fused kernel. It computes scores from BF16 q and k as they are, or rounds FP32 q and k to FP16 and sums their scores in FP16; either way it rounds v to FP16 and sums each 64-key P @ V tile in FP16 before adding it to FP32 totals

Implementations§

Source§

impl Precision

Source

pub fn as_str(self) -> &'static str

The mode’s name, which parse reads back: "fp32", "tf32" or "bf16"

Trait Implementations§

Source§

impl Clone for Precision

Source§

fn clone(&self) -> Self

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 Precision

Source§

impl Debug for Precision

Source§

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

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

impl Display for Precision

Source§

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

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

impl Eq for Precision

Source§

impl FromStr for Precision

Source§

type Err = Report

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self>

Parses a string s to return a value of this type. Read more
Source§

impl PartialEq for Precision

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Precision

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.