Skip to main content

LowerOp

Trait LowerOp 

Source
pub trait LowerOp<T = Shared>: Op {
    // Required method
    fn lower(&self, scope: &Scope) -> Vec<Value>;

    // Provided methods
    fn verify(_op: &dyn Op, _ctx: &Context) -> Result<()>
       where Self: Sized { ... }
    fn should_lower(&self, _ctx: &Context) -> bool { ... }
}

Required Methods§

Source

fn lower(&self, scope: &Scope) -> Vec<Value>

Provided Methods§

Source

fn verify(_op: &dyn Op, _ctx: &Context) -> Result<()>
where Self: Sized,

Source

fn should_lower(&self, _ctx: &Context) -> bool

Trait Implementations§

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl LowerOp for AtomicFSubOp

Source§

fn should_lower(&self, ctx: &Context) -> bool

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp for AtomicISubOp

Source§

fn should_lower(&self, ctx: &Context) -> bool

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp for AtomicStoreOp

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp for AtomicUniformLoadOp

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp for CastOp

Source§

fn should_lower(&self, ctx: &Context) -> bool

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp for DeclareVariableOp

Source§

fn should_lower(&self, _ctx: &Context) -> bool

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp for DegreesOp

Source§

fn should_lower(&self, ctx: &Context) -> bool

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp for Dp4aOp

Source§

fn should_lower(&self, ctx: &Context) -> bool

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp for ErfOp

Source§

fn should_lower(&self, ctx: &Context) -> bool

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp for ExclusiveFProdOp

Source§

fn should_lower(&self, ctx: &Context) -> bool

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp for ExclusiveFSumOp

Source§

fn should_lower(&self, ctx: &Context) -> bool

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp for ExclusiveIProdOp

Source§

fn should_lower(&self, ctx: &Context) -> bool

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp for ExclusiveISumOp

Source§

fn should_lower(&self, ctx: &Context) -> bool

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp for FDotOp

Source§

fn should_lower(&self, ctx: &Context) -> bool

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp for FMaxOp

Source§

fn should_lower(&self, ctx: &Context) -> bool

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp for FMinOp

Source§

fn should_lower(&self, ctx: &Context) -> bool

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp for FProdOp

Source§

fn should_lower(&self, ctx: &Context) -> bool

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp for FSumOp

Source§

fn should_lower(&self, ctx: &Context) -> bool

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp for FSumOp

Source§

fn should_lower(&self, ctx: &Context) -> bool

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp for FindFirstSetOp

Source§

fn should_lower(&self, ctx: &Context) -> bool

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp for IProdOp

Source§

fn should_lower(&self, ctx: &Context) -> bool

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp for ISumOp

Source§

fn should_lower(&self, ctx: &Context) -> bool

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp for ISumOp

Source§

fn should_lower(&self, ctx: &Context) -> bool

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp for InclusiveFProdOp

Source§

fn should_lower(&self, ctx: &Context) -> bool

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp for InclusiveFSumOp

Source§

fn should_lower(&self, ctx: &Context) -> bool

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp for InclusiveIProdOp

Source§

fn should_lower(&self, ctx: &Context) -> bool

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp for InclusiveISumOp

Source§

fn should_lower(&self, ctx: &Context) -> bool

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp for Log1pOp

Source§

fn should_lower(&self, ctx: &Context) -> bool

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp for MagnitudeOp

Source§

fn should_lower(&self, ctx: &Context) -> bool

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp for NormalizeOp

Source§

fn should_lower(&self, ctx: &Context) -> bool

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp for PowiOp

Source§

fn should_lower(&self, ctx: &Context) -> bool

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp for RadiansOp

Source§

fn should_lower(&self, ctx: &Context) -> bool

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp for RecipOp

Source§

fn should_lower(&self, ctx: &Context) -> bool

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp for SDotOp

Source§

fn should_lower(&self, ctx: &Context) -> bool

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp for SMaxOp

Source§

fn should_lower(&self, ctx: &Context) -> bool

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp for SMinOp

Source§

fn should_lower(&self, ctx: &Context) -> bool

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp for TrailingZerosBitsOp

Source§

fn should_lower(&self, ctx: &Context) -> bool

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp for UDotOp

Source§

fn should_lower(&self, ctx: &Context) -> bool

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp for UMaxOp

Source§

fn should_lower(&self, ctx: &Context) -> bool

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp for UMinOp

Source§

fn should_lower(&self, ctx: &Context) -> bool

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp for UniformLoadOp

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp<Cuda> for CastOp

special cast function for recursive conversion in the case of minifloat to minifloat conversion

Needs to jump through a lot of hoops to deal with CUDA nonsense. The overview of available conversions is as follows:

FromToExtra args
f16/bf16/f32/f64e4m3/e5m2Interpretation, saturation
f16/bf16/f32/f64e3m2/e2m3/e2m1Interpretation, rounding
bf16/f32/f64e8m0saturation, rounding
e4m3/e5m2/e3m2/e2m3/e2m1f16Interpretation,
e8m0bf16

When the input and output don’t match these options, we need to do a two-step conversion. When the input is a minifloat we always need to cast out to f16/bf16, and then convert to the actual out type if it differs. Trying to cast ints also requires an extra conversion, and so does f16 to e8m0 (though it’s not recommended to do that anyways, you should be using e5m2 for that since you don’t have 8 bits of exponent in f16).

See also: https://docs.nvidia.com/cuda/cuda-math-api/cuda_math_api/group__CUDA__MATH__FP8__MISC.html https://docs.nvidia.com/cuda/cuda-math-api/cuda_math_api/group__CUDA__MATH__FP6__MISC.html https://docs.nvidia.com/cuda/cuda-math-api/cuda_math_api/group__CUDA__MATH__FP4__MISC.html

Source§

fn should_lower(&self, ctx: &Context) -> bool

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp<Cuda> for ColIndexOp

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp<Cuda> for CommitCopyAsyncOp

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp<Cuda> for CopyAsyncOp

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp<Cuda> for Dp4aOp

Source§

fn should_lower(&self, ctx: &Context) -> bool

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp<Cuda> for ElectOp

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp<Cuda> for InlineAsmOp

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp<Cuda> for LdMatrixOp

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp<Cuda> for MmaManualOp

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp<Cuda> for MmaManualScaledOp

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp<Cuda> for RowIndexOp

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp<Cuda> for SaturatingSAddOp

Source§

fn should_lower(&self, ctx: &Context) -> bool

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp<Cuda> for SaturatingSSubOp

Source§

fn should_lower(&self, ctx: &Context) -> bool

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp<Cuda> for StMatrixOp

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp<Cuda> for TmaLoadIm2colOp

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp<Hip> for BallotOp

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp<Hip> for ColIndexOp

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp<Hip> for ElectOp

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp<Hip> for FMaxOp

Source§

fn should_lower(&self, ctx: &Context) -> bool

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp<Hip> for FMinOp

Source§

fn should_lower(&self, ctx: &Context) -> bool

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp<Hip> for RowIndexOp

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp<Hip> for TanhOp

Source§

fn should_lower(&self, ctx: &Context) -> bool

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp<Metal> for BallotOp

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp<Metal> for Expm1Op

Source§

fn should_lower(&self, ctx: &Context) -> bool

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp<Metal> for SMulHiOp

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp<Metal> for TanhOp

Source§

fn should_lower(&self, ctx: &Context) -> bool

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Source§

impl LowerOp<Metal> for UMulHiOp

Source§

fn lower(&self, scope: &Scope) -> Vec<Value>

Implementors§