Hacker GitHub

← All repos

google/highway

View on GitHub ↗ ★ 5,952 C++

Performance-portable, length-agnostic SIMD with runtime dispatch

107 mentions on Hacker News by 37 people: 7 stories, 100 comments · first 2020-08-04 · latest 2026-09-25

Mentions per year 107 mentions · busiest year 2023 (30)
20082026
  1. …rare nor hard, it's a few dozen lines of boilerplate. You can even write your code just once: see https://github.com/google/highway#examples .
  2. Cool that you started with SIMD :) FYI github.com/google/highway allows you to write your code once and target many instruction sets. It also fills in many of the gaps, including reductions. Disclosure: I am the main author.
  3. …a net win for data sizes >= 100 KiB. - Startup overhead is a non-issue on Icelake and AMD Zen4. 1: https://github.com/google/highway/blob/master/hwy/contrib/so...
  4. …a net win for data sizes >= 100 KiB. - Startup overhead is a non-issue on Icelake and AMD Zen4. 1: https://github.com/google/highway/blob/master/hwy/contrib/so...
  5. …vqsort README says it is a non-issue on that generation CPU (Skylake-X) based on their benchmarks: https://github.com/google/highway/tree/master/hwy/contrib/so... At least on their low clock speed server CPU (<=3GHz), downclocking was hard…
  6. Happy to discuss, preferably via issue on github.com/google/highway, would you like to open one?
    comment by janwas · 2023-06-09 · in The Case of the Missing SIMD Code
  7. …count. [1] https://github.com/simd-everywhere/simde [2] https://github.com/ermig1979/Simd [3] https://github.com/google/highway [4] https://gitlab.com/libeigen/eigen [5] https://github.com/shibatch/sleef
    comment by wyldfire · 2023-06-09 · in The Case of the Missing SIMD Code
  8. …referring to function multiversioning, but that only helps choose/call the implementation, not generate it. github.com/google/highway supports compiling your single source code once into several versions, and then dispatching to the best…
    comment by janwas · 2023-06-05 · in Vectorization: Introduction
  9. …faster than this when running on AVX-512. Disclosure: I am the main author; happy to discuss. 0: https://github.com/google/highway/blob/master/hwy/contrib/so...
  10. …be as verbose and cryptic as intrinsics; wrapper functions can help a lot :) Is this more readable? https://github.com/google/highway/blob/master/hwy/contrib/so...
  11. Here is an example on how to do this using github.com/google/highway: https://gcc.godbolt.org/z/zP7MYe9Yf You write the code only once and do not have to worry about any #pragma/conditional compilation. Just copy-paste about a dozen lines…
  12. …all of those things except first-fault loads in a cross-platform way at reasonable cost in https://github.com/google/highway . If any of those is the one missing piece that's preventing you from vectorizing, then it's totally worthwhile to…
  13. …to allow reordering (e.g. Highway's ReorderWidenMulAccumulate [1]), it's only 2 instructions. 1: https://github.com/google/highway/blob/master/g3doc/quick_re...
    comment by janwas · 2023-05-02 · in SIMD with Zig
  14. Benchmark results using vqsort's bench_sort on Skylake workstation (patch: https://github.com/google/highway/pull/1140 ) vqsort is about 1.9x and 1.8x as fast on 1M keys and 100M uniform random keys, respectively. Note that this code did…
  15. …algorithm beyond what is described in our paper, e.g. special handling for 1..3 unique keys, see https://github.com/google/highway/blob/master/hwy/contrib/so... .
  16. …be interesting to see it benchmarked against the highway qsort[1] Google published last year. [1] https://github.com/google/highway/tree/master/hwy/contrib/so...
  17. …) Could also be interesting for you to run the vqsort benchmark: https://github.com/google/highway/blob/master/hwy/contrib/so...
  18. It would be simpler to use the portable intrinsics from github.com/google/highway (disclosure: I am the main author). You include a header, and use the same functions on all platforms; the library provides wrapper functions which boil down…
  19. …use 256 or 512-bit SIMD. You might give our vqsort a try, it's quite a bit faster than std::sort: https://github.com/google/highway/blob/master/hwy/contrib/so...
    comment by janwas · 2022-12-18 · in Sorting with SIMD
  20. …one general all-to-all permute which is more expensive than two simple shuffles). Also, vqsort ( https://github.com/google/highway/tree/master/hwy/contrib/so... ) almost entirely consists of operations not supported by the extensions, and…
  21. …checked, it also only worked in a recent version of GCC. We do indeed have cross-platform intrinsics here: github.com/google/highway. Disclosure: I am the main author.
  22. Here's a first draft, comments welcome: https://github.com/google/highway/pull/1078 .
    comment by janwas · 2022-12-06 · in AVX 512 will be the future
  23. …some distributions. It's useful both for sorting networks and quicksort partitioning. Code here: https://github.com/google/highway/tree/master/hwy/contrib/so... (disclosure: I'm one of the co-authors).
  24. https://github.com/google/highway
    comment by kristianp · 2022-11-29 · in AVX 512 will be the future
  25. …to be a collection of prewritten kernels, so it only helps if the function you want to write is among them. github.com/google/highway seems to be closer to what is requested here. It provides around 200 portable intrinsics using which you…
    comment by janwas · 2022-11-28 · in AVX 512 will be the future
  26. Good news, you can use portable intrinsics (github.com/google/highway) and write your code only once. (Disclosure: I am the main author.)
    comment by janwas · 2022-09-15 · in Escaping strings faster with AVX-512
  27. :) For anyone interested, here's a brief discussion of tail handling: https://github.com/google/highway#strip-mining-loops (Overlapping is indeed cool where it works - idempotent operations.)
    comment by janwas · 2022-09-15 · in Escaping strings faster with AVX-512
  28. …yet clear whether the compiler will be smart enough to (peephole-?)optimize away the duplicates. 1: https://github.com/google/highway/blob/master/g3doc/instruct...
  29. Indeed a nice speedup! As to libraries: I'm the main author of github.com/google/highway which provides 'portable intrinsics' so you only have to write your code once for all platforms. It includes ready to use sorting and searching…
  30. github.com/google/highway is arguably such a collection of tricks, the x86_256-inl.h header does emulate some missing AVX-512 instructions such as this one or compressstoreu. (In this case we currently use a constant.)
  31. …may be possible to use unaligned loads/stores to handle the fringe in a single (final) iteration: https://github.com/google/highway#strip-mining-loops It is actually feasible to write vector-style code using SIMD instructions. Yes, the…
    comment by janwas · 2022-06-28 · in tolower() in bulk at speed
  32. …good solution when you can arrange it. In Highway we also use the blending/bit-select you mention: https://github.com/google/highway/blob/master/hwy/ops/generi... If HWY_MEM_OPS_MIGHT_FAULT, which is true if using ASAN or AVX2 (because AMD…
    comment by janwas · 2022-06-28 · in tolower() in bulk at speed
  33. …SVE will enable (properly written) software to benefit from future wider vectors without even recompiling. github.com/google/highway (disclosure: I am the main author) lets you write your code only once, and target newer instructions…
  34. Response here because I'm not on Twitter: https://github.com/google/highway/issues/736 In short, what is being compared is O(1) djbsort sorting network, vs our full quicksort with pivot sampling, partitioning, then sorting network. This is…
  35. …along the same lines, what can people do (or rather, what do you do) about situations like this: https://github.com/google/highway/blob/master/hwy/examples/b... where things might get better in the future but for now we have to implement…
    comment by nickysielicki · 2022-06-04 · in Vectorized and performance-portable Quicksort
  36. …The interesting thing here is that they turn out to be slower than our approach using portable intrinsics (github.com/google/highway) :)
  37. …gives you wrapper functions over the platform's intrinsics, emulating missing functionality where required: github.com/google/highway. Disclosure: I am the main author.
  38. …to program for since vector sizes keep getting bigger This can be fixed with an abstraction layer such as github.com/google/highway (disclosure: I am the main author). The programming model is variable-length vectors and we can map that…
    comment by janwas · 2022-05-23 · in Faster CRC32 on the Apple M1
  39. …per x86 vector instruction. it would be annoying to rewrite that per platform, but we didn't have to - github.com/google/highway (disclosure: I am the main author) provides portable intrinsics.
  40. …with the x86 SIMD instructions Actually, when the code is expressed using "portable intrinsics" ( https://github.com/google/highway ), the source code looks the same but compiles to SSE4/AVX2/AVX-512 and NEON,SVE,SVE2 and RISC-V V…
    comment by janwas · 2022-02-14 · in Prefix Sum with SIMD
  41. Yes, our github.com/google/highway does that for SSE4/AVX2/AVX-512. It targets at the level of instruction sets, though, not specific microarchitectures.
  42. …StoreInterleaved3 which is implemented similar to yours (more instructions but fewer constants): https://github.com/google/highway/blob/master/hwy/ops/x86_12... In my experience, integer mul are the hardest to bridge, but at least for dot…
  43. …benchmark does contain some boilerplate and extra code for measurements but a simple example is at https://github.com/google/highway/blob/master/hwy/examples/b... . Or how about https://github.com/google/highway/blob/master/hwy/examples/s..…
  44. …emulation is going to be way more expensive. Actually it uses exactly the same instruction :) https://github.com/google/highway/blob/master/hwy/ops/x86_25... Thanks for sharing the list! Out of curiosity, can you expand on what…
  45. …- it offers more control, similar to intrinsics. There are about two dozen non-vertical ops (see https://github.com/google/highway/blob/master/g3doc/quick_re... and "blockwise" and "swizzle") and it sounds like you want Set and…
  46. …at least 25% market penetration on clients, which may or may not happen. Why not use it where available? github.com/google/highway lets you write code once using 'platform-independent intrinsics', and generate AVX2/AVX-512/NEON/SVE into a…
  47. …places. I am confident we will be able to hide both SVE and RVV behind the same C++ interface ( https://github.com/google/highway ) - works for RVV, just started SVE.
    comment by janwas · 2021-05-07 · in ARM vs. RISC-V Vector Extensions
  48. …might also find this short intro [1] helpful, including tips on porting. (Disclosure: author) 1: https://github.com/google/highway/blob/master/g3doc/highway_... > many available instructions are missing from the wrappers Highway can…
    comment by janwas · 2021-04-27 · in SIMD for C++ Developers [pdf]
  49. …it, writing your own SIMD library is fairly simple hm.. it's indeed easy to start, but maintaining https://github.com/google/highway (supports clang/gcc/MSVC, x86/ARM/RiscV) is quite time-consuming, especially working around compiler bugs.
    comment by janwas · 2021-04-27 · in SIMD for C++ Developers [pdf]
  50. …look at std::experimental::simd ( https://github.com/VcDevel/std-simd ) instead. Google's Highway ( https://github.com/google/highway ) is also pretty interesting.
    comment by nemequ1729 · 2020-08-04 · in SIMD Everywhere: 0.5.0