Hacker News new | ask | show | jobs
by juancn 573 days ago
The main problem is that there are no good abstractions in popular programming languages to take advantage of SIMD extensions.

Also, the feature set being all over the place (e.g. integer support is fairly recent) doesn't help either.

ISPC is a good idea, but execution is meh... it's hard to setup and integrate.

Ideally you would want to be able to easily use this from other popular languages, like Java, Python, Javascript, without having to resort to linking a library written in C/C++.

Granted, language extensions may be required to approach something like that in an ergonomic way, but most somehow end up just mimicking what C++ does and expose a pseudo assembler.

5 comments

The best is the GPU programming approach, with specialised languages

Just like using SQL is much more sane than low level C APIs to handle BTree nodes.

The language extensions help, but code still requires too much low level expertise, with algorithms and data structures having to take SIMD/MIMD capabilities into account anyway.

I'm surprised no one has mentioned Vc. I found ispc clunky and not as performant, and std::simd didn't support some useful math ops like rsqrt. Vc has been around for years, I have no trouble including it in my codes, it has masking and many of the most useful math ops, and I can get over 1 TF/s on a consumer-grade Ryzen and at least 3 TF/s on the big Epyc CPUs.

https://github.com/VcDevel/Vc https://github.com/Applied-Scientific-Research/nvortexVc

I think the EVE library for C++ is a great abstraction. It's got an unusual syntax using subscript operator overloading, but that winds up being a very ergonomic and flexible way to program with masked-SIMD.
I’m not sure about EVE. I trialled it by trying to uppercase a string and even though I got it working in the end it was quite unpleasant. Their docs need to be better.
C#’s Vector<T> does a pretty great job.
std::experimental::simd is happening. It should be part of c++26.
Unfortunately a bit late :) Highway reached v1.0 about 2.5 years ago. How long would it take until Clang/GCC/MSVC are ready, and all users' distros have updated? Not to mention that the number of ops provided by std::experimental::simd is extremely limited - basically only math operators, and zero support for shuffling/crypto/rounding/interleaving/table lookups which seem indispensable for many applications.