Open
Description
Hi! I'm very excited by the work on portable/core simd. Thank you for all of your work :)
I was looking over the API, and I was thinking it should be possible to get "free" runtime dispatch with a proc macro on top of portable SIMD, which would make portability really easy!
I'm thinking something like (more of a sketch than concrete proposal):
#[runtime_dispatch(sse,avx,avx2)]
fn some_simd_fn(...) {
// uses portable simd API
}
This would generate code much like the example in the core::arch
docs here: https://doc.rust-lang.org/core/arch/index.html#dynamic-cpu-feature-detection, where it would generate versions of the function for each target_feature
, then make the actual main function dynamically dispatch to each implementation.
Anyway, I thought I'd open this and get your thoughts.