Efficient and performance-portable vector software
github.com
github.com
Considering climate change more focus should be put on making fast and efficient software. Every watt not wasted on bad algorithms/code is good.
If it looks like I misrepresented it again, please correct me!
> "Programmers waste enormous amounts of time thinking about, or worrying about, the speed of noncritical parts of their programs, and these attempts at efficiency actually have a strong negative impact when debugging and maintenance are considered. We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. Yet we should not pass up our opportunities in that critical 3%."
Also this was probably in the 80ies or 90ies and was in reference to loop unrolling or hand-crafting assembly - which is kind of different to just not knowing what you are doing and writing O(n^2) algorithms for O(n) or O(log(n)) problems - due to a lack of understanding the problem which is the problem we have at the moment (not saying I'm above that, been there done that ;).
If Google can speed up std::qsort tenfold using SIMD instructions and likely other operations we should add this code everywhere imho.
On the other hand, on the order of 80% of a chip’s power is spent on OOO execution. If you want the order of magnitude improvement in power efficiency, you need to dump superscalar/OOO in favor of smart compilers and VLIW. Cheap DSPs have been doing it for years, but compilers aren’t good enough yet for general purpose processing.
And a portable API such as Highway also helps us move the same code from x86 to Arm or RISC-V with just a recompile :D
So we need to go back to coding in assembler to save the planet? Sign me up!
Sorting is a landscape of hundreds of algorithms, with various details and assumptions.
Even the definition of the sorting task can be different - depending on what, how, and why you are going to sort.
I've covered it in my presentation here: https://presentations.clickhouse.com/bdtc_2019/#20
I have tested it in ClickHouse, but end up with this:
https://github.com/ClickHouse/ClickHouse/blob/master/src/Com...
PS. It's strange that Google's paper dismisses djbsort: https://sorting.cr.yp.to/ - also in the class of sorting networks, but introduced a few years ago.
FYI - all I'm doing is changing the algorithm attributed to HH Seward in AoCP 5.2.5 to be MSB, counting the number of elements in each bucket and allocating an equal(ish) number of elements (via entire buckets) to each thread, which then act in the normal recursive manner as described.
I've been having trouble getting good SIMD performance from WASM. Are there any benchmarks posted anywhere comparing Highway's performance on various native targets vs WASM?
Target support is good, though AFAIK non-constexpr-size vectors (SVE/RVV) are not supported.
The biggest concern I'd have is predictability. A thin wrapper over intrinsics makes it easy to experiment with codegen and see what's going on. We've seen some compiler bugs but usually narrow scope and relatively easy to reproduce. By contrast, Halide involves extensive compiler transforms. When that breaks, it's much harder to move forward. There is also a risk of performance cliffs because the language is very flexible and AFAIK lacks 'this is going to be slow' guardrails.
It's great for prototyping and image processing and this is probably what you're using it for? But I also would not expect peak performance, at one point I reimplemented parts of RAISR with explicit SIMD and saw a surprisingly high speedup.
Yes I work on image processing, same pipeline as RAISR actually.
Do you think it would be possible to port this to Rust?
There's been other interest in a Rust port, feel free to open an issue to perhaps start a discussion.