Skip to content

"Free" dynamic dispatch for core SIMD? #178

Open
@emmatyping

Description

@emmatyping

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: a feature request, i.e. not implemented / a PR

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions