Skip to main content

hermes_simd_core/
lib.rs

1//! Core abstractions for `hermes-simd`.
2//!
3//! # Module Organization
4//!
5//! | Module | Contents |
6//! |--------|----------|
7//! | [`arch`] | `SimdArch` marker trait with architecture constants |
8//! | [`align`] | `Alignment`, `Aligned<N>`, `Unaligned` typestates |
9//! | [`execution`] | `ExecutionMode`, `Unmasked`, `Masked` ZSTs |
10//! | [`kernel`] | `SimdKernel<T>` trait — full SIMD operation surface |
11//! | [`scalar`] | `Scalar` sealed element trait |
12//! | [`mask`] | `BitMask<N>` bit-packed lane mask |
13//! | [`ops`] | `ReductionOp<T>`, `ElementOp<T>` ZST strategies |
14//! | [`view`] | `SimdView`, `SimdError` — safe typed slice views |
15//! | [`tiling`] | Const-generic tiled dot product and `TilingPolicy` |
16//! | [`sparse`] | `SparseView`, format ZSTs, data structs, SpMV kernels |
17//! | [`vec`](mod@crate::vec) | `AlignedVec` — heap-allocated aligned vector |
18//! | [`cow`] | `SimdCow` — SIMD-aware copy-on-write |
19//! | [`tensor`] | N-D tensor views, GEMM, softmax, LayerNorm, Attention |
20
21#![cfg_attr(not(feature = "std"), no_std)]
22#![deny(missing_docs)]
23#![allow(
24    clippy::needless_range_loop,
25    clippy::let_unit_value,
26    clippy::manual_div_ceil,
27    clippy::manual_is_multiple_of,
28    clippy::assign_op_pattern,
29    clippy::unit_arg
30)]
31
32extern crate alloc;
33
34pub mod align;
35pub mod arch;
36pub mod bitboard;
37pub mod compute;
38pub mod cow;
39pub mod execution;
40pub mod iter;
41pub mod kernel;
42mod kernel_helpers;
43pub mod mask;
44pub mod numa;
45pub mod ops;
46pub mod scalar;
47pub mod sparse;
48pub mod tensor;
49pub mod tiling;
50pub mod vec;
51pub mod view;
52
53/// Hidden private module containing the sealed trait supertrait.
54#[doc(hidden)]
55pub mod private {
56    pub trait Sealed {}
57}
58
59// Re-exports for ergonomic use
60pub use align::{Aligned, Alignment, Unaligned};
61pub use arch::{IsaFamily, SimdArch};
62pub use bitboard::{BitBoardKernel, BitBoardView};
63pub use compute::ComputeView;
64pub use cow::{ArchivedPacked4Cow, ArchivedSimdCow, Packed4CowResolver, SimdCow, SimdCowResolver};
65pub use execution::{ExecutionMode, Masked, Unmasked};
66pub use iter::{SimdChunks, SimdChunksMut, ZipChunks};
67pub use kernel::SimdKernel;
68pub use mask::BitMask;
69pub use numa::{
70    current_numa_node, refresh_numa_node, verify_numa_locality, MnemosyneNumaAllocator,
71    NumaAllocator, NumaBinding,
72};
73pub use ops::{
74    Abs, AbsMax, AbsSum, Add, BitAnd, BitOr, BitXor, Clamp, Div, Dot, ElementOp, Exclusive, FmaAdd,
75    Inclusive, Max, Min, Mul, Neg, Popcount, Product, RecipSqrt, ReductionOp, ScanAdd, ScanMax,
76    ScanMin, ScanMode, ScanMul, ScanOp, Sqrt, Sub, Sum, UnaryOp,
77};
78pub use scalar::{FloatElement, NumericElement, Scalar};
79pub use sparse::{
80    BlockedCoo, BlockedCooData, Csr, CsrData, DenseWithMask, DenseWithMaskData, SellP, SellPData,
81    SparseFormat, SparseShape, SparseView, Validated, ValidatedData,
82};
83pub use tensor::{ColMajor, RowMajor, TensorCow, TensorError, TensorView};
84pub use tiling::{tiled_dot, tiled_gemm, tiled_gemv, TilingPolicy, TilingStrategy};
85pub use vec::AlignedVec;
86pub use view::{Mask, SimdError, SimdView, TileMatrixMultiply, TileView, Vector};