{"id":24582484,"url":"https://github.com/vcdevel/std-simd","last_synced_at":"2025-04-04T17:06:04.048Z","repository":{"id":37430846,"uuid":"185398124","full_name":"VcDevel/std-simd","owner":"VcDevel","description":"std::experimental::simd for GCC [ISO/IEC TS 19570:2018]","archived":false,"fork":false,"pushed_at":"2023-03-10T15:37:36.000Z","size":3498,"stargazers_count":607,"open_issues_count":27,"forks_count":40,"subscribers_count":22,"default_branch":"master","last_synced_at":"2025-03-28T16:05:27.719Z","etag":null,"topics":["avx","avx512","cpp17","gcc","libstdcxx","neon","simd","sse","wg21"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/VcDevel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-07T12:32:36.000Z","updated_at":"2025-03-14T06:41:38.000Z","dependencies_parsed_at":"2025-01-24T03:33:46.513Z","dependency_job_id":null,"html_url":"https://github.com/VcDevel/std-simd","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VcDevel%2Fstd-simd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VcDevel%2Fstd-simd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VcDevel%2Fstd-simd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VcDevel%2Fstd-simd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VcDevel","download_url":"https://codeload.github.com/VcDevel/std-simd/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247217175,"owners_count":20903008,"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":["avx","avx512","cpp17","gcc","libstdcxx","neon","simd","sse","wg21"],"created_at":"2025-01-24T03:22:19.671Z","updated_at":"2025-04-04T17:06:04.030Z","avatar_url":"https://github.com/VcDevel.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `std::experimental::simd`\nportable, zero-overhead C++ types for explicitly data-parallel programming\n\n**Development here is going to move on to std::simd for C++26. For the TS \nimplementation reach for \n[GCC/libstdc++](https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=libstdc%2B%2B-v3/include/experimental/simd;hb=HEAD).**\n`std::experimental::simd` is shipping with GCC since version 11.\n\nThis package implements ISO/IEC TS 19570:2018 Section 9 \"Data-Parallel Types\".\nThe implementation derived from https://github.com/VcDevel/Vc.\n\nBy default, the `install.sh` script places the `std::experimental::simd`\nheaders into the directory where the standard library of your C++ compiler\n(identified via `$CXX`) resides.\n\nIt is only tested and supported with GCC trunk, even though it may work\nwith older GCC versions.\n\n## Target support\n\n* x86_64 is the main development platform and thoroughly tested. This includes\n  support from SSE-only up to AVX512 on Xeon Phi or Xeon CPUs.\n* aarch64, arm, and ppc64le was tested and verified to work. No significant \n  performance evaluation was done.\n* In any case, a fallback to correct execution via builtin arithmetic types is\n  available for all targets.\n\n## Installation Instructions\n\n```sh\n$ ./install.sh\n```\n\nUse `--help` to learn about the available options.\n\n## Example\n\n### Scalar Product\n\nLet's start from the code for calculating a 3D scalar product using builtin floats:\n```cpp\nusing Vec3D = std::array\u003cfloat, 3\u003e;\nfloat scalar_product(Vec3D a, Vec3D b) {\n  return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\n}\n```\n\nUsing `simd`, we can easily vectorize the code using the `native_simd\u003cfloat\u003e` \ntype ([Compiler Explorer](https://godbolt.org/z/AXAe8K)):\n```cpp\nusing std::experimental::native_simd;\nusing Vec3D = std::array\u003cnative_simd\u003cfloat\u003e, 3\u003e;\nnative_simd\u003cfloat\u003e scalar_product(Vec3D a, Vec3D b) {\n  return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\n}\n```\n\nThe above will scale to 1, 4, 8, 16, etc. scalar products calculated in parallel, depending\non the target hardware's capabilities.\n\nFor comparison, the same vectorization using Intel SSE intrinsics is more verbose, uses\nprefix notation (i.e. function calls), and neither scales to AVX or AVX512, nor is it\nportable to different SIMD ISAs:\n```cpp\nusing Vec3D = std::array\u003c__m128, 3\u003e;\n__m128 scalar_product(Vec3D a, Vec3D b) {\n  return _mm_add_ps(_mm_add_ps(_mm_mul_ps(a[0], b[0]), _mm_mul_ps(a[1], b[1])),\n                    _mm_mul_ps(a[2], b[2]));\n}\n```\n\n## Build Requirements\n\nnone. It's header-only.\n\nHowever, to build the unit tests you will need:\n* cmake \u003e= 3.0\n* GCC \u003e= 9.1\n\nTo execute all AVX512 unit tests, you will need the Intel SDE.\n\n## Building the tests\n\n```sh\n$ make test\n```\n\nThis will create a build directory, run cmake, compile the tests, and execute the tests.\n\n## Documentation\n\nhttps://en.cppreference.com/w/cpp/experimental/simd\n\n## Publications\n\n* [J. Hoberock, \"Working Draft, C++ Extensions for Parallelism Version 2\",\n  2019](https://wg21.link/N4808)\n* [M. Kretz, \"Extending C++ for Explicit Data-Parallel Programming via SIMD\n  Vector Types\", Goethe University Frankfurt, Dissertation,\n  2015.](http://publikationen.ub.uni-frankfurt.de/frontdoor/index/index/docId/38415)\n* [P. Esterie, M. Gaunard, J. Falcou and J. Lapresté, \"Exploiting Multimedia Extensions\n  in C++: A Portable Approach,\" in Computing in Science \u0026 Engineering, vol. 14, no. 5,\n  pp. 72-77, Sept.-Oct. 2012.](https://dx.doi.org/10.1109/MCSE.2012.96)\n* [M. Kretz and V. Lindenstruth, \"Vc: A C++ library for explicit\n  vectorization\", Software: Practice and Experience,\n  2011.](http://dx.doi.org/10.1002/spe.1149)\n* [J. Falcou and J. Serot, \"E.V.E., An Object Oriented SIMD Library.\",\n  Scalable Computing: Practice and Experience, vol. 6, no. 4, pp. 72-77,\n  2005.](https://www.scpe.org/index.php/scpe/article/view/345/0)\n\n\n## License\n\nThe `simd` headers, tests, and benchmarks are released under the terms of the\n[3-clause BSD license](http://opensource.org/licenses/BSD-3-Clause).\n\nNote that the code in libstdc++ is distributed under GPL3 with runtime library exception.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvcdevel%2Fstd-simd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvcdevel%2Fstd-simd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvcdevel%2Fstd-simd/lists"}