-
Notifications
You must be signed in to change notification settings - Fork 82
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
Explore implementing SIMD types as arrays in the compiler #25
Comments
The vectors should already implement From for conversions to and from arrays. Do we want named methods as well? |
Doh. |
OK I mean... should we? 👀 Leaving this open actually since I still want to go check up on this in the compiler proper, but it makes sense to have the issue here since really it's an API concern. |
so, from_array can be a temporary method, with the advantage that it can be |
I believe I once saw a PR to accept arrays in |
That's really cool to hear! |
Inlining this relevant link from that conversation: rust-lang/rust#5841 👀 |
rust-lang/rust#78863 implemented this! Nice! |
Instantiating SIMD types as tuple literals becomes absolutely hand-cramping when those structs become wider than 2~8 elements, and even 8 is getting a bit tiresome. CTFE is now powerful enough to significantly sugar some fairly nuanced array creation, e.g.:
By providing, at the very least, conversions from the obvious arrays into SIMD types, we can make a lot of things easier on ourselves, so that this can just be used with some kind of method likei8x32::from_array(ARRAY)
.Because arrays are a much more natural fit, I would honestly like to explore "what compiler changes would be required to let
#[repr(simd)]
accept arrays straight-out?" but that may quickly become too complicated, so for now it is just a (very) nice-to-have andstd::simd
conversions can still exist. On the other hand, it might be pretty easy, and that might simplify the overall API for us immensely, so I should at least check.The text was updated successfully, but these errors were encountered: