{"id":19001670,"url":"https://github.com/ralfbiedert/simd_aligned","last_synced_at":"2025-12-12T12:57:21.050Z","repository":{"id":57667357,"uuid":"144053701","full_name":"ralfbiedert/simd_aligned","owner":"ralfbiedert","description":"SIMD aligned data structures to work with `std::simd`.","archived":false,"fork":false,"pushed_at":"2024-12-14T14:49:25.000Z","size":100,"stargazers_count":8,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-17T08:59:23.220Z","etag":null,"topics":["alignment","data-structures","rust","simd"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ralfbiedert.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2018-08-08T18:37:42.000Z","updated_at":"2024-12-14T14:49:29.000Z","dependencies_parsed_at":"2025-04-16T23:05:30.282Z","dependency_job_id":"7636ec44-4051-4efe-9bb6-60ef5784cb97","html_url":"https://github.com/ralfbiedert/simd_aligned","commit_stats":null,"previous_names":["ralfbiedert/simd_aligned_rust"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ralfbiedert%2Fsimd_aligned","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ralfbiedert%2Fsimd_aligned/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ralfbiedert%2Fsimd_aligned/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ralfbiedert%2Fsimd_aligned/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ralfbiedert","download_url":"https://codeload.github.com/ralfbiedert/simd_aligned/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250290357,"owners_count":21406164,"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":["alignment","data-structures","rust","simd"],"created_at":"2024-11-08T18:12:18.226Z","updated_at":"2025-12-12T12:57:21.008Z","avatar_url":"https://github.com/ralfbiedert.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![crates.io-badge]][crates.io-url]\n[![docs.rs-badge]][docs.rs-url]\n![license-badge]\n[![rust-version-badge]][rust-version-url]\n[![rust-build-badge]][rust-build-url]\n\n## In One Sentence\n\nYou want to use safe SIMD datatypes from [`wide`](https://crates.io/crates/wide/) but realized there is no simple, safe and fast way to align your `f32x4` (and friends) in memory _and_ treat them as regular `f32` slices for easy loading and manipulation; `simd_aligned` to the rescue.\n\n\n## Highlights\n\n* built on top of [`wide`](https://crates.io/crates/wide/) for easy data handling\n* supports everything from `u8x16` to `f64x4`\n* think in flat slices (`\u0026[f32]`), but get performance of properly aligned SIMD vectors (`\u0026[f32x4]`)\n* provides N-dimensional [`VecSimd`](https://docs.rs/simd_aligned/latest/simd_aligned/struct.VecSimd.html) and NxM-dimensional [`MatSimd`](https://docs.rs/simd_aligned/latest/simd_aligned/struct.MatSimd.html).\n\n## Examples\n\nProduces a vector that can hold `10` elements of type `f64`. All elements are guaranteed to be properly aligned for fast access.\n\n```rust\nuse simd_aligned::*;\n\n// Create vectors of `10` f64 elements with value `0.0`.\nlet mut v1 = VecSimd::\u003cf64x4\u003e::with(0.0, 10);\nlet mut v2 = VecSimd::\u003cf64x4\u003e::with(0.0, 10);\n\n// Get \"flat\", mutable view of the vector, and set individual elements:\nlet v1_m = v1.flat_mut();\nlet v2_m = v2.flat_mut();\n\n// Set some elements on v1\nv1_m[0] = 0.0;\nv1_m[4] = 4.0;\nv1_m[8] = 8.0;\n\n// Set some others on v2\nv2_m[1] = 0.0;\nv2_m[5] = 5.0;\nv2_m[9] = 9.0;\n\nlet mut sum = f64x4::splat(0.0);\n\n// Eventually, do something with the actual SIMD types. Does\n// `std::simd` vector math, e.g., f64x8 + f64x8 in one operation:\nsum = v1[0] + v2[0];\n```\n\n## Benchmarks\n\nThere is no performance penalty for using `simd_aligned`, while retaining all the\nsimplicity of handling flat arrays.\n\n```rust\ntest vectors::packed       ... bench:          77 ns/iter (+/- 4)\ntest vectors::scalar       ... bench:       1,177 ns/iter (+/- 464)\ntest vectors::simd_aligned ... bench:          71 ns/iter (+/- 5)\n```\n\n## Status\n\n- December 2024: Compiles on stable.\n- March 2023: Compiles again on latest Rust nightly.\n- August 2018: Initial version.\n\n## FAQ\n\n#### How does it relate to [faster](https://github.com/AdamNiederer/faster) and [`std::simd`](https://github.com/rust-lang-nursery/packed_simd/)?\n\n* `simd_aligned` builds on top of `std::simd`. At aims to provide common, SIMD-aligned\n  data structure that support simple and safe scalar access patterns.\n\n* `faster` (as of today) is good if you already have exiting flat slices in your code\n  and want to operate them \"full SIMD ahead\". However, in particular when dealing with multiple\n  slices at the same time (e.g., kernel computations) the performance impact of unaligned arrays can\n  become a bit more noticeable (e.g., in the case of [ffsvm](https://github.com/ralfbiedert/ffsvm-rust/) up to 10% - 20%).\n\n[crates.io-badge]: https://img.shields.io/crates/v/simd_aligned.svg\n[crates.io-url]: https://crates.io/crates/simd_aligned\n[license-badge]: https://img.shields.io/badge/license-MIT-blue.svg\n[docs.rs-badge]: https://docs.rs/simd_aligned/badge.svg\n[docs.rs-url]: https://docs.rs/simd_aligned/\n[rust-version-badge]: https://img.shields.io/badge/rust-1.83%2B-blue.svg?maxAge=3600\n[rust-version-url]: https://github.com/ralfbiedert/simd_aligned\n[rust-build-badge]: https://github.com/ralfbiedert/simd_aligned/actions/workflows/rust.yml/badge.svg\n[rust-build-url]: https://github.com/ralfbiedert/simd_aligned/actions/workflows/rust.yml\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fralfbiedert%2Fsimd_aligned","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fralfbiedert%2Fsimd_aligned","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fralfbiedert%2Fsimd_aligned/lists"}