Skip to content

vectorize() + #[inline(always)] is error-prone and hard to teach #338

Description

@Shnatsel

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions