-
Notifications
You must be signed in to change notification settings - Fork 88
Rotation by a runtime value? #216
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
Comments
Question: rotating lanes themselves does not seem to be common in what I've done, but maybe i work on very different problems. |
Rotating lanes themselves, yea. |
It's a reasonable request, LLVM just doesn't expose anything you can't write via |
How might this even be vectorised? |
This should be doable with dynamic shuffles once we have them. |
Well, even with dynamic shuffles, we would still need to build the indices array, which I cannot think how to quickly generate that. fn rotate<T, const N: usize>(vector: Simd<T, N>, k: usize) -> Simd<T, N> {
vector.shuffle(
(Simd::from_array([0, 1, .., N]) + Simd::splat(k)) % Simd::splat(N)
)
} neither of which should be better than I encountered https://stackoverflow.com/questions/19205026/simd-rotate-by-variable, but these don't scale past the native width, or begin to take unreasonable amounts of memory per-table as with the initial idea I suggest. May I have your input on the performance aspects of this? |
This is such a common operation, I was wondering how does one do it with the current API, and/or is anything planned for it?
(With
rotate_lanes_right/left
the rotation parameter must be const. Same, with swizzling API it must be all const.)The text was updated successfully, but these errors were encountered: