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

♻️ major refactoring #23

Merged
merged 3 commits into from
Feb 9, 2023
Merged
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
7 changes: 5 additions & 2 deletions benches/bench_f16.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ use argminmax::ArgMinMax;
use codspeed_criterion_compat::*;
use dev_utils::{config, utils};

use argminmax::{ScalarArgMinMax, SCALAR};
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
use argminmax::{AVX2, AVX512, SIMD, SSE};
use argminmax::{
AVX2FloatIgnoreNaN as AVX2, AVX512FloatIgnoreNaN as AVX512, SIMDArgMinMaxFloatIgnoreNaN,
SSEFloatIgnoreNaN as SSE,
};
use argminmax::{ScalarArgMinMax, SCALAR};
#[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
use argminmax::{NEON, SIMD};

Expand Down
8 changes: 6 additions & 2 deletions benches/bench_f32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ use argminmax::ArgMinMax;
use codspeed_criterion_compat::*;
use dev_utils::{config, utils};

use argminmax::{ScalarArgMinMax, SCALAR};
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
use argminmax::{AVX2, AVX512, SIMD, SSE};
// TODO: we should test ignore & return NaN
use argminmax::{
AVX2FloatIgnoreNaN as AVX2, AVX512FloatIgnoreNaN as AVX512, SIMDArgMinMaxFloatIgnoreNaN,
SSEFloatIgnoreNaN as SSE,
};
use argminmax::{ScalarArgMinMax, SCALAR};
#[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
use argminmax::{NEON, SIMD};

Expand Down
7 changes: 5 additions & 2 deletions benches/bench_f64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ use argminmax::ArgMinMax;
use codspeed_criterion_compat::*;
use dev_utils::{config, utils};

use argminmax::{ScalarArgMinMax, SCALAR};
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
use argminmax::{AVX2, AVX512, SIMD, SSE};
use argminmax::{
AVX2FloatIgnoreNaN as AVX2, AVX512FloatIgnoreNaN as AVX512, SIMDArgMinMaxFloatIgnoreNaN,
SSEFloatIgnoreNaN as SSE,
};
use argminmax::{ScalarArgMinMax, SCALAR};

fn minmax_f64_random_array_long(c: &mut Criterion) {
let n = config::ARRAY_LENGTH_LONG;
Expand Down
4 changes: 2 additions & 2 deletions benches/bench_i16.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ use argminmax::ArgMinMax;
use codspeed_criterion_compat::*;
use dev_utils::{config, utils};

use argminmax::{ScalarArgMinMax, SCALAR};
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
use argminmax::{AVX2, AVX512, SIMD, SSE};
use argminmax::{SIMDArgMinMax, AVX2, AVX512, SSE};
use argminmax::{ScalarArgMinMax, SCALAR};
#[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
use argminmax::{NEON, SIMD};

Expand Down
4 changes: 2 additions & 2 deletions benches/bench_i32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ use argminmax::ArgMinMax;
use codspeed_criterion_compat::*;
use dev_utils::{config, utils};

use argminmax::{ScalarArgMinMax, SCALAR};
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
use argminmax::{AVX2, AVX512, SIMD, SSE};
use argminmax::{SIMDArgMinMax, AVX2, AVX512, SSE};
use argminmax::{ScalarArgMinMax, SCALAR};
#[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
use argminmax::{NEON, SIMD};

Expand Down
4 changes: 2 additions & 2 deletions benches/bench_i64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ use argminmax::ArgMinMax;
use codspeed_criterion_compat::*;
use dev_utils::{config, utils};

use argminmax::{ScalarArgMinMax, SCALAR};
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
use argminmax::{AVX2, AVX512, SIMD, SSE};
use argminmax::{SIMDArgMinMax, AVX2, AVX512, SSE};
use argminmax::{ScalarArgMinMax, SCALAR};

fn minmax_i64_random_array_long(c: &mut Criterion) {
let n = config::ARRAY_LENGTH_LONG;
Expand Down
4 changes: 2 additions & 2 deletions benches/bench_i8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ use argminmax::ArgMinMax;
use codspeed_criterion_compat::*;
use dev_utils::{config, utils};

use argminmax::{ScalarArgMinMax, SCALAR};
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
use argminmax::{AVX2, AVX512, SIMD, SSE};
use argminmax::{SIMDArgMinMax, AVX2, AVX512, SSE};
use argminmax::{ScalarArgMinMax, SCALAR};
#[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
use argminmax::{NEON, SIMD};

Expand Down
4 changes: 2 additions & 2 deletions benches/bench_u16.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ use argminmax::ArgMinMax;
use codspeed_criterion_compat::*;
use dev_utils::{config, utils};

use argminmax::{ScalarArgMinMax, SCALAR};
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
use argminmax::{AVX2, AVX512, SIMD, SSE};
use argminmax::{SIMDArgMinMax, AVX2, AVX512, SSE};
use argminmax::{ScalarArgMinMax, SCALAR};
#[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
use argminmax::{NEON, SIMD};

Expand Down
4 changes: 2 additions & 2 deletions benches/bench_u32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ use argminmax::ArgMinMax;
use codspeed_criterion_compat::*;
use dev_utils::{config, utils};

use argminmax::{ScalarArgMinMax, SCALAR};
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
use argminmax::{AVX2, AVX512, SIMD, SSE};
use argminmax::{SIMDArgMinMax, AVX2, AVX512, SSE};
use argminmax::{ScalarArgMinMax, SCALAR};
#[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
use argminmax::{NEON, SIMD};

Expand Down
4 changes: 2 additions & 2 deletions benches/bench_u64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ use argminmax::ArgMinMax;
use codspeed_criterion_compat::*;
use dev_utils::{config, utils};

use argminmax::{ScalarArgMinMax, SCALAR};
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
use argminmax::{AVX2, AVX512, SIMD, SSE};
use argminmax::{SIMDArgMinMax, AVX2, AVX512, SSE};
use argminmax::{ScalarArgMinMax, SCALAR};

fn minmax_u64_random_array_long(c: &mut Criterion) {
let n = config::ARRAY_LENGTH_LONG;
Expand Down
4 changes: 2 additions & 2 deletions benches/bench_u8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ use argminmax::ArgMinMax;
use codspeed_criterion_compat::*;
use dev_utils::{config, utils};

use argminmax::{ScalarArgMinMax, SCALAR};
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
use argminmax::{AVX2, AVX512, SIMD, SSE};
use argminmax::{SIMDArgMinMax, AVX2, AVX512, SSE};
use argminmax::{ScalarArgMinMax, SCALAR};
#[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
use argminmax::{NEON, SIMD};

Expand Down
8 changes: 5 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ mod scalar;
mod simd;

pub use scalar::{ScalarArgMinMax, SCALAR};
pub use simd::{AVX2FloatIgnoreNaN, AVX512FloatIgnoreNaN, SSEFloatIgnoreNaN};
pub use simd::{AVX2, AVX512, NEON, SIMD, SSE};
pub use simd::{
AVX2FloatIgnoreNaN, AVX512FloatIgnoreNaN, SIMDArgMinMaxFloatIgnoreNaN, SSEFloatIgnoreNaN,
};
pub use simd::{SIMDArgMinMax, AVX2, AVX512, NEON, SSE};

#[cfg(feature = "half")]
use half::f16;
Expand Down Expand Up @@ -228,7 +230,7 @@ impl_argminmax_non_float!(i8, i16, i32, i64, u8, u16, u32, u64);
impl_argminmax_float!(f32, f64);
// Implement ArgMinMax for other data types
#[cfg(feature = "half")]
impl_argminmax_float!(f16); // TODO: implement f16 correctly (currently it is swapped)
impl_argminmax_float!(f16); // TODO: implement f16 correctly

// ------------------------------ [T] ------------------------------

Expand Down
Loading