{"id":13580090,"url":"https://github.com/rust-lang/portable-simd","last_synced_at":"2025-05-14T19:06:35.698Z","repository":{"id":37619010,"uuid":"297506128","full_name":"rust-lang/portable-simd","owner":"rust-lang","description":"The testing ground for the future of portable SIMD in Rust","archived":false,"fork":false,"pushed_at":"2025-04-07T19:04:40.000Z","size":24499,"stargazers_count":960,"open_issues_count":92,"forks_count":87,"subscribers_count":41,"default_branch":"master","last_synced_at":"2025-04-13T13:58:24.588Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rust-lang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE-APACHE","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":"2020-09-22T01:47:36.000Z","updated_at":"2025-04-13T13:49:22.000Z","dependencies_parsed_at":"2023-01-29T07:15:39.551Z","dependency_job_id":"f222d8a1-4055-4f75-9f37-a5704f9563db","html_url":"https://github.com/rust-lang/portable-simd","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-lang%2Fportable-simd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-lang%2Fportable-simd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-lang%2Fportable-simd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-lang%2Fportable-simd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rust-lang","download_url":"https://codeload.github.com/rust-lang/portable-simd/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248724583,"owners_count":21151559,"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":[],"created_at":"2024-08-01T15:01:47.044Z","updated_at":"2025-04-13T13:58:34.813Z","avatar_url":"https://github.com/rust-lang.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# The Rust standard library's portable SIMD API\n![Build Status](https://github.com/rust-lang/portable-simd/actions/workflows/ci.yml/badge.svg?branch=master)\n\nCode repository for the [Portable SIMD Project Group](https://github.com/rust-lang/project-portable-simd).\nPlease refer to [CONTRIBUTING.md](./CONTRIBUTING.md) for our contributing guidelines.\n\nThe docs for this crate are published from the main branch.\nYou can [read them here][docs].\n\nIf you have questions about SIMD, we have begun writing a [guide][simd-guide].\nWe can also be found on [Zulip][zulip-project-portable-simd].\n\nIf you are interested in support for a specific architecture, you may want [stdarch] instead.\n\n## Hello World\n\nNow we're gonna dip our toes into this world with a small SIMD \"Hello, World!\" example. Make sure your compiler is up to date and using `nightly`. We can do that by running \n\n```bash\nrustup update -- nightly\n```\n\nor by setting up `rustup default nightly` or else with `cargo +nightly {build,test,run}`. After updating, run \n```bash\ncargo new hellosimd\n```\nto create a new crate. Finally write this in `src/main.rs`:\n```rust\n#![feature(portable_simd)]\nuse std::simd::f32x4;\nfn main() {\n    let a = f32x4::splat(10.0);\n    let b = f32x4::from_array([1.0, 2.0, 3.0, 4.0]);\n    println!(\"{:?}\", a + b);\n}\n```\n\nExplanation: We construct our SIMD vectors with methods like `splat` or `from_array`. Next, we can use operators like `+` on them, and the appropriate SIMD instructions will be carried out. When we run `cargo run` you should get `[11.0, 12.0, 13.0, 14.0]`.\n\n## Supported vectors\n\nCurrently, vectors may have up to 64 elements, but aliases are provided only up to 512-bit vectors.\n\nDepending on the size of the primitive type, the number of lanes the vector will have varies. For example, 128-bit vectors have four `f32` lanes and two `f64` lanes.\n\nThe supported element types are as follows:\n* **Floating Point:** `f32`, `f64`\n* **Signed Integers:** `i8`, `i16`, `i32`, `i64`, `isize` (`i128` excluded)\n* **Unsigned Integers:** `u8`, `u16`, `u32`, `u64`, `usize` (`u128` excluded)\n* **Pointers:** `*const T` and `*mut T` (zero-sized metadata only)\n* **Masks:** 8-bit, 16-bit, 32-bit, 64-bit, and `usize`-sized masks\n\nFloating point, signed integers, unsigned integers, and pointers are the [primitive types](https://doc.rust-lang.org/core/primitive/index.html) you're already used to.\nThe mask types have elements that are \"truthy\" values, like `bool`, but have an unspecified layout because different architectures prefer different layouts for mask types.\n\n[simd-guide]: ./beginners-guide.md\n[zulip-project-portable-simd]: https://rust-lang.zulipchat.com/#narrow/stream/257879-project-portable-simd\n[stdarch]: https://github.com/rust-lang/stdarch\n[docs]: https://rust-lang.github.io/portable-simd/core_simd\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frust-lang%2Fportable-simd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frust-lang%2Fportable-simd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frust-lang%2Fportable-simd/lists"}