-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add some common shuffles #98
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahaha, I love it.
I agree with adding these operations.
It would be nice to prove they are optimized on aarch64 or even on x86_64 before we stabilize these, but I will leave that thought for future "verify vectorization" efforts.
We do need to unfortunately be agonizingly clear as to what ordering is gained from these ops, though.
fn reverse
seems fine. I could see bikeshedding over fn interleave
, (mostly because deinterleave
seems verbose) but eh, the name seems fine, really! Just needs clear docs, is all.
crates/core_simd/src/permute.rs
Outdated
/// Interleave two vectors. | ||
/// | ||
/// The even lanes of the first result contain the lower half of `self`, and the odd | ||
/// lanes contain the lower half of `other`. | ||
/// | ||
/// The even lanes of the second result contain the upper half of `self`, and the odd | ||
/// lanes contain the upper half of `other`. | ||
#[inline] | ||
pub fn interleave(self, other: Self) -> (Self, Self) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should address the case of lane numbering ("are we indexing from zero or one?") explicitly here if we are going to use "even" or "odd". Likewise, "upper" and "lower" need an explicit meaning.
"Interleave" feels slightly uncommon as a vocabulary word, even though it is a technically correct term, so in the documentation itself consider using "alternating" to describe this phenomenon: as-is, going by these remarks, I have to visualize the elements moving before I realize it is in fact alternating.
I don't thiiink I would want to use "zip" like Arm does to describe this, but am unsure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I agree that all of those definitions are a little vague. There's probably a clearer way to describe it, but I'm not sure what that is.
|
Co-authored-by: Jubilee <[email protected]>
This looks much better now. |
Skipping
rotate
etc right now, since it depends on some more const eval that we don't have.