Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce Avx2 engine #1

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ include = [
"build.rs",
]

[features]
default = ["avx2"]
avx2 = []

[dependencies]
bytemuck = "1.7.3"
fixedbitset = "0.4.0"
Expand Down
12 changes: 12 additions & 0 deletions src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,15 @@ pub(crate) use self::shards::Shards;

pub use self::{engine_naive::Naive, engine_nosimd::NoSimd, shards::ShardsRefMut};

#[cfg(all(feature = "avx2", any(target_arch = "x86", target_arch = "x86_64")))]
pub use self::engine_avx2::Avx2;

mod engine_naive;
mod engine_nosimd;

#[cfg(all(feature = "avx2", any(target_arch = "x86", target_arch = "x86_64")))]
mod engine_avx2;

mod shards;

pub mod tables;
Expand Down Expand Up @@ -79,7 +86,12 @@ pub const CANTOR_BASIS: [GfElement; GF_BITS] = [
/// Galois field element.
pub type GfElement = u16;

/// Default [`Engine`], currently just alias to [`Avx2`].
#[cfg(all(feature = "avx2", any(target_arch = "x86", target_arch = "x86_64")))]
pub type DefaultEngine = Avx2;

/// Default [`Engine`], currently just alias to [`NoSimd`].
#[cfg(not(all(feature = "avx2", any(target_arch = "x86", target_arch = "x86_64"))))]
pub type DefaultEngine = NoSimd;

// ======================================================================
Expand Down
Loading