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

More SIMD implementations #66

Open
6 of 8 tasks
konsumlamm opened this issue Mar 28, 2023 · 5 comments
Open
6 of 8 tasks

More SIMD implementations #66

konsumlamm opened this issue Mar 28, 2023 · 5 comments

Comments

@konsumlamm
Copy link
Contributor

konsumlamm commented Mar 28, 2023

See also #64.

@konsumlamm konsumlamm mentioned this issue Apr 7, 2023
@konsumlamm
Copy link
Contributor Author

I did some experiments on SIMD implementations for the other operations. However, I wasn't able to find any implementation that can be vectorized by OpenMP, so I resorted to using SIMD intrinsics (unfortunately, this is a lot harder to get right). For most operations, I wrote SSE and AVX versions. Here are my findings (the factors are speedups over the standard implementation):

  • bitIndex: about the same up to 1024 bits, then up to 0.6x (SSE) and 0.4x (AVX)
    nthBitIndex should be similar
  • reverseBits: up to 0.25x (SSE) and 0.15x (AVX)
  • selectBits: up to 0.36x (when using -mbmi2) and 0.06 (AVX)

Are you fine with using intrinsics? If so, should there be separate flags for SSE and AVX implementations (both are x86-specific, but quite common)?

@Bodigrim
Copy link
Owner

Bodigrim commented Apr 7, 2023

I'm fine with intrinsics, but not with additional flags.

@Bodigrim
Copy link
Owner

@konsumlamm I'd like to make a release soon so that consumers could benefit from your work here. Shall I go ahead as is or do you have plans to work on excludeBits / selectBits soon?

@konsumlamm
Copy link
Contributor Author

I have an implementation of selectBits/excludeBits lying around, that I could make a PR for, but only for the immutable versions. I don't have much time currently, so I can't work on the other things rn.

@Bodigrim
Copy link
Owner

I'll gladly take immutable versions only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants