Skip to content

Commit

Permalink
fix: remove stdsimd feature; add stdarch_x86_avx512 (#62)
Browse files Browse the repository at this point in the history
* fix: remove `stdsimd` feature; add `stdarch_x86_avx512`

Closes #61

* fix: split the stdsimd feature

* use cfg_version to allow backwards compatible SIMD features

* 🙈 check for nightly feature before enabling cfg_version

* 🧹

* :clown:

* bundle arm features together

---------

Co-authored-by: jvdd <[email protected]>
  • Loading branch information
lazyky and jvdd authored Feb 21, 2024
1 parent c4a4c3c commit 868600f
Show file tree
Hide file tree
Showing 15 changed files with 25 additions and 30 deletions.
2 changes: 0 additions & 2 deletions benches/bench_f16_ignore_nan.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![feature(stdsimd)]

use argminmax::ArgMinMax;
use codspeed_criterion_compat::*;
use dev_utils::{config, utils};
Expand Down
2 changes: 0 additions & 2 deletions benches/bench_f16_return_nan.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![feature(stdsimd)]

use argminmax::NaNArgMinMax;
use codspeed_criterion_compat::*;
use dev_utils::{config, utils};
Expand Down
2 changes: 0 additions & 2 deletions benches/bench_f32_ignore_nan.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![feature(stdsimd)]

use argminmax::ArgMinMax;
use codspeed_criterion_compat::*;
use dev_utils::{config, utils};
Expand Down
2 changes: 0 additions & 2 deletions benches/bench_f32_return_nan.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![feature(stdsimd)]

use argminmax::NaNArgMinMax;
use codspeed_criterion_compat::*;
use dev_utils::{config, utils};
Expand Down
2 changes: 0 additions & 2 deletions benches/bench_f64_ignore_nan.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![feature(stdsimd)]

use argminmax::ArgMinMax;
use codspeed_criterion_compat::*;
use dev_utils::{config, utils};
Expand Down
2 changes: 0 additions & 2 deletions benches/bench_f64_return_nan.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![feature(stdsimd)]

use argminmax::NaNArgMinMax;
use codspeed_criterion_compat::*;
use dev_utils::{config, utils};
Expand Down
2 changes: 0 additions & 2 deletions benches/bench_i16.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![feature(stdsimd)]

use argminmax::ArgMinMax;
use codspeed_criterion_compat::*;
use dev_utils::{config, utils};
Expand Down
2 changes: 0 additions & 2 deletions benches/bench_i32.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![feature(stdsimd)]

use argminmax::ArgMinMax;
use codspeed_criterion_compat::*;
use dev_utils::{config, utils};
Expand Down
2 changes: 0 additions & 2 deletions benches/bench_i64.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![feature(stdsimd)]

use argminmax::ArgMinMax;
use codspeed_criterion_compat::*;
use dev_utils::{config, utils};
Expand Down
2 changes: 0 additions & 2 deletions benches/bench_i8.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![feature(stdsimd)]

use argminmax::ArgMinMax;
use codspeed_criterion_compat::*;
use dev_utils::{config, utils};
Expand Down
2 changes: 0 additions & 2 deletions benches/bench_u16.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![feature(stdsimd)]

use argminmax::ArgMinMax;
use codspeed_criterion_compat::*;
use dev_utils::{config, utils};
Expand Down
2 changes: 0 additions & 2 deletions benches/bench_u32.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![feature(stdsimd)]

use argminmax::ArgMinMax;
use codspeed_criterion_compat::*;
use dev_utils::{config, utils};
Expand Down
2 changes: 0 additions & 2 deletions benches/bench_u64.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![feature(stdsimd)]

use argminmax::ArgMinMax;
use codspeed_criterion_compat::*;
use dev_utils::{config, utils};
Expand Down
2 changes: 0 additions & 2 deletions benches/bench_u8.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![feature(stdsimd)]

use argminmax::ArgMinMax;
use codspeed_criterion_compat::*;
use dev_utils::{config, utils};
Expand Down
27 changes: 25 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,31 @@
//!```
//!

// enable SIMD nightly features when on nightly_simd enabled
#![cfg_attr(feature = "nightly_simd", feature(stdsimd))]
// Enable SIMD nightly features when on nightly_simd enabled
#![cfg_attr(feature = "nightly_simd", feature(cfg_version))]
// ------- version 1.78 and above
#![cfg_attr(
all(
feature = "nightly_simd",
any(target_arch = "x86_64", target_arch = "x86")
),
cfg_attr(version("1.78"), feature(stdarch_x86_avx512))
)]
// TODO: Aarch64 is stable now - check if this is under nightly_simd https://github.com/rust-lang/rust/issues/111800
#![cfg_attr(
all(feature = "nightly_simd", target_arch = "arm"),
cfg_attr(
version("1.78"),
feature(stdarch_arm_neon_intrinsics),
feature(stdarch_arm_feature_detection)
)
)]
// ------- version 1.77 and below
#![cfg_attr(
feature = "nightly_simd",
cfg_attr(not(version("1.78")), feature(stdsimd))
)]
// ------- any version
#![cfg_attr(feature = "nightly_simd", feature(avx512_target_feature))]
#![cfg_attr(feature = "nightly_simd", feature(arm_target_feature))]

Expand Down

0 comments on commit 868600f

Please sign in to comment.