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

Using VecCore with runtime-chosen implementations #20

Closed
amyspark opened this issue Oct 31, 2021 · 5 comments
Closed

Using VecCore with runtime-chosen implementations #20

amyspark opened this issue Oct 31, 2021 · 5 comments

Comments

@amyspark
Copy link

Hi,

I'm researching potential replacements for Vc in order to enable support for Arm in our app. However, your docs do not list whether implementations can be runtime dispatched. Is it possible to use VecCore as with Vc's Vc::CurrrentImplementation::current()?

@amadio
Copy link
Member

amadio commented Oct 31, 2021

Dear @amyspark,

I'm researching potential replacements for Vc in order to enable support for Arm in our app.

Would that be Krita?

VecCore is just a small abstraction layer on top of Vc, umesimd (no longer developed), and since last version also std::simd. The goal is just to provide a fallback for architectures not supported by Vc, and to be able to replace Vc with some other backend if that makes sense. VecCore does not have in it a mechanism to choose at runtime what to run, although it does allow you to compile multiple versions of your functions using SSE, AVX, etc, into the same binary and choose what to run at runtime via your own means. Take a look at the mandelbrot example, which runs with multiple backends in the same binary.

I think that if you just want to replace Vc, and you can work with std::simd, it's probably better to go with that. If you won't always have that available, and VecCore's API exposes enough of the SIMD features for your needs (and you're ok with it being a bit clunky), then you can write your code using VecCore and then choose between the scalar, Vc, or std::simd backends at compile-time depending on what's available to you. Vc should work on ARM, but I don't think performance is great there. std::simd does work with good performance, though. I've not looked too deep into PowerPC (no access to hardware at the moment), but I believe that's supported as well.

I hope this is enough to answer your question.

@amyspark
Copy link
Author

Would that be Krita?

Yes, it's Krita. We're looking for a replacement that supports Arm, especially now that Arm silicon is available on desktops. We could use std::simd but that's only available with GCC (we support macOS, hence Clang, and MSVC); moreover, I am told by our lead dev that VcDevel/std-simd#4 (or something to the effect) is a hard requirement.

@amadio
Copy link
Member

amadio commented Nov 1, 2021

If gather/scatter support and portability are both required, then I guess the choices are limited. VecCore can help you switch between scalar, Vc, and std::simd without having to change your own code, but I think you will only get gather/scatter support using hardware instructions when using the Vc backend on AMD/Intel architectures, and will have to fallback to a scalar implementation otherwise. If needed, we could add/improve in VecCore implementations of Gather/Scatter that would work on ARM.

@amadio
Copy link
Member

amadio commented May 23, 2022

@amyspark Can I close this? I see that you chose to move to xsimd. I think that was a good choice, the QuantStack team does good work. Cheers,

@amyspark
Copy link
Author

Yeah, move has been successful. Let's close this one.

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