Skip to content

Constified SIMD #467

Open
Open
@clarfonthey

Description

@clarfonthey

I figured I'd start a discussion here since I didn't see one already made, and because I actually would like to work on this.

I think that it would be useful to have const support for all the SIMD operations, since the story on const floats has been resolved, and const traits seem on the horizon. The main reason why I wanted to put this out there is because it's unclear what approach should be used for this.

Motivation for const SIMD operations is pretty self-explanatory: you want to make things use SIMD to speed them up at runtime, but you still want to be able to run some operations ahead of time if needed. Right now, this requires effectively writing separate code for const and runtime operations, which requires a lot of extra boilerplate and means you may have twice the code to check for correctness.

The biggest issue IMHO is that most SIMD intrinsics are not set up to work in const context, and I think it would be ideal if this were the case. The few const methods that do exist (mainly splat) rely on const_eval_select, which effectively offoads the same issue as before onto the standard library: writing twice the code and requiring twice the tests to verify it.

So, I wanted to list this here and start a discussion on what would be needed to get this working.

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