Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SIMD support #59

Open
ManevilleF opened this issue Mar 29, 2023 · 2 comments
Open

SIMD support #59

ManevilleF opened this issue Mar 29, 2023 · 2 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@ManevilleF
Copy link
Owner

ManevilleF commented Mar 29, 2023

hexx should provide optional SIMD operations like glam.

SIMD: Single instruction, multiple data (SIMD) instructions can be used to perform the same operation on multiple data elements simultaneously. Rust's packed_simd crate provides support for SIMD instructions and could be used to accelerate certain operations in hexx.

I don't know what would be better, wait for stabilization of std::simd (issue) or use packed_simd.

In terms of API I don't know what is better:

  • A HexA type with simd support
  • Add a simd module with explicit simd methods like that:
use super::Hex;
use std::simd::i32x2;
// src/hex/simd.rs

impl Hex {
    pub fn simd_add(self, rhs: Self) -> Self {
        let x = i32x2::from_array([self.x, rhs.x]);
        let y = i32x2::from_array([self.y, rhs.y]);
        let [x, y] = (x + y).to_array();
        Self::new(x, y)
    }
}
@ManevilleF ManevilleF added enhancement New feature or request help wanted Extra attention is needed labels Mar 29, 2023
@ManevilleF ManevilleF modified the milestone: 0.6.0 Mar 29, 2023
@SpecificProtagonist
Copy link
Contributor

Afaik packed_simd_2 is a pre- const generics design and not planed for inclusion in std anymore. As it requires nightly anyways I don't see a reason to use it instead of core::simd.

@ManevilleF
Copy link
Owner Author

There is also the wide crate, used by bevy_rapier, worth exploring probably

@ManevilleF ManevilleF added this to the 0.13.0 milestone Jan 19, 2024
@ManevilleF ManevilleF removed this from the 0.13.0 milestone Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants