vyre 0.4.0

GPU compute intermediate representation with a standard operation library
Documentation
//! Primitive arithmetic, bitwise, and comparison operations.
//!
//! These are Category A compositions built from vyre IR primitives.
//! Algebraic laws include associativity and commutativity where
//! applicable to the underlying operation.

pub(crate) const WORKGROUP_SIZE: [u32; 3] = [64, 1, 1];

/// Math submodule containing add, sub, mul, div, and saturation variants.
pub mod math;
pub(crate) use binary_f32_program::binary_f32_program;
pub(crate) use binary_u32_program::binary_u32_program;
/// Bitwise logical and shift operations (and, or, xor, shl, shr, etc.).
pub use bitwise::{
    and, clz, ctz, extract_bits, insert_bits, not, or, popcount, popcount_sw, reverse_bits, rotl,
    rotr, shl, shr, xor,
};
/// Integer modulo operation.
pub use math::mod_op;
/// Integer arithmetic operations (abs, add, mul, div, saturation, etc.).
pub use math::{abs, add, add_sat, div, lcm, mul, neg, negate, sign, sub, sub_sat};
pub(crate) use ternary_f32_program::ternary_f32_program;
pub(crate) use unary_f32_program::unary_f32_program;
pub(crate) use unary_u32_program::unary_u32_program;

automod::dir!(pub "src/ops/primitive");

macro_rules! category_a_cpu {
    ($($ty:path),+ $(,)?) => {
        $(
            impl crate::ops::CategoryAOp for $ty {
                fn program() -> crate::ir::Program {
                    <$ty>::program()
                }
            }
        )+
    };
}

category_a_cpu!(
    bitwise::and::And,
    bitwise::clz::Clz,
    bitwise::ctz::Ctz,
    bitwise::extract_bits::ExtractBits,
    bitwise::insert_bits::InsertBits,
    bitwise::not::Not,
    bitwise::or::Or,
    bitwise::popcount::Popcount,
    bitwise::reverse_bits::ReverseBits,
    bitwise::rotl::Rotl,
    bitwise::rotr::Rotr,
    bitwise::shl::Shl,
    bitwise::shr::Shr,
    bitwise::xor::Xor,
    clamp::Clamp,
    compare::eq::Eq,
    compare::ge::Ge,
    compare::gt::Gt,
    compare::le::Le,
    compare::logical_not::LogicalNot,
    compare::lt::Lt,
    compare::ne::Ne,
    float::f32_abs::F32Abs,
    float::f32_add::F32Add,
    float::f32_ceil::F32Ceil,
    float::f32_clamp::F32Clamp,
    float::f32_cmp::F32Cmp,
    float::f32_cos::F32Cos,
    float::f32_div::F32Div,
    float::f32_eq::F32Eq,
    float::f32_floor::F32Floor,
    float::f32_fma::F32Fma,
    float::f32_is_finite::F32IsFinite,
    float::f32_is_inf::F32IsInf,
    float::f32_is_nan::F32IsNan,
    float::f32_le::F32Le,
    float::f32_lt::F32Lt,
    float::f32_max::F32Max,
    float::f32_min::F32Min,
    float::f32_mul::F32Mul,
    float::f32_neg::F32Neg,
    float::f32_rem::F32Rem,
    float::f32_round::F32Round,
    float::f32_sign::F32Sign,
    float::f32_sin::F32Sin,
    float::f32_sqrt::F32Sqrt,
    float::f32_sub::F32Sub,
    float::f32_trunc::F32Trunc,
    math::abs::Abs,
    math::abs_diff::AbsDiff,
    math::add::Add,
    math::add_sat::AddSat,
    math::div::Div,
    math::gcd::Gcd,
    math::lcm::Lcm,
    math::mod_op::Mod,
    math::mul::Mul,
    math::neg::Neg,
    math::negate::Negate,
    math::sign::Sign,
    math::sub::Sub,
    math::sub_sat::SubSat,
    max::Max,
    min::Min,
    select_op::SelectOp,
);