Skip to main content

PrimOps

Trait PrimOps 

Source
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§

Source

fn to_expr_result(&self) -> ExprResult

Return this expression as an ExprResult.

Provided Methods§

Source

fn less(&self, rhs: impl Operand) -> ExprResult

Build the boolean self < rhs (lt).

Source

fn less_equal(&self, rhs: impl Operand) -> ExprResult

Build the boolean self <= rhs (le).

Source

fn greater(&self, rhs: impl Operand) -> ExprResult

Build the boolean self > rhs (gt).

Source

fn greater_equal(&self, rhs: impl Operand) -> ExprResult

Build the boolean self >= rhs (ge).

Source

fn equal(&self, rhs: impl Operand) -> ExprResult

Build the boolean self == rhs (eq).

Source

fn not_equal(&self, rhs: impl Operand) -> ExprResult

Build the boolean self != rhs (ne).

Source

fn logical_and(&self, rhs: impl IntoExpr<PrimExpr>) -> ExprResult

Build the boolean self && rhs (logical_and).

Source

fn logical_or(&self, rhs: impl IntoExpr<PrimExpr>) -> ExprResult

Build the boolean self || rhs (logical_or).

Source

fn div(&self, rhs: impl Operand) -> ExprResult

Build div(self, rhs).

Source

fn truncdiv(&self, rhs: impl Operand) -> ExprResult

Build truncdiv(self, rhs).

Source

fn truncmod(&self, rhs: impl Operand) -> ExprResult

Build truncmod(self, rhs).

Source

fn floordiv(&self, rhs: impl Operand) -> ExprResult

Build floordiv(self, rhs).

Source

fn floormod(&self, rhs: impl Operand) -> ExprResult

Build floormod(self, rhs).

Source

fn indexdiv(&self, rhs: impl Operand) -> ExprResult

Build indexdiv(self, rhs).

Source

fn indexmod(&self, rhs: impl Operand) -> ExprResult

Build indexmod(self, rhs).

Source

fn ceildiv(&self, rhs: impl Operand) -> ExprResult

Build ceildiv(self, rhs).

Source

fn min(&self, rhs: impl Operand) -> ExprResult

Build min(self, rhs).

Source

fn max(&self, rhs: impl Operand) -> ExprResult

Build max(self, rhs).

Source

fn pow(&self, rhs: impl IntoExpr<PrimExpr>) -> ExprResult

Build pow(self, rhs).

Source

fn fmod(&self, rhs: impl IntoExpr<PrimExpr>) -> ExprResult

Build fmod(self, rhs).

Source

fn atan2(&self, rhs: impl IntoExpr<PrimExpr>) -> ExprResult

Build atan2(self, rhs).

Source

fn nextafter(&self, rhs: impl IntoExpr<PrimExpr>) -> ExprResult

Build nextafter(self, rhs).

Source

fn copysign(&self, rhs: impl IntoExpr<PrimExpr>) -> ExprResult

Build copysign(self, rhs).

Source

fn hypot(&self, rhs: impl IntoExpr<PrimExpr>) -> ExprResult

Build hypot(self, rhs).

Source

fn ldexp(&self, rhs: impl IntoExpr<PrimExpr>) -> ExprResult

Build ldexp(self, rhs).

Source

fn bitwise_not(&self) -> ExprResult

Build bitwise_not(self).

Source

fn floor(&self) -> ExprResult

Build floor(self).

Source

fn ceil(&self) -> ExprResult

Build ceil(self).

Source

fn round(&self) -> ExprResult

Build round(self).

Source

fn nearbyint(&self) -> ExprResult

Build nearbyint(self).

Source

fn trunc(&self) -> ExprResult

Build trunc(self).

Source

fn abs(&self) -> ExprResult

Build abs(self).

Source

fn isnan(&self) -> ExprResult

Build isnan(self).

Source

fn isinf(&self) -> ExprResult

Build isinf(self).

Source

fn isfinite(&self) -> ExprResult

Build isfinite(self).

Source

fn likely(&self) -> ExprResult

Build likely(self).

Source

fn assume(&self) -> ExprResult

Build assume(self).

Source

fn clz(&self) -> ExprResult

Build clz(self).

Source

fn exp(&self) -> ExprResult

Build exp(self).

Source

fn exp2(&self) -> ExprResult

Build exp2(self).

Source

fn exp10(&self) -> ExprResult

Build exp10(self).

Source

fn erf(&self) -> ExprResult

Build erf(self).

Source

fn sigmoid(&self) -> ExprResult

Build sigmoid(self).

Source

fn sqrt(&self) -> ExprResult

Build sqrt(self).

Source

fn rsqrt(&self) -> ExprResult

Build rsqrt(self).

Source

fn log(&self) -> ExprResult

Build log(self).

Source

fn log2(&self) -> ExprResult

Build log2(self).

Source

fn log10(&self) -> ExprResult

Build log10(self).

Source

fn log1p(&self) -> ExprResult

Build log1p(self).

Source

fn popcount(&self) -> ExprResult

Build popcount(self).

Source

fn tanh(&self) -> ExprResult

Build tanh(self).

Source

fn tan(&self) -> ExprResult

Build tan(self).

Source

fn cos(&self) -> ExprResult

Build cos(self).

Source

fn cosh(&self) -> ExprResult

Build cosh(self).

Source

fn sin(&self) -> ExprResult

Build sin(self).

Source

fn sinh(&self) -> ExprResult

Build sinh(self).

Source

fn asin(&self) -> ExprResult

Build asin(self).

Source

fn acos(&self) -> ExprResult

Build acos(self).

Source

fn atan(&self) -> ExprResult

Build atan(self).

Source

fn acosh(&self) -> ExprResult

Build acosh(self).

Source

fn asinh(&self) -> ExprResult

Build asinh(self).

Source

fn atanh(&self) -> ExprResult

Build atanh(self).

Source

fn cast(&self, ty: impl IntoArg<PrimType>) -> ExprResult

Build cast(self, ty).

Source

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.

Source

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.

Implementors§