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

Fallback code paths with "SIMD Everywhere" #1091

Open
michaeleisel opened this issue Aug 4, 2020 · 3 comments
Open

Fallback code paths with "SIMD Everywhere" #1091

michaeleisel opened this issue Aug 4, 2020 · 3 comments

Comments

@michaeleisel
Copy link

@michaeleisel michaeleisel commented Aug 4, 2020

https://github.com/simd-everywhere/simde has done their first release ( https://simd-everywhere.github.io/blog/announcements/release/2020/06/21/0.5.0-release.html ) and it seems like something potentially useful for merging code paths. The most likely candidate I imagine is using SIMD code to replace the non-SIMD fallback path, but maybe it'd be worth checking if it can be used to merge ARM and x86_64 or support other architectures

@lemire
Copy link
Member

@lemire lemire commented Aug 4, 2020

can be used to merge ARM and x86_64 or support other architectures

They have been merged. However, full merger is not possible nor desirable. You do not want to have just one code path. You want to have distinct code for each kernels to account for the differences. It is not the case that one algorithm works best on all platforms all of the time. There are differences. For example, SIMD instructions under x86_64 typically do not support unsigned arithmetic while ARM NEON does.

The most likely candidate I imagine is using SIMD code to replace the non-SIMD fallback path

That might be interesting if we can improve the performance.

Pull requests invited!

I'll tweak the title of this issue.

@nemequ
Copy link

@nemequ nemequ commented Aug 5, 2020

FWIW, if there is anything missing from SIMDe (unlikely) I would be happy to add it. If nothing else I'd be interested in profiling data to look for optimization opportunities in SIMDe :)

They have been merged. However, full merger is not possible nor desirable. You do not want to have just one code path. You want to have distinct code for each kernels to account for the differences. It is not the case that one algorithm works best on all platforms all of the time. There are differences. For example, SIMD instructions under x86_64 typically do not support unsigned arithmetic while ARM NEON does.

I fully agree here; SIMDe isn't going to be as fast as a port written by someone who knows NEON. At best it could be useful to merge some stuff which happen to work well on both architectures but AFAIK simdjson already has a good NEON port so if it's not getting in the way I don't think you would gain much from merging code paths.

The most likely candidate I imagine is using SIMD code to replace the non-SIMD fallback path

That might be interesting if we can improve the performance.

Odds pretty good for that, which would be very nice for WASM and POWER (unless simdjson already has WASM SIMD 128 and/or AltiVec/VSX implementations?). I know MMseq2 did this and got a nice performance boost. Plus you could drop the separate portable implementation if you want, and deleting code is always fun.

Most people are focused on the x86 support, but we do also have pretty extensive support for using NEON on other architectures. That might be a better route to go than using x86 functions since other architectures tend to be more NEON-like than SSE-like (including supporting unsigned arithmetic). It could also make working on the NEON code much easier since you can do it on your x86 machine without emulators, cross-compilers, remote debugging, etc.

@lemire lemire changed the title Merging code paths with "SIMD Everywhere" Fallback code paths with "SIMD Everywhere" Aug 5, 2020
@lemire
Copy link
Member

@lemire lemire commented Aug 5, 2020

I have retitled the issue. It is quite valid, I think.

Note that the arch-specific part is quite tiny as it is, so it would not be massive work to add simde.

@lemire lemire modified the milestones: Post 2.0, 2.0 Aug 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.