google /highway
Performance-portable, length-agnostic SIMD with runtime dispatch
★ 5,980⑂ 498👁 55⑃ 2,950● 576▤ 24
+2
日增长
5,980
stars
498
forks
55
watchers
2,950
prs
576
issues
24
releases
README
Efficient and performance-portable vector software [//]: (placeholder, do not remove) Highway is a C++ library that provides portable SIMD/vector intrinsics. Documentation Previously licensed under Apache 2, now dual-licensed as Apache 2 / BSD-3. Why We are passionate about high-performance software. We see major untapped potential in CPUs (servers, mobile, desktops). Highway is for engineers who want to reliably and economically push the boundaries of what is possible in software. How CPUs provide SIMD/vector instructions that apply the same operation to multiple data items. This can reduce energy usage e.g. fivefold because fewer instructions are executed. We also often see 5-10x speedups. Highway makes SIMD/vector programming practical and workable according to these guiding principles: Does what you expect: Highway is a C++ library with carefully-chosen functions that map well to CPU instructions without extensive compiler transformations. The resulting code is more predictable and robust to code changes/compiler updates than autovectorization. Works on widely-used platforms: Highway supports seven architectures; the same application code can target various instruction sets, including those with 'scalable' vectors (size unknown at compile time). Highway only requires C++17 (language features, not necessarily the library) and supports four families of compilers. If you want to use Highway on other platforms, please raise an issue. Flexible to deploy: Applications using Highway can run on heterogeneous clouds or client devices, choosing the best available instruction set at runtime. Alternatively, developers may choose to target a single instruction set without any runtime overhead. In both cases, the application code is the same except for swapping HWY_STATIC_DISPATCH with HWY_DYNAMIC_DISPATCH plus one line of code. See also @kfjahnke's introduction to dispatching. Suitable for a variety of domains: Highway provides an extensive set of operations, used for image processing (floating-point), compression, video analysis, linear algebra, cryptography, sorting and random generation. We recognise that new use-cases may require additional ops and are happy to add them where it makes sense (e.g. no performance cliffs on some architectures). If you would like to discuss, please file an issue. Rewards data-parallel design: Highway provides tools such as Gather, MaskedLoad, and FixedTag to enable speedups for legacy data structures. However, the biggest gains are unlocked by designing algorithms and data structures for scalable vectors. Helpful techniques include batching, structure-of-array layouts, and aligned/padded allocations. We recommend these resources for getting started: - SIMD programming with Highway talk - SIMD for C++ Developers - Algorithms for Modern Hardware - Optimizing software in C++ - Improving performance with SIMD intrinsics in three use cases Examples Online demos using Compiler Explorer: - mult
Top issues
#2364'VFT dispatching' to call into SIMD-ISA-specific code23 comments · 2024-10-28#2114Question: header only version ?17 comments · 2024-04-27#1338Implement a few missing things using SSE or NEON intrinsics.14 comments · 2023-04-25#2831`hwy::DispatchedTarget` always returns HWY_EMU128 on WASM/Emscripten10 comments · 2025-12-18#1782Improving dynamic dispatch for multiple targets for x86-64/AArch64/PPC6410 comments · 2023-09-26#2345Adding wrappers for __riscv_vget* and __riscv_vset* for non-tuple types9 comments · 2024-10-07#2050Support for saturating doubling multiply add9 comments · 2024-04-03#3022Test on leading edge linux distribution8 comments · 2026-04-30
Latest release
1.4.0 1.4.0 2026-04-23Add: - Fast math functions, sum_array example - HWY_ARCH_MAX_BYTES, HWY_MIN_BYTES, HWY_NATIVE_MASK, HWY_REGISTERS - HWY_EXPORT_AND_TEST_BEST_P - InterleaveLower/UpperBlocks, Lookup8, XorAndNot - MinMax algo, AtomicBitSet - RVV and LSX/LASX runtime dispatch, FreeBSD futex Improvements: - MulByPow2, PopulationCount, SumsOfAdjQuadAbsDiff - ReorderWidenMulAccumulate, SumOfMulQuadAccumulate - Re-enable SVE, add i8mm for SVE/NEON_BF16 Fixes: - EVEX512 compiler change workaround, Timer::start() result truncation - BF16 dot on SVE, doc formatting, StringTable race, warnings