Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
S

simdeez

> 编程语言
Open source

easy simd

376 stars0 likes1 views
WebsiteGitHub

About

easy simd

A library that abstracts over SIMD instruction sets, including ones with differing widths. SIMDeez is designed to allow you to write a function one time and produce SSE2, SSE41, AVX2, AVX-512, Neon and WebAssembly SIMD versions of the function. You can either have the version you want chosen at compile time or automatically at runtime.

Originally developed by @jackmott. Active maintenance and releases now happen from this repository.

If there are intrinsics you need that are not currently implemented, create an issue and I'll add them. PRs to add more intrinsics are welcome. Currently things are well fleshed out for i32, i64, f32, and f64 types.

AVX-512 support is now included for x86/x86_64 targets with avx512f, avx512bw, and avx512dq. Runtime dispatch will select it ahead of AVX2 when those features are available.

Refer to the excellent Intel Intrinsics Guide for documentation on these functions:

Features

  • SSE2, SSE41, AVX2, AVX-512, Neon, WebAssembly SIMD and scalar fallback
  • Can be used with compile time or run time selection
  • No runtime overhead
  • Uses familiar intel intrinsic naming conventions, easy to port.
    • _mm_add_ps(a,b) becomes add_ps(a,b)
  • Fills in missing intrinsics in older APIs with fast SIMD workarounds.
    • ceil, floor, round, blend, etc.
  • Can be used by #[no_std] projects
  • Operator overloading: let sum = va + vb or s *= s
  • Extract or set a single lane with the index operator: let v1 = v[1];
  • Falls all the way back to scalar code for platforms with no SIMD or unsupported SIMD

SIMD math

SIMDeez includes a native, pure-Rust SIMD math surface exposed through simdeez::math and re-exported in simdeez::prelude.

Covered families include:

  • core log/exp: log2_u35, exp2_u35, ln_u35, exp_u35
  • trig and inverse trig: sin_u35, cos_u35, tan_u35, asin_u35, acos_u35, atan_u35, atan2_u35
  • hyperbolic and inverse hyperbolic: sinh_u35, cosh_u35, tanh_u35, asinh_u35, acosh_u35, atanh_u35
  • binary misc: log10_u35, hypot_u35, fmod

For implementation notes and benchmark guidance, see SIMD_MATH.md.

Example:

rust
use simdeez::prelude::*;

fn apply_math(x: S::Vf32) -> S::Vf32 {
    let y = x.log2_u35();
    y.exp2_u35() + x.ln_u35() + x.exp_u35() + x.sin_u35() + x.cos_u35() + x.tan_u35()
}

Compared to packed_simd

  • SIMDeez can abstract over differing simd widths. packed_simd does not
  • SIMDeez builds on stable rust now, packed_simd does not

Compared to Faster

  • SIMDeez can be used with runtime selection, Faster cannot.
  • SIMDeez has faster fallbacks for some functions
  • SIMDeez does not currently work with iterators, Faster does.
  • SIMDeez uses more idiomatic intrinsic syntax while Faster uses more idiomatic Rust syntax
  • SIMDeez builds on stable rust now, Faster does not.

All of the above could change! Faster seems to generally have the same performance as long as you don't run into some of the slower fallback functions.

Example

…

This will generate the following functions for you:

  • distance the generic version of your function
  • distance_scalar a scalar fallback
  • distance_sse2 SSE2 version
  • distance_sse41 SSE41 version
  • distance_avx2 AVX2 version
  • distance_avx512 AVX-512 version
  • distance_neon Neon version
  • distance_wasm WebAssembly SIMD version
  • distance_runtime_select // picks the fastest of the above at runtime

You can use any of these you wish, though typically you would use the runtime_select version unless you want to force an older instruction set to avoid throttling or for other arcane reasons. Optionally you can use the simd_compiletime_generate! macro in the same way. This will produce 2 active functions via the cfg attribute feature:

  • distance the generic version of your function
  • distance_compiletime the fastest instruction set availble for the given compile time feature set

You may also forgo the macros if you know what you are doing, just keep in mind there are lots of arcane subtleties with inlining and target_features that must be managed. See how the macros expand for more detail.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Rust

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言