百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
T

tsimd

> 编程语言
开源

适用于英特尔 CPU 的基本 C++ SIMD 类型 (sse、avx、avx2、avx512)

358 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

适用于英特尔 CPU 的基本 C++ SIMD 类型 (sse、avx、avx2、avx512)

tsimd - Fundamental C++ SIMD types for Intel CPUs (sse to avx512)

This library is header-only and is implemented according to which Intel ISA flags are enabled in the translation unit for which they are used (e.g. -mavx with gcc or clang).

Master Status:

TODOs (contributions welcome!)

  • unsigned integer pack<> types
  • support for other CPU ISAs

Build Requirements

Using tsimd

  • C++11 compiler

(unofficial list of compilers, not all are tested)

  • GCC >= 4.8.1
  • clang >= 3.4
  • ICC >= 16
  • Visual Studio 2015 (64-bit target)

Building tsimd's examples/benchmarks/tests and installing from soure

  • cmake >= 3.2

Library layout and usage

The library is logically composed of 3 different components:

  1. The pack class, which is a logical SIMD register
  2. Functions which can load and store packs in and out of larger arrays.
  3. Operators and functions to manipulate packs.

While there does not yet exist any true documentation, users are encouraged to see what type aliases are defined in tsimd/detail/pack.h, as well as what operators and functions are available in tsimd/detail/operators/ and tsimd/detail/functions/ respectively. Generally speaking, each header found in detail/ encapsulates exactly one type, operator, or function to aide in discovery.

Example

SAXPY

Consider the following function (kernel) taking values from two input arrays and storing in an output array.

cpp
// NOTE: n is the length of all 3 arrays
void saxpy(float a, int n, float x[], float y[], float out[])
{
  for (int i = 0; i (&x[i]);
    const vfloat yi = load(&y[i]);
    const vfloat result = a * xi + yi; // same formula!
    store(result, &out[i]);
  }
}

The advantage to this version (instead of using a specific SIMD width, say vfloat4 or vfloat8) is that the kernel function will be "widened" to the best available width based on how it gets compiled. In other words: 4-wide for SSE, 8-wide for AVX/AVX2, and 16-wide for AVX512.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C++cppcpp11header-onlysimd

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

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