vyre 0.4.0

GPU compute intermediate representation with a standard operation library
Documentation
use crate::ir::{Expr, Program};
use crate::ops::primitive;
use crate::ops::{OpSpec, F32_INPUTS, F32_OUTPUTS};

// Element-wise cosine of an f32 buffer.


/// f32 element-wise cosine operation.
#[derive(Debug, Clone, Copy, Default)]
pub struct F32Cos;

impl F32Cos {
    /// Declarative operation specification.
    pub const SPEC: OpSpec = OpSpec::composition_inlinable(
        "primitive.float.f32_cos",
        F32_INPUTS,
        F32_OUTPUTS,
        &[],
        Self::program,
    );

    /// Build the canonical IR program.
    ///
    /// # Examples
    ///
    /// ```
    /// use vyre::ir::Expr;
    /// use vyre::ops::primitive::float::f32_cos::F32Cos;
    ///
    /// let program = F32Cos::program();
    /// assert!(!program.entry().is_empty());
    /// ```
    #[must_use]
    pub fn program() -> Program {
        primitive::unary_f32_program(Expr::cos)
    }
}

// WGSL lowering marker for `primitive.float.f32_cos`.
//
// Not a stub: this is a zero-overhead Category A marker. `F32Cos::program`
// builds concrete IR through `core/src/ops/primitive/unary_f32_program.rs`;
// `core/src/lower/wgsl/expr.rs::emit_unop` emits WGSL.
// `core/tests/conformance.rs::conformance_all_primitives` verifies
// lowered GPU bytes are bit-exact against the conform CPU reference.
//
// ```wgsl
// _vyre_store_out(idx, cos(_vyre_load_a(idx)));
// ```