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§
Provided Methods§
fn verify(_op: &dyn Op, _ctx: &Context) -> Result<()>where
Self: Sized,
fn should_lower(&self, _ctx: &Context) -> bool
Trait Implementations§
impl<T> OpInterfaceMarker for dyn LowerOp<T>
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
impl LowerOp for AtomicFSubOp
Source§impl LowerOp for AtomicISubOp
impl LowerOp for AtomicISubOp
Source§impl LowerOp for DeclareVariableOp
impl LowerOp for DeclareVariableOp
Source§impl LowerOp for ExclusiveFProdOp
impl LowerOp for ExclusiveFProdOp
Source§impl LowerOp for ExclusiveFSumOp
impl LowerOp for ExclusiveFSumOp
Source§impl LowerOp for ExclusiveIProdOp
impl LowerOp for ExclusiveIProdOp
Source§impl LowerOp for ExclusiveISumOp
impl LowerOp for ExclusiveISumOp
Source§impl LowerOp for FindFirstSetOp
impl LowerOp for FindFirstSetOp
Source§impl LowerOp for InclusiveFProdOp
impl LowerOp for InclusiveFProdOp
Source§impl LowerOp for InclusiveFSumOp
impl LowerOp for InclusiveFSumOp
Source§impl LowerOp for InclusiveIProdOp
impl LowerOp for InclusiveIProdOp
Source§impl LowerOp for InclusiveISumOp
impl LowerOp for InclusiveISumOp
Source§impl LowerOp for MagnitudeOp
impl LowerOp for MagnitudeOp
Source§impl LowerOp for NormalizeOp
impl LowerOp for NormalizeOp
Source§impl LowerOp for TrailingZerosBitsOp
impl LowerOp for TrailingZerosBitsOp
Source§impl LowerOp<Cuda> for CastOp
special cast function for recursive conversion in the case of minifloat to minifloat conversion
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:
| From | To | Extra args |
|---|---|---|
| f16/bf16/f32/f64 | e4m3/e5m2 | Interpretation, saturation |
| f16/bf16/f32/f64 | e3m2/e2m3/e2m1 | Interpretation, rounding |
| bf16/f32/f64 | e8m0 | saturation, rounding |
| e4m3/e5m2/e3m2/e2m3/e2m1 | f16 | Interpretation, |
| e8m0 | bf16 |
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