{"id":22338092,"url":"https://github.com/jeffamstutz/tsimd","last_synced_at":"2025-07-02T14:08:57.220Z","repository":{"id":37566360,"uuid":"106767279","full_name":"jeffamstutz/tsimd","owner":"jeffamstutz","description":"Fundamental C++ SIMD types for Intel CPUs (sse, avx, avx2, avx512)","archived":false,"fork":false,"pushed_at":"2021-06-28T18:27:38.000Z","size":618,"stargazers_count":346,"open_issues_count":3,"forks_count":20,"subscribers_count":24,"default_branch":"main","last_synced_at":"2025-05-19T13:08:43.855Z","etag":null,"topics":["cpp","cpp11","header-only","simd","simd-library"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jeffamstutz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-13T02:16:59.000Z","updated_at":"2025-04-07T06:39:48.000Z","dependencies_parsed_at":"2022-08-29T06:30:24.503Z","dependency_job_id":null,"html_url":"https://github.com/jeffamstutz/tsimd","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jeffamstutz/tsimd","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeffamstutz%2Ftsimd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeffamstutz%2Ftsimd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeffamstutz%2Ftsimd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeffamstutz%2Ftsimd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jeffamstutz","download_url":"https://codeload.github.com/jeffamstutz/tsimd/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeffamstutz%2Ftsimd/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263154351,"owners_count":23422009,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","cpp11","header-only","simd","simd-library"],"created_at":"2024-12-04T06:13:09.457Z","updated_at":"2025-07-02T14:08:57.200Z","avatar_url":"https://github.com/jeffamstutz.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tsimd - Fundamental C++ SIMD types for Intel CPUs (sse to avx512)\n\nThis library is header-only and is implemented according to which Intel ISA\nflags are enabled in the translation unit for which they are used (e.g. -mavx\nwith gcc or clang).\n\nMaster Status: [![Build Status](https://travis-ci.org/jeffamstutz/tsimd.svg?branch=master)](https://travis-ci.org/jeffamstutz/tsimd)\n\n## TODOs (contributions welcome!)\n\n- unsigned integer pack\u003c\u003e types\n- support for other CPU ISAs\n\n## Build Requirements\n\n### Using tsimd\n\n- C++11 compiler\n\n(unofficial list of compilers, not all are tested)\n\n* GCC \u003e= 4.8.1\n* clang \u003e= 3.4\n* ICC \u003e= 16\n* Visual Studio 2015 (64-bit target)\n\n### Building tsimd's examples/benchmarks/tests and installing from soure\n\n- cmake \u003e= 3.2\n\n## Library layout and usage\n\nThe library is logically composed of 3 different components:\n\n1. The pack\u003cT, W\u003e class, which is a _logical_ SIMD register\n2. Functions which can load and store packs in and out of larger arrays.\n3. Operators and functions to manipulate packs.\n\nWhile there does not yet exist any true documentation, users are encouraged to\nsee what type aliases are defined in ```tsimd/detail/pack.h```, as well as what\noperators and functions are available in ```tsimd/detail/operators/``` and\n```tsimd/detail/functions/``` respectively. Generally speaking, each header\nfound in ```detail/``` encapsulates exactly one type, operator, or function to\naide in discovery.\n\n## Example\n\n### SAXPY\n\nConsider the following function (kernel) taking values from two input arrays\nand storing in an output array.\n\n```cpp\n// NOTE: n is the length of all 3 arrays\nvoid saxpy(float a, int n, float x[], float y[], float out[])\n{\n  for (int i = 0; i \u003c n; ++i) {\n    const float xi = x[i];\n    const float yi = y[i];\n    const float result = a * xi + yi;\n    out[i] = result;\n  }\n}\n```\n\nThis kernel ends up applying the exact same formula to every element in the\ndata. SIMD instructions enable us to reduce the total number of iterations by a\nfactor of the CPU's SIMD register size. We do this by using tsimd types\ninstead of builtin types.\n\n```cpp\n// NOTE: n is the length of all 3 arrays\nvoid saxpy_tsimd(float a, int n, float x[], float y[], float out[])\n{\n  using namespace tsimd;\n  for (int i = 0; i \u003c n; i += vfloat::static_size) {\n    const vfloat xi = load\u003cvfloat\u003e(\u0026x[i]);\n    const vfloat yi = load\u003cvfloat\u003e(\u0026y[i]);\n    const vfloat result = a * xi + yi; // same formula!\n    store(result, \u0026out[i]);\n  }\n}\n```\n\nThe advantage to this version (instead of using a specific SIMD width, say\n```vfloat4``` or ```vfloat8```) is that the kernel function will be \"widened\"\nto the best available width based on how it gets compiled. In other words:\n4-wide for SSE, 8-wide for AVX/AVX2, and 16-wide for AVX512.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeffamstutz%2Ftsimd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjeffamstutz%2Ftsimd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeffamstutz%2Ftsimd/lists"}