Open liebharc opened 6 years ago
The macro approach of simdeez
prevents us from combining it with templates. So the macro fails to compile this:
simd_runtime_generate!(
fn simd_complex_operation<A, F, G>(
&mut self,
simd_op: F,
scalar_op: G,
argument: A,
complexity: Complexity,
) where
A: Sync + Copy + Send,
F: Fn(Reg, A) -> Reg + 'static + Sync,
G: Fn(Complex<T>, A) -> Complex<T> + 'static + Sync,
{
{
let data_length = self.valid_len;
let array = self.data.to_slice_mut();
let partition = Reg::calc_data_alignment_reqs(&array[0..data_length]);
Chunk::execute_partial(
complexity,
&self.multicore_settings,
partition.center_mut(array),
Reg::LEN,
argument,
move |array, argument| {
let array = Reg::array_to_regs_mut(array);
for reg in array {
*reg = simd_op(*reg, argument);
}
},
);
for num in partition.cedge_iter_mut(array_to_complex_mut(&mut array[0..data_length])) {
*num = scalar_op(*num, argument);
}
}
}
);
Of course there would be other changes we would need to the code IF the macro would get past the generic definitions.
Work on https://github.com/rust-lang/stdsimd seems to be continuing.
Right now _basicdsp uses its own SIMD abstractions which are built on simd. The only reason for that is that at the time that code was written nothing else was available. But that seems to change. There are two libraries which should be a good fit to replace the custom code:
For now it seems to be best to wait what happens with _packedsimd and then decide which one to pick.
faster and simd_aligned would also be an option. But since the _basicdsp abstractions also will use multiple CPU cores it might be hard to switch to the higher level abstractions of e.g. faster.