Skip to main content

vyre_intrinsics/
lib.rs

1#![forbid(unsafe_code)]
2#![allow(
3    clippy::ptr_arg,
4    clippy::should_implement_trait,
5    clippy::module_inception
6)]
7//! # vyre-intrinsics  -  Cat-C hardware intrinsics
8//!
9//! This crate holds every vyre op that requires dedicated backend
10//! and reference-interpreter support  -  the ones that *cannot* be
11//! written as `fn(...) -> Program` over existing `vyre::ir::*`
12//! primitives. If an op can be expressed purely as a composition of
13//! existing `Expr`/`Node` variants, it belongs in `vyre-libs` or a
14//! user package, NOT here.
15//!
16//! See `docs/migration-vyre-ops-to-intrinsics.md` for the
17//! classification rule that drove the split.
18//!
19//! ## Current surface (9 intrinsics)
20//!
21//! - `subgroup_add`, `subgroup_ballot`, `subgroup_shuffle`  -  wave-level
22//!   ops backed by target builder 25+ subgroup lowering.
23//! - `workgroup_barrier`, `storage_barrier`  -  concurrency fences.
24//! - `bit_reverse_u32`, `popcount_u32`  -  bit intrinsics mapping 1:1
25//!   to hardware instructions (`reverseBits`, `countOneBits`).
26//! - `fma_f32`  -  fused multiply-add (byte-identical to `f32::mul_add`).
27//! - `inverse_sqrt_f32`  -  maps to hardware `inverseSqrt()` via target builder.
28//!
29//! Everything else that used to live here (atomics, lzcnt/tzcnt,
30//! clamp_u32, hashes) moved to `vyre-libs` in Migration 2–3.
31
32/// Region builder  -  the composition-chain wrap helper mandatory at
33/// every tier. Spec: `docs/region-chain.md`.
34pub mod region;
35
36/// Inventory-backed OpEntry registry used by the intrinsic-differential
37/// harness.
38#[doc(hidden)]
39pub mod harness;
40
41/// CPU reference evaluation traits re-exported from `vyre-foundation`.
42#[allow(deprecated)]
43pub use vyre_foundation::cpu_op::{self, structured_intrinsic_cpu, CategoryAOp, CpuOp};
44/// Spec types every intrinsic registers against: algebraic laws, backend identifiers, intrinsic descriptors.
45pub use vyre_spec::{AlgebraicLaw, Backend, BackendId, CpuFn, IntrinsicDescriptor};
46
47/// Category-classification consistency gate (F-IR-34).
48pub mod category_check;
49
50/// Category C hardware intrinsics  -  subgroup collectives, barriers, bit intrinsics, FMA, inverseSqrt.
51#[cfg(feature = "hardware")]
52pub mod hardware;