r/cpp • • Jun 12 '26

Comparing std::simd with Highway

From TL of Highway, some thoughts on pros and cons of std::simd by comparison:

https://github.com/google/highway/blob/master/g3doc/std_simd_comparison.md

Happy to discuss.

61 Upvotes

33 comments sorted by

View all comments

Show parent comment

6

u/janwas_ Jun 12 '26

Thanks, glad to hear 😄

It's not completely impossible with SVE/RVV, compiler writers did introduce a workaround: the -msve-vector-bits flag we mention. However, this means you have to know up-front what the vector width will be; your code will crash if running on another CPU.

Unfortunately, using std::simd would not help us at all. Because std::simd does not support the concept of scalable vectors, we cannot delegate to it, or implement anything on top of it. What would instead help is standardizing restrict, or better yet, the #pragma target.

1

u/camel-cdr- Jun 12 '26

Idk, why toolchains don't support a this or greater flag and use predication to only use the specified minimum length.