After seeing an HPC expert who literally wrote a book on HPC and SIMD struggle with it (and entirely failing to get it to work when combined with criterion benchmarks), I'm convinced that we need to provide a more robust and convenient way to handle this.
Ideally I want to have some sort of annotation that you just put on every function generic over Simd and do not think about inlining at all, ever. The compiler just does the right thing automatically.
I see multiversion's #[multiversion(targets=simd)] (PR adding it) and thermite's #[thermite::dispatch(V)] as prior art that does this well.
AFAIK (I haven't re-checked yet) multiversion has an indirect dispatch through a cached atomic pointer on every function call, but doesn't require functions to be generic over Simd. I haven't looked into how thermite works yet.
After seeing an HPC expert who literally wrote a book on HPC and SIMD struggle with it (and entirely failing to get it to work when combined with criterion benchmarks), I'm convinced that we need to provide a more robust and convenient way to handle this.
Ideally I want to have some sort of annotation that you just put on every function generic over
Simdand do not think about inlining at all, ever. The compiler just does the right thing automatically.I see multiversion's
#[multiversion(targets=simd)](PR adding it) and thermite's#[thermite::dispatch(V)]as prior art that does this well.AFAIK (I haven't re-checked yet)
multiversionhas an indirect dispatch through a cached atomic pointer on every function call, but doesn't require functions to be generic overSimd. I haven't looked into howthermiteworks yet.