Skip to content

Commit

Permalink
Use sleef cinz functions for platform bit-wise consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
greatest-ape committed Feb 13, 2021
1 parent 0bb7485 commit 13a91a7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
30 changes: 15 additions & 15 deletions octasine/benches/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,41 +15,41 @@ use octasine::gen::AudioGen;
/// --- Benchmarking OctaSine process_f32 variant: fallback (std) ---
/// Total number of samples: 12800000
/// Equivalent to audio duration: 290.24942 seconds
/// Processing time in total: 27099 milliseconds
/// Processing time per sample: 2117.1865 nanoseconds
/// Estimated CPU use: 9.3364525%
/// Processing time in total: 28821 milliseconds
/// Processing time per sample: 2251.696 nanoseconds
/// Estimated CPU use: 9.929736%
/// Output hash (first 16 bytes): ad 0d 1d 04 5e 38 95 7f
/// 6b dc 96 33 94 3e 15 72
///
/// --- Benchmarking OctaSine process_f32 variant: fallback (sleef) ---
/// Total number of samples: 12800000
/// Equivalent to audio duration: 290.24942 seconds
/// Processing time in total: 26339 milliseconds
/// Processing time per sample: 2057.746 nanoseconds
/// Estimated CPU use: 9.074609%
/// Processing time in total: 21378 milliseconds
/// Processing time per sample: 1670.2142 nanoseconds
/// Estimated CPU use: 7.3653893%
/// Output hash (first 16 bytes): ac fd ce 1e a2 7b 79 e1
/// 75 06 b6 94 fe be c9 5f
/// Speed compared to std fallback: 1.0288862x
/// Speed compared to std fallback: 1.348148x
///
/// --- Benchmarking OctaSine process_f32 variant: sse2 ---
/// Total number of samples: 12800000
/// Equivalent to audio duration: 290.24942 seconds
/// Processing time in total: 17407 milliseconds
/// Processing time per sample: 1359.9438 nanoseconds
/// Estimated CPU use: 5.997256%
/// Processing time in total: 18493 milliseconds
/// Processing time per sample: 1444.8228 nanoseconds
/// Estimated CPU use: 6.371417%
/// Output hash (first 16 bytes): ac fd ce 1e a2 7b 79 e1
/// 75 06 b6 94 fe be c9 5f
/// Speed compared to std fallback: 1.5568191x
/// Speed compared to std fallback: 1.5584583x
///
/// --- Benchmarking OctaSine process_f32 variant: avx ---
/// Total number of samples: 12800000
/// Equivalent to audio duration: 290.24942 seconds
/// Processing time in total: 10654 milliseconds
/// Processing time per sample: 832.36273 nanoseconds
/// Estimated CPU use: 3.6706362%
/// Processing time in total: 12484 milliseconds
/// Processing time per sample: 975.3484 nanoseconds
/// Estimated CPU use: 4.3011284%
/// Output hash (first 16 bytes): ac fd ce 1e a2 7b 79 e1
/// 75 06 b6 94 fe be c9 5f
/// Speed compared to std fallback: 2.5435865x
/// Speed compared to std fallback: 2.3086069x
/// ```
fn main(){
#[allow(unused_variables)]
Expand Down
6 changes: 3 additions & 3 deletions octasine/src/gen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ pub struct FallbackSineSleef;
impl FallbackSine for FallbackSineSleef {
fn sin([a1, a2]: [f64; 2]) -> [f64; 2] {
unsafe {
[sleef_sys::Sleef_sin_u35(a1), sleef_sys::Sleef_sin_u35(a2)]
[sleef_sys::Sleef_cinz_sind1_u35purec(a1), sleef_sys::Sleef_cinz_sind1_u35purec(a2)]
}
}
}
Expand Down Expand Up @@ -192,7 +192,7 @@ impl Simd for Sse2 {
}
#[target_feature(enable = "sse2")]
unsafe fn pd_fast_sin(a: __m128d) -> __m128d {
sleef_sys::Sleef_sind2_u35sse2(a)
sleef_sys::Sleef_cinz_sind2_u35sse2(a)
}
#[target_feature(enable = "sse2")]
unsafe fn pd_pairwise_horizontal_sum(a: __m128d) -> __m128d {
Expand Down Expand Up @@ -257,7 +257,7 @@ impl Simd for Avx {
}
#[target_feature(enable = "avx")]
unsafe fn pd_fast_sin(a: __m256d) -> __m256d {
sleef_sys::Sleef_sind4_u35avx(a)
sleef_sys::Sleef_cinz_sind4_u35avx(a)
}
#[target_feature(enable = "avx")]
unsafe fn pd_pairwise_horizontal_sum(a: __m256d) -> __m256d {
Expand Down

0 comments on commit 13a91a7

Please sign in to comment.