Skip to content

Document memory layout of vector types - #330

Open
danderson wants to merge 2 commits into
linebender:mainfrom
danderson:push-sqlkyxpmmnuy
Open

Document memory layout of vector types#330
danderson wants to merge 2 commits into
linebender:mainfrom
danderson:push-sqlkyxpmmnuy

Conversation

@danderson

Copy link
Copy Markdown
Contributor

Fixes #327


Also contains a tiny unrelated commit, fixing a dangling link to libm in the top-level crate docs that cargo doc complained about.

Fixes linebender#327

Signed-off-by: David Anderson <dave@natulte.net>
Signed-off-by: David Anderson <dave@natulte.net>
@Shnatsel

Copy link
Copy Markdown
Contributor

Thanks! I like the tests. We might even enforce stronger layout guarantees later, since we do align 512-bit vectors to 512 bits on all platforms AFAIK. Doesn't have to happen as part of this PR though.

It would also be nice to document that the layout of masks varies between platforms and shouldn't be relied upon.

I don't recall if our vectors are repr(C) right now, we might want to make them if they aren't (and see if that alters the layout in any way).

Comment thread fearless_simd/src/lib.rs
//! It benefited from conversations with Luca Versari, though he is not responsible for any of the mistakes or bad decisions.
//!
//! [`pulp`]: https://crates.io/crates/pulp
//! [libm]: https://crates.io/crates/libm

@DJMcNab DJMcNab Aug 15, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welcome!

For awareness, our docs are intended to be built with all features enabled. If you look at https://docs.rs/fearless_simd/latest/fearless_simd/#feature-flags for example, you will see that this link is resolved.

In the past, we've fixed this with a conditional compilation approach:

https://docs.rs/color/latest/src/color/lib.rs.html#75

I'm not going to die on this hill though.
If you are going to apply this fix as-is, you need to remove the duplicate link in README.md (once you've regenned it)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make explicit (documented) promises about layout of vector types?

3 participants