nodedb_query/simd_filter/mod.rs
1// SPDX-License-Identifier: Apache-2.0
2
3//! SIMD-accelerated filter kernels returning u64 bitmasks.
4//!
5//! Each kernel compares a column slice against a scalar and returns a
6//! packed `Vec<u64>` where bit *i* is set iff the predicate holds for
7//! element *i*. One u64 word covers 64 rows.
8//!
9//! Runtime CPU detection selects the fastest path:
10//! - AVX-512 (512-bit, 16 u32 / 8 f64|i64 per op)
11//! - AVX2 (256-bit, 8 u32 / 4 f64|i64 per op)
12//! - Scalar fallback (auto-vectorized by LLVM)
13//!
14//! Companion helpers: `popcount`, `bitmask_and`, `bitmask_or`, `bitmask_to_indices`.
15
16pub(crate) mod avx2;
17pub(crate) mod avx512;
18pub(crate) mod bitmask;
19pub(crate) mod neon;
20pub(crate) mod runtime;
21pub(crate) mod scalar;
22pub(crate) mod wasm;
23
24#[cfg(test)]
25mod tests;
26
27pub use bitmask::{
28 bitmask_all, bitmask_and, bitmask_not, bitmask_or, bitmask_to_indices, popcount, words_for,
29};
30pub use runtime::{FilterSimdRuntime, filter_runtime};