pub trait PrimOps {
Show 66 methods
// Required method
fn to_expr_result(&self) -> ExprResult;
// Provided methods
fn less(&self, rhs: impl Operand) -> ExprResult { ... }
fn less_equal(&self, rhs: impl Operand) -> ExprResult { ... }
fn greater(&self, rhs: impl Operand) -> ExprResult { ... }
fn greater_equal(&self, rhs: impl Operand) -> ExprResult { ... }
fn equal(&self, rhs: impl Operand) -> ExprResult { ... }
fn not_equal(&self, rhs: impl Operand) -> ExprResult { ... }
fn logical_and(&self, rhs: impl IntoExpr<PrimExpr>) -> ExprResult { ... }
fn logical_or(&self, rhs: impl IntoExpr<PrimExpr>) -> ExprResult { ... }
fn div(&self, rhs: impl Operand) -> ExprResult { ... }
fn truncdiv(&self, rhs: impl Operand) -> ExprResult { ... }
fn truncmod(&self, rhs: impl Operand) -> ExprResult { ... }
fn floordiv(&self, rhs: impl Operand) -> ExprResult { ... }
fn floormod(&self, rhs: impl Operand) -> ExprResult { ... }
fn indexdiv(&self, rhs: impl Operand) -> ExprResult { ... }
fn indexmod(&self, rhs: impl Operand) -> ExprResult { ... }
fn ceildiv(&self, rhs: impl Operand) -> ExprResult { ... }
fn min(&self, rhs: impl Operand) -> ExprResult { ... }
fn max(&self, rhs: impl Operand) -> ExprResult { ... }
fn pow(&self, rhs: impl IntoExpr<PrimExpr>) -> ExprResult { ... }
fn fmod(&self, rhs: impl IntoExpr<PrimExpr>) -> ExprResult { ... }
fn atan2(&self, rhs: impl IntoExpr<PrimExpr>) -> ExprResult { ... }
fn nextafter(&self, rhs: impl IntoExpr<PrimExpr>) -> ExprResult { ... }
fn copysign(&self, rhs: impl IntoExpr<PrimExpr>) -> ExprResult { ... }
fn hypot(&self, rhs: impl IntoExpr<PrimExpr>) -> ExprResult { ... }
fn ldexp(&self, rhs: impl IntoExpr<PrimExpr>) -> ExprResult { ... }
fn bitwise_not(&self) -> ExprResult { ... }
fn floor(&self) -> ExprResult { ... }
fn ceil(&self) -> ExprResult { ... }
fn round(&self) -> ExprResult { ... }
fn nearbyint(&self) -> ExprResult { ... }
fn trunc(&self) -> ExprResult { ... }
fn abs(&self) -> ExprResult { ... }
fn isnan(&self) -> ExprResult { ... }
fn isinf(&self) -> ExprResult { ... }
fn isfinite(&self) -> ExprResult { ... }
fn likely(&self) -> ExprResult { ... }
fn assume(&self) -> ExprResult { ... }
fn clz(&self) -> ExprResult { ... }
fn exp(&self) -> ExprResult { ... }
fn exp2(&self) -> ExprResult { ... }
fn exp10(&self) -> ExprResult { ... }
fn erf(&self) -> ExprResult { ... }
fn sigmoid(&self) -> ExprResult { ... }
fn sqrt(&self) -> ExprResult { ... }
fn rsqrt(&self) -> ExprResult { ... }
fn log(&self) -> ExprResult { ... }
fn log2(&self) -> ExprResult { ... }
fn log10(&self) -> ExprResult { ... }
fn log1p(&self) -> ExprResult { ... }
fn popcount(&self) -> ExprResult { ... }
fn tanh(&self) -> ExprResult { ... }
fn tan(&self) -> ExprResult { ... }
fn cos(&self) -> ExprResult { ... }
fn cosh(&self) -> ExprResult { ... }
fn sin(&self) -> ExprResult { ... }
fn sinh(&self) -> ExprResult { ... }
fn asin(&self) -> ExprResult { ... }
fn acos(&self) -> ExprResult { ... }
fn atan(&self) -> ExprResult { ... }
fn acosh(&self) -> ExprResult { ... }
fn asinh(&self) -> ExprResult { ... }
fn atanh(&self) -> ExprResult { ... }
fn cast(&self, ty: impl IntoArg<PrimType>) -> ExprResult { ... }
fn if_then_else(
&self,
t: impl IntoExpr<PrimExpr>,
f: impl IntoExpr<PrimExpr>,
) -> ExprResult { ... }
fn select(
&self,
t: impl IntoExpr<PrimExpr>,
f: impl IntoExpr<PrimExpr>,
) -> ExprResult { ... }
}Expand description
The operations Rust has no operator for, as methods of ExprResult and every expression
handle.
The comparisons are named less, equal and so on, since Rust’s eq and lt return a
bool.
§Examples
use tvm_tirx::ir::prim::op::PrimOps;
use tvm_tirx::ir::{PrimExpr, PrimType, PrimVar, Var, UNKNOWN_LOC};
use tvm_tirx::script::script;
let i = PrimVar::new("i", PrimType::int(32), UNKNOWN_LOC);
let n = PrimVar::new("n", PrimType::int(32), UNKNOWN_LOC);
let in_bounds = PrimExpr::try_from(i.greater_equal(0).logical_and(i.less(&n)))?;
assert_eq!(script(&in_bounds)?, "i >= 0 and i < n");Required Methods§
Sourcefn to_expr_result(&self) -> ExprResult
fn to_expr_result(&self) -> ExprResult
Return this expression as an ExprResult.
Provided Methods§
Sourcefn less(&self, rhs: impl Operand) -> ExprResult
fn less(&self, rhs: impl Operand) -> ExprResult
Build the boolean self < rhs (lt).
Sourcefn less_equal(&self, rhs: impl Operand) -> ExprResult
fn less_equal(&self, rhs: impl Operand) -> ExprResult
Build the boolean self <= rhs (le).
Sourcefn greater(&self, rhs: impl Operand) -> ExprResult
fn greater(&self, rhs: impl Operand) -> ExprResult
Build the boolean self > rhs (gt).
Sourcefn greater_equal(&self, rhs: impl Operand) -> ExprResult
fn greater_equal(&self, rhs: impl Operand) -> ExprResult
Build the boolean self >= rhs (ge).
Sourcefn equal(&self, rhs: impl Operand) -> ExprResult
fn equal(&self, rhs: impl Operand) -> ExprResult
Build the boolean self == rhs (eq).
Sourcefn not_equal(&self, rhs: impl Operand) -> ExprResult
fn not_equal(&self, rhs: impl Operand) -> ExprResult
Build the boolean self != rhs (ne).
Sourcefn logical_and(&self, rhs: impl IntoExpr<PrimExpr>) -> ExprResult
fn logical_and(&self, rhs: impl IntoExpr<PrimExpr>) -> ExprResult
Build the boolean self && rhs (logical_and).
Sourcefn logical_or(&self, rhs: impl IntoExpr<PrimExpr>) -> ExprResult
fn logical_or(&self, rhs: impl IntoExpr<PrimExpr>) -> ExprResult
Build the boolean self || rhs (logical_or).
Sourcefn div(&self, rhs: impl Operand) -> ExprResult
fn div(&self, rhs: impl Operand) -> ExprResult
Build div(self, rhs).
Sourcefn truncdiv(&self, rhs: impl Operand) -> ExprResult
fn truncdiv(&self, rhs: impl Operand) -> ExprResult
Build truncdiv(self, rhs).
Sourcefn truncmod(&self, rhs: impl Operand) -> ExprResult
fn truncmod(&self, rhs: impl Operand) -> ExprResult
Build truncmod(self, rhs).
Sourcefn floordiv(&self, rhs: impl Operand) -> ExprResult
fn floordiv(&self, rhs: impl Operand) -> ExprResult
Build floordiv(self, rhs).
Sourcefn floormod(&self, rhs: impl Operand) -> ExprResult
fn floormod(&self, rhs: impl Operand) -> ExprResult
Build floormod(self, rhs).
Sourcefn indexdiv(&self, rhs: impl Operand) -> ExprResult
fn indexdiv(&self, rhs: impl Operand) -> ExprResult
Build indexdiv(self, rhs).
Sourcefn indexmod(&self, rhs: impl Operand) -> ExprResult
fn indexmod(&self, rhs: impl Operand) -> ExprResult
Build indexmod(self, rhs).
Sourcefn ceildiv(&self, rhs: impl Operand) -> ExprResult
fn ceildiv(&self, rhs: impl Operand) -> ExprResult
Build ceildiv(self, rhs).
Sourcefn min(&self, rhs: impl Operand) -> ExprResult
fn min(&self, rhs: impl Operand) -> ExprResult
Build min(self, rhs).
Sourcefn max(&self, rhs: impl Operand) -> ExprResult
fn max(&self, rhs: impl Operand) -> ExprResult
Build max(self, rhs).
Sourcefn bitwise_not(&self) -> ExprResult
fn bitwise_not(&self) -> ExprResult
Build bitwise_not(self).
Sourcefn floor(&self) -> ExprResult
fn floor(&self) -> ExprResult
Build floor(self).
Sourcefn ceil(&self) -> ExprResult
fn ceil(&self) -> ExprResult
Build ceil(self).
Sourcefn round(&self) -> ExprResult
fn round(&self) -> ExprResult
Build round(self).
Sourcefn nearbyint(&self) -> ExprResult
fn nearbyint(&self) -> ExprResult
Build nearbyint(self).
Sourcefn trunc(&self) -> ExprResult
fn trunc(&self) -> ExprResult
Build trunc(self).
Sourcefn abs(&self) -> ExprResult
fn abs(&self) -> ExprResult
Build abs(self).
Sourcefn isnan(&self) -> ExprResult
fn isnan(&self) -> ExprResult
Build isnan(self).
Sourcefn isinf(&self) -> ExprResult
fn isinf(&self) -> ExprResult
Build isinf(self).
Sourcefn isfinite(&self) -> ExprResult
fn isfinite(&self) -> ExprResult
Build isfinite(self).
Sourcefn likely(&self) -> ExprResult
fn likely(&self) -> ExprResult
Build likely(self).
Sourcefn assume(&self) -> ExprResult
fn assume(&self) -> ExprResult
Build assume(self).
Sourcefn clz(&self) -> ExprResult
fn clz(&self) -> ExprResult
Build clz(self).
Sourcefn exp(&self) -> ExprResult
fn exp(&self) -> ExprResult
Build exp(self).
Sourcefn exp2(&self) -> ExprResult
fn exp2(&self) -> ExprResult
Build exp2(self).
Sourcefn exp10(&self) -> ExprResult
fn exp10(&self) -> ExprResult
Build exp10(self).
Sourcefn erf(&self) -> ExprResult
fn erf(&self) -> ExprResult
Build erf(self).
Sourcefn sigmoid(&self) -> ExprResult
fn sigmoid(&self) -> ExprResult
Build sigmoid(self).
Sourcefn sqrt(&self) -> ExprResult
fn sqrt(&self) -> ExprResult
Build sqrt(self).
Sourcefn rsqrt(&self) -> ExprResult
fn rsqrt(&self) -> ExprResult
Build rsqrt(self).
Sourcefn log(&self) -> ExprResult
fn log(&self) -> ExprResult
Build log(self).
Sourcefn log2(&self) -> ExprResult
fn log2(&self) -> ExprResult
Build log2(self).
Sourcefn log10(&self) -> ExprResult
fn log10(&self) -> ExprResult
Build log10(self).
Sourcefn log1p(&self) -> ExprResult
fn log1p(&self) -> ExprResult
Build log1p(self).
Sourcefn popcount(&self) -> ExprResult
fn popcount(&self) -> ExprResult
Build popcount(self).
Sourcefn tanh(&self) -> ExprResult
fn tanh(&self) -> ExprResult
Build tanh(self).
Sourcefn tan(&self) -> ExprResult
fn tan(&self) -> ExprResult
Build tan(self).
Sourcefn cos(&self) -> ExprResult
fn cos(&self) -> ExprResult
Build cos(self).
Sourcefn cosh(&self) -> ExprResult
fn cosh(&self) -> ExprResult
Build cosh(self).
Sourcefn sin(&self) -> ExprResult
fn sin(&self) -> ExprResult
Build sin(self).
Sourcefn sinh(&self) -> ExprResult
fn sinh(&self) -> ExprResult
Build sinh(self).
Sourcefn asin(&self) -> ExprResult
fn asin(&self) -> ExprResult
Build asin(self).
Sourcefn acos(&self) -> ExprResult
fn acos(&self) -> ExprResult
Build acos(self).
Sourcefn atan(&self) -> ExprResult
fn atan(&self) -> ExprResult
Build atan(self).
Sourcefn acosh(&self) -> ExprResult
fn acosh(&self) -> ExprResult
Build acosh(self).
Sourcefn asinh(&self) -> ExprResult
fn asinh(&self) -> ExprResult
Build asinh(self).
Sourcefn atanh(&self) -> ExprResult
fn atanh(&self) -> ExprResult
Build atanh(self).
Sourcefn if_then_else(
&self,
t: impl IntoExpr<PrimExpr>,
f: impl IntoExpr<PrimExpr>,
) -> ExprResult
fn if_then_else( &self, t: impl IntoExpr<PrimExpr>, f: impl IntoExpr<PrimExpr>, ) -> ExprResult
Build if_then_else(self, t, f), with self the condition.
Sourcefn select(
&self,
t: impl IntoExpr<PrimExpr>,
f: impl IntoExpr<PrimExpr>,
) -> ExprResult
fn select( &self, t: impl IntoExpr<PrimExpr>, f: impl IntoExpr<PrimExpr>, ) -> ExprResult
Build the raw node Select(self, t, f) (Select::new), with self the condition; unlike
if_then_else, both values are evaluated.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.